Skip to content

Commit

Permalink
Merge pull request #4 from rossijonas/feature/security-updates
Browse files Browse the repository at this point in the history
Feature/security updates
  • Loading branch information
rossijonas authored Feb 20, 2023
2 parents cdd3ec6 + 4a44a09 commit 915a9f5
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 7 deletions.
2 changes: 0 additions & 2 deletions .ansible-lint

This file was deleted.

17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ This Ansible role:

### `dnfupdate_security_only`

Set the role to apply only updates marked as security updates, instead of
Set the role to only apply updates marked as security updates.

* **Type**: bool
* **Default**: `false`
Expand Down Expand Up @@ -53,7 +53,9 @@ Set the role to apply only updates marked as security updates, instead of
$ ansible-galaxy install -r requirements.yml
```

## Example Playbook
## Example Playbooks

* Apply all updates available:

```
---
Expand All @@ -62,6 +64,17 @@ Set the role to apply only updates marked as security updates, instead of
- dnfupdate
```

* Apply security updates only:

```
---
- hosts: servers
roles:
- role: dnfupdate
vars:
dnfupdate_security_only: true
```

## License

MIT
Expand Down
7 changes: 6 additions & 1 deletion molecule/default/converge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
- name: Converge
hosts: all
tasks:
- name: "Include rossijonas.dnfupdate"
- name: "Apply all available updates."
include_role:
name: "rossijonas.dnfupdate"
- name: "Apply security updates only."
include_role:
name: "rossijonas.dnfupdate"
vars:
dnfupdate_security_only: true
5 changes: 3 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
- name: Update all installed packages using YUM module
- name: Apply updates using dnf module.
dnf:
name: '*'
security: '{{ dnfupdate_security_only }}'
state: latest
update_cache: true
update_only: true
register: dnfupdate_status

- name: Remove packates not needed anymore
- name: Remove packages not needed anymore
dnf:
autoremove: true

0 comments on commit 915a9f5

Please sign in to comment.