--- # tasks file for role_pack_secrets - name: Create secrets.tar.gz.enc shell: "tar -czvpf - -C {{ WORKDIR }} secrets | openssl enc -aes-256-cbc -md md5 -pass env:SECRETS_ARCHIVE_PASSPHRASE -salt -out {{ WORKDIR }}/secrets.tar.gz.enc" - name: Create /mnt/archives_critiques/secrets directory on serveur-appart ansible.builtin.file: path: /mnt/archives_critiques/secrets state: directory owner: "{{ user }}" group: "{{ user }}" remote_user: "{{ user }}" vars: ansible_ssh_port: 2224 delegate_to: chez-yohan.scimetis.net become: true - name: Get checksum of secrets.tar.gz.enc ansible.builtin.stat: path: "{{ WORKDIR }}/secrets.tar.gz.enc" register: stats_output - name: Copy new secrets on serveur-appart ansible.builtin.copy: src: "{{ WORKDIR }}/secrets.tar.gz.enc" dest: "/mnt/archives_critiques/secrets/secrets.tar.gz.enc-{{ stats_output.stat.checksum }}" remote_user: "{{ user }}" vars: ansible_ssh_port: 2224 delegate_to: chez-yohan.scimetis.net