Skip to content

Commit 0e208e2

Browse files
Merge pull request #1 from MonolithProjects/develop
Fixed the Debian/Ubuntu upgrade
2 parents 603f96f + 8aee715 commit 0e208e2

File tree

5 files changed

+53
-40
lines changed

5 files changed

+53
-40
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -25,37 +25,10 @@ jobs:
2525
runs-on: ubuntu-latest
2626
strategy:
2727
fail-fast: false
28-
matrix:
29-
config:
30-
- image: "debian"
31-
tag: "latest"
32-
- image: "debian"
33-
tag: "testing"
34-
- image: "debian"
35-
tag: "unstable"
36-
- image: "centos"
37-
tag: "7"
38-
- image: "centos"
39-
tag: "latest"
40-
- image: "fedora"
41-
tag: "30"
42-
- image: "fedora"
43-
tag: "latest"
44-
- image: "fedora"
45-
tag: "rawhide"
46-
- image: "opensuse"
47-
tag: "latest"
48-
- image: "ubuntu"
49-
tag: "latest"
50-
5128
steps:
5229
- name: checkout
5330
uses: actions/checkout@v2
5431
with:
5532
path: "${{ github.repository }}"
5633
- name: molecule
5734
uses: robertdebock/molecule-action@2.0.0
58-
with:
59-
image: ${{ matrix.config.image }}
60-
tag: ${{ matrix.config.tag }}
61-
options: "--parallel all"

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2020 Michal Muransky
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,20 +5,24 @@ System update
55
<a href="https://galaxy.ansible.com/monolithprojects/system_update"><img src="https://img.shields.io/ansible/role/d/46110"/></a>
66
<a href="https://galaxy.ansible.com/monolithprojects/system_update"><img src="https://img.shields.io/github/v/release/MonolithProjects/ansible-system_update"/></a>
77
<a href="https://github.com/MonolithProjects/ansible-system_update/actions"><img src="https://github.com/MonolithProjects/ansible-system_update/workflows/molecule%20test/badge.svg?branch=master"/></a>
8+
<a href="https://galaxy.ansible.com/monolithprojects/system_update"><img src="https://img.shields.io/github/license/MonolithProjects/ansible-system_update"/></a>
89

910
This role will update all packages on RHEL/CentOS and Debian/Ubuntu systems.
1011
Optionally it can update the packages to specific distro release version (by default it is `latest`).
1112
Another feature is the `smart reboot` where system will be rebooted after the package you specified in `smart_reboot_pkg:` list will be updated.
1213

1314
Requirements
1415
------------
16+
1517
System must have access to the packages repository (Internet, Red Hat Satellite, etc.).
1618

1719

1820
Role Variables
1921
--------------
22+
2023
This is a copy from `defaults/main.yml`
21-
```
24+
25+
```yaml
2226
# Autoremove unused dependency packages for all modules.
2327
autoremove_pkgs: no
2428

@@ -30,23 +34,25 @@ autoremove_pkgs: no
3034
# Specifies the Linux distro release from which all packages will be installed.
3135
# By default the packages will be updated to the latest distro release.
3236

33-
# Debian or Ubuntu release version
37+
# Debian or Ubuntu release version (example: xenial)
3438
# deb_release_ver:
3539

36-
# RHEL/CentOS release version
40+
# RHEL/CentOS release version (example 6.10)
3741
# el6_release_ver:
3842

39-
# RHEL/CentOS release version
43+
# RHEL/CentOS release version (exanple: 7.6.1810)
4044
# el7_release_ver:
4145

42-
# RHEL/CentOS release version
46+
# RHEL/CentOS release version (example: 8.1.1911)
4347
# el8_release_ver:
4448
```
4549

4650
Example Playbook
4751
----------------
52+
4853
Simple example. All packages will be updated to the latest version.
49-
```
54+
55+
```yaml
5056
---
5157
- name: Example
5258
hosts: all
@@ -59,7 +65,7 @@ In this example `el7` system (RHEL7 or CentOS7) packages will be updated to the
5965
Using `autoremove_pkgs` the dependencies which are no longer needed will be autoremoved.
6066
System will be rebooted if `kernel` or `dbus` package is updated.
6167

62-
```
68+
```yaml
6369
---
6470
- name: Example
6571
hosts: all

defaults/main.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ autoremove_pkgs: no
1010
# Specifies the Linux distro release from which all packages will be installed.
1111
# By default the packages will be updated to the latest distro release.
1212

13-
# Debian or Ubuntu release version
13+
# Debian or Ubuntu release version (example: xenial)
1414
# deb_release_ver:
1515

16-
# RHEL/CentOS release version
16+
# RHEL/CentOS release version (example 6.10)
1717
# el6_release_ver:
1818

19-
# RHEL/CentOS release version
19+
# RHEL/CentOS release version (exanple: 7.6.1810)
2020
# el7_release_ver:
2121

22-
# RHEL/CentOS release version
22+
# RHEL/CentOS release version (example: 8.1.1911)
2323
# el8_release_ver:

tasks/update_deb.yml

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,27 @@
11
---
2+
- name: Update Debian/Ubuntu system to specific release
3+
apt:
4+
name: "*"
5+
update_cache: yes
6+
autoclean: yes
7+
state: latest
8+
default_release: "{{ deb_release_ver }}"
9+
autoremove: "{{ autoremove_pkgs }}"
10+
when:
11+
- ansible_pkg_mgr == "apt" and deb_release_ver is defined
12+
register: update_result_apt
13+
until: update_result_apt is succeeded
14+
retries: 3
15+
216
- name: Update Debian/Ubuntu system
317
apt:
418
name: "*"
519
update_cache: yes
620
autoclean: yes
721
state: latest
8-
default_release: "{% if deb_release_ver is defined %}{{ deb_release_ver }}{% else %}{{ ansible_distribution_major_version }}.*{% endif %}"
922
autoremove: "{{ autoremove_pkgs }}"
1023
when:
11-
- ansible_pkg_mgr == "apt"
24+
- ansible_pkg_mgr == "apt" and deb_release_ver is not defined
1225
register: update_result_apt
1326
until: update_result_apt is succeeded
1427
retries: 3

0 commit comments

Comments
 (0)