Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- - name: perform linux SAT
- hosts: sat_test_linux_group
- gather_facts: False
- pre_tasks:
- - name: set ansible_play_hosts start fact
- set_fact:
- start_ansible_play_hosts: "{{ ansible_play_hosts }}"
- delegate_to: localhost
- run_once: true
- tasks:
- - name: gather facts
- setup:
- - name: set ansible_play_hosts end fact
- set_fact:
- end_ansible_play_hosts: "{{ ansible_play_hosts }}"
- post_tasks:
- - name: set failed hosts fact
- set_fact:
- failed_hosts: "{{ start_ansible_play_hosts | difference(end_ansible_play_hosts) }}"
- delegate_to: localhost
- run_once: true
- - name: debug start_ansible_play_hosts
- debug:
- var: start_ansible_play_hosts
- delegate_to: localhost
- run_once: true
- - name: debug end_ansible_play_hosts
- debug:
- var: end_ansible_play_hosts
- delegate_to: localhost
- run_once: true
- - name: debug failed_hosts
- debug:
- var: failed_hosts
- delegate_to: localhost
- run_once: true
- - name: dummy exit_status
- set_fact:
- exit_status: { testing: '123' }
- - name: "check if host is available"
- set_fact:
- check_fail_hosts: "{{ check_fail_hosts|default([]) + [ { item : 'HOST FATAL ERROR' } ] }}"
- check_tasks: "{{ check_tasks|default([]) + [ exit_status | combine( { 'task': 'no task selected' } ) ] }}"
- with_items:
- - "{{ failed_hosts }}"
- run_once: yes
- - name: debug check_fail_hosts
- debug:
- var: check_fail_hosts
- delegate_to: localhost
- run_once: true
- - name: debug check_tasks
- debug:
- var: check_tasks
- delegate_to: localhost
- run_once: true
Add Comment
Please, Sign In to add comment