diff --git a/roles/os-updates/README.md b/roles/os-updates/README.md index 225dd44..5bf7924 100644 --- a/roles/os-updates/README.md +++ b/roles/os-updates/README.md @@ -1,38 +1,35 @@ -Role Name +os-updates ========= -A brief description of the role goes here. +This role update the target system packages Requirements ------------ -Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required. +. Role Variables -------------- -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. +**os_update_auto** (string): If 'reboot' the system will reboot after update, if 'shutdown' will shutdown, else will ignore the parameter +**os_update_auto_delay** (integer): Delay for auto reboot or shutdown Dependencies ------------ -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. +. Example Playbook ---------------- -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: - - - hosts: servers - roles: - - { role: username.rolename, x: 42 } +`ansible-playbook -i inventory/hive.yml os-update.yml --extra-vars="target=odroid"` License ------- -BSD +GPLv3 Author Information ------------------ -An optional section for the role authors to include contact information, or a website (HTML is not allowed). +- [Claudio Maradonna](https://social.unitoo.it/claudio) diff --git a/roles/os-updates/defaults/main.yml b/roles/os-updates/defaults/main.yml index b441ab0..277dce1 100644 --- a/roles/os-updates/defaults/main.yml +++ b/roles/os-updates/defaults/main.yml @@ -1,8 +1,5 @@ --- # defaults file for os-updates -os_update_auto_reboot: false -os_update_reboot_delay: 60 - -os_update_auto_shutdown: false -os_update_shutdown_delay: 60 +os_update_auto: '' +os_update_auto_delay: 60 diff --git a/roles/os-updates/tasks/update_Debian.yml b/roles/os-updates/tasks/update_Debian.yml index 9eefebe..4accc53 100644 --- a/roles/os-updates/tasks/update_Debian.yml +++ b/roles/os-updates/tasks/update_Debian.yml @@ -12,14 +12,14 @@ - name: Reboot when packages were updated reboot: - post_reboot_delay: "{{ os_update_reboot_delay }}" + post_reboot_delay: "{{ os_update_auto_delay }}" when: - apt_update_status.changed - - "os_update_auto_reboot is true" + - "os_update_auto == 'reboot'" - name: Shutdown when packages were updated community.general.shutdown: - delay: "{{ os_update_shutdown_delay }}" + delay: "{{ os_update_auto_delay }}" when: - apt_update_status.changed - - "os_update_auto_shutdown is true" + - "os_update_auto == 'shutdown'"