Update playbooks/update_system.yml
This commit is contained in:
@@ -1,12 +1,14 @@
|
|||||||
- name: Check Host Availability
|
- name: Check Host Availability
|
||||||
hosts: all
|
hosts: all
|
||||||
gather_facts: false
|
gather_facts: false
|
||||||
|
ignore_unreachable: true
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Ping hosts to check availability
|
- name: Ping hosts to check availability
|
||||||
ansible.builtin.ping:
|
ansible.builtin.ping:
|
||||||
register: ping_result
|
register: ping_result
|
||||||
ignore_errors: true
|
ignore_errors: true
|
||||||
|
ignore_unreachable: true
|
||||||
|
|
||||||
- name: Add reachable hosts to group
|
- name: Add reachable hosts to group
|
||||||
ansible.builtin.group_by:
|
ansible.builtin.group_by:
|
||||||
@@ -16,7 +18,8 @@
|
|||||||
- name: Report offline hosts
|
- name: Report offline hosts
|
||||||
ansible.builtin.debug:
|
ansible.builtin.debug:
|
||||||
msg: "Host {{ inventory_hostname }} is OFFLINE and will be skipped"
|
msg: "Host {{ inventory_hostname }} is OFFLINE and will be skipped"
|
||||||
when: ping_result is failed
|
when: ping_result is not succeeded
|
||||||
|
delegate_to: localhost
|
||||||
|
|
||||||
- name: Update and Upgrade Packages
|
- name: Update and Upgrade Packages
|
||||||
hosts: reachable_hosts
|
hosts: reachable_hosts
|
||||||
|
|||||||
Reference in New Issue
Block a user