--- - name: Create tmp certificates directory file: path: ./tmp/{{ hostvars['ada'].inventory_hostname }} state: directory delegate_to: localhost - name: Create certificates directory file: path: /etc/nginx/certs state: directory - name: Copy crt from CA ansible.builtin.fetch: src: /etc/nginx/certs/{{ hostvars['ada'].inventory_hostname }}/ada.crt dest: ./tmp/{{ hostvars['ada'].inventory_hostname }}/ flat: yes delegate_to: "{{ item }}" loop: "{{ groups['ca'] }}" - name: Copy key from CA ansible.builtin.fetch: src: /etc/nginx/certs/{{ hostvars['ada'].inventory_hostname }}/ada.key dest: ./tmp/{{ hostvars['ada'].inventory_hostname }}/ flat: yes delegate_to: "{{ item }}" loop: "{{ groups['ca'] }}" - name: Copy to belvedere ansible.builtin.copy: src: ./tmp/{{ hostvars['ada'].inventory_hostname }}/ dest: /etc/nginx/certs/{{ hostvars['ada'].inventory_hostname }}/ - name: Delete tmp file: path: ./tmp/ state: absent delegate_to: localhost