refactor ansible code in to ansible-2.0 folder, and created space for ansible-2.10
This commit is contained in:
9
ansible-2.0/roles/_install_updates/tasks/main.yml
Normal file
9
ansible-2.0/roles/_install_updates/tasks/main.yml
Normal file
@@ -0,0 +1,9 @@
|
||||
---
|
||||
# update packages to latest
|
||||
|
||||
- name: run apt updates
|
||||
apt:
|
||||
upgrade: dist
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
when: ansible_os_family == "Debian"
|
||||
18
ansible-2.0/roles/_install_updates/tasks/rebootAndWait.yml
Normal file
18
ansible-2.0/roles/_install_updates/tasks/rebootAndWait.yml
Normal file
@@ -0,0 +1,18 @@
|
||||
---
|
||||
|
||||
# wait random time to start this to offset reboots of individual machines
|
||||
- pause: seconds={{ 100 | random(1,10) }}
|
||||
|
||||
# Send the reboot command
|
||||
- shell: shutdown -r now
|
||||
|
||||
# This pause is mandatory, otherwise the existing control connection gets reused!
|
||||
- pause: seconds=30
|
||||
|
||||
# Now we will run a local 'ansible -m ping' on this host until it returns.
|
||||
# This works with the existing ansible hosts inventory and so any custom ansible_ssh_hosts definitions are being used
|
||||
- local_action: shell ansible -u {{ ansible_user_id }} -m ping {{ inventory_hostname }}
|
||||
register: result
|
||||
until: result.rc == 0
|
||||
retries: 30
|
||||
delay: 10
|
||||
Reference in New Issue
Block a user