Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
joe-speedboat committed Dec 17, 2024
1 parent c9523c9 commit bf417b2
Show file tree
Hide file tree
Showing 11 changed files with 33 additions and 16 deletions.
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,14 @@ Working internet and proper repository configuration on machines.
* The `os_update_reboot` variable has been updated.
Old boolean values (`True`|`False`) are no longer supported and should be replaced
with the new string values (`allow`|`deny`|`force`).
* however, at the moment we catch them up and migrate them:
* however, at the moment we catch them up and migrate old var settings:
* `True` => `allow`
* `False` => `deny`

## Role Variables
* gather_facts is turned off, due we need to decide if host is online first.
we do this multiple times, to avoid load and connectivity issues.
please look into `tests` folder.
* gather_facts is now turned on by default
* we notify if missing

## Role Variables
Most variables have ```varname_default``` equivalent, which is meant to be used for overriding the default at playbook level.
So you can define the default behavior for all targets that have no variables defined at all. eg: full|security patching.

Expand Down
2 changes: 1 addition & 1 deletion tasks/full-Fedora.yml
2 changes: 1 addition & 1 deletion tasks/full-Ubuntu.yml
2 changes: 1 addition & 1 deletion tasks/kernel-cleanup-Fedora.yml
2 changes: 1 addition & 1 deletion tasks/kernel-cleanup-Ubuntu.yml
20 changes: 18 additions & 2 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,22 @@
---
# tasks file for os_update

- name: gather facts if not exist
block:
- name: gather facts
setup:
- name: Display warning if facts did not exist
debug:
msg:
- WARNING, fact gathering is required for this play
- Since this is a breaking change, we do it for now
- Please update your variables accordingly.
- change your play to enable gather_facts
- name: Wait 3 minutes if legacy value was used, just to get attention
wait_for:
timeout: 180
when: ansible_facts is undefined or ansible_facts == {}

- name: Check if os_update_reboot has a legacy value
set_fact:
legacy_value_detected: "{{ os_update_reboot in [True, False, '0', '1'] }}"
Expand All @@ -20,9 +36,9 @@
- Please update your variables accordingly.
- "Migrated values: os_update_reboot: {{ os_update_reboot }}"

- name: Wait 5 minutes if legacy value was used, just to get attention
- name: Wait 3 minutes if legacy value was used, just to get attention
wait_for:
timeout: 300
timeout: 180
when: legacy_value_detected

- name: Define rhelAll fact dummy
Expand Down
2 changes: 1 addition & 1 deletion tasks/reboot-Ubuntu.yml
2 changes: 1 addition & 1 deletion tasks/security-Fedora.yml
2 changes: 1 addition & 1 deletion tasks/security-Ubuntu.yml
3 changes: 2 additions & 1 deletion tests/full.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- hosts: all
gather_facts: no
gather_facts: True
become: True
roles:
- joe-speedboat.os_update
vars:
Expand Down
3 changes: 2 additions & 1 deletion tests/security.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- hosts: all
gather_facts: no
gather_facts: true
become: True
roles:
- joe-speedboat.os_update
vars:
Expand Down

0 comments on commit bf417b2

Please sign in to comment.