--- - name: 'apply setup to {{ host | default("all") }}' hosts: '{{ host | default("all") }}' serial: "{{ serial_number | default(5) }}" become: yes pre_tasks: - name: "Check if ansible version is at least 2.10.x" assert: that: - ansible_version.major >= 2 - ansible_version.minor >= 10 msg: "The ansible version has to be at least ({{ ansible_version.full }})" delegate_to: 127.0.0.1 become: false - name: "Gather current server infos" hcloud_server_info: api_token: "{{ hetzner_authentication_token }}" register: hetzner_server_infos delegate_to: 127.0.0.1 become: false tags: - update_networks - awx_communication - name: "Set current server infos as fact: hetzner_server_infos_json" set_fact: hetzner_server_infos_json: "{{ hetzner_server_infos.hcloud_server_info }}" delegate_to: 127.0.0.1 become: false tags: - update_networks - awx_communication - name: "Read ip address for {{ inventory_hostname }}" set_fact: stage_server_ip: "{{ item.ipv4_address }}" when: item.name == inventory_hostname with_items: "{{ hetzner_server_infos_json }}" delegate_to: 127.0.0.1 become: false tags: - update_networks - awx_communication - name: Print the gathered infos debug: var: stage_server_ip delegate_to: 127.0.0.1 become: false tags: - update_networks - awx_communication roles: - role: postfix when: "'postfix' in group_names" - role: keycloak when: "'keycloak' in group_names" - role: harbor when: "'harbor' in group_names" - role: elastic when: "'elastic' in group_names" - role: postgres when: "'postgres' in group_names" - role: prometheus when: "'prometheus' in group_names" - role: awx when: "'awx' in group_names" - role: iam when: "'iam' in group_names" - role: connect when: "'connect' in group_names"