--- - name: Provision guests hosts: all tasks: - name: Install needed packages (Archlinux) become: true community.general.pacman: name: - pass - sudo - make - ansible when: ansible_distribution == 'Archlinux' - name: Install needed packages (Debian) become: true ansible.builtin.apt: name: - pass - sudo - make - ansible when: ansible_distribution == 'Debian' - name: Export host gpg secret-keys delegate_to: localhost ansible.builtin.command: cmd: gpg --export-secret-keys --armor register: secret_key no_log: true - name: Import gpg secret-keys on guest ansible.builtin.command: cmd: gpg --import --batch stdin: "{{ secret_key.stdout }}"