1234567891011121314151617181920212223242526272829303132333435363738394041424344454647 |
- - name: Get the hosts in node_inventory
- command: >-
- awx
-
- changed_when: false
- no_log: true
- register: hosts_list
- - name: Add the host to compute group in node_inventory if it exists
- awx.awx.tower_group:
- name: "{{ item.split(',')[3] }}"
- inventory: "{{ node_inventory }}"
- preserve_existing_hosts: true
- hosts:
- - "{{ item.split(',')[2] }}"
- tower_config_file: "{{ tower_config_file }}"
- when:
- - item.split(',')[2] != "IP"
- - item.split(',')[2] in hosts_list.stdout
- - item.split(',')[3] == "compute"
- - name: Add the host to other groups in node_inventory if it exists
- 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
- - item.split(',')[3] != "compute"
|