1234567891011121314151617181920212223242526272829303132 |
- ---
- - name: Get the hosts in node_inventory
- command: >-
- awx --conf.host {{ awx_host }} --conf.username {{ awx_admin_user }} --conf.password {{ awx_password }}
- --conf.insecure hosts list --inventory {{ node_inventory }} -f human --filter "name"
- changed_when: false
- no_log: true
- register: hosts_list
- - name: Add the host to the group in node_inventory if present
- awx.awx.tower_group:
- name: "{{ item.split(',')[3] }}"
- inventory: "{{ node_inventory }}"
- hosts:
- - "{{ item.split(',')[2] }}"
- tower_config_file: "{{ tower_config_file }}"
- when:
- - item.split(',')[2] != "IP"
- - item.split(',')[2] in hosts_list.stdout
|