The “Create SSH keypair in /tmp
” is one task you do want to run on the controller: “delegate_to: localhost
” and “run_once: true
”. Likewise for “Remove generated key pair from the control node
”.
- name: Remove generated key pair from control node
ansible.builtin.file:
path: '{{ item }}'
state: absent
loop:
- /tmp/remcpyuser_key
- /tmp/remcpyuser_key.pub
delegate_to: localhost
run_once: true