- name: Add host to {{ postgresql_cacert_ca_host_group }} add_host: groups: "{{ postgresql_cacert_ca_host_group }}" hostname: "{{ hostvars[item]['ansible_hostname'] }}" ansible_host: "{{ hostvars[item]['ansible_host'] }}" with_items: - "{{ ansible_play_hosts[0] }}" changed_when: false when: groups[postgresql_cacert_ca_host_group] is not defined - name: Add all hosts to {{ postgresql_cacert_clients_group }} add_host: groups: "{{ postgresql_cacert_clients_group }}" hostname: "{{ hostvars[item]['ansible_hostname'] }}" ansible_host: "{{ hostvars[item]['ansible_host'] }}" with_items: - "{{ ansible_play_hosts }}" changed_when: false when: groups[postgresql_cacert_clients_group] is not defined - name: CA and certs | Include CA include_tasks: ca.yaml - name: CA and certs | Include Certificates include_tasks: certs.yaml loop: "{{ groups[postgresql_cacert_clients_group] }}"