Fixed indentation, changed destination path basename for copy module tasks
This commit is contained in:
@@ -1,6 +1,8 @@
|
|||||||
---
|
---
|
||||||
- name: Acquire GPG private keys from other system
|
- name: Acquire GPG private keys from other system
|
||||||
when: not files_mode
|
when: not files_mode
|
||||||
|
block:
|
||||||
|
- name: Acquire GPG private keys' contents from other system
|
||||||
delegate_to: "{{ gpg_private_keys_origin_host }}"
|
delegate_to: "{{ gpg_private_keys_origin_host }}"
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
argv:
|
argv:
|
||||||
@@ -10,10 +12,10 @@
|
|||||||
- "{{ item }}"
|
- "{{ item }}"
|
||||||
loop: "{{ gpg_origin_private_keyids }}"
|
loop: "{{ gpg_origin_private_keyids }}"
|
||||||
register: gpg_secrets
|
register: gpg_secrets
|
||||||
- name: Create GPG private keys
|
- name: Create GPG private keys using acquired GPG private keys' contents
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
content: "{{ item }}"
|
content: "{{ item }}"
|
||||||
dest: "{{ ansible_facts['user_dir'] }}/.gnupg/{{ ansible_facts['user_id'] }}-{{ idx }}.priv.asc"
|
dest: "{{ ansible_facts['user_dir'] }}/.gnupg/{{ gpg_origin_private_keyids[idx] }}.priv.asc"
|
||||||
force: yes
|
force: yes
|
||||||
backup: yes
|
backup: yes
|
||||||
mode: "0600"
|
mode: "0600"
|
||||||
@@ -22,6 +24,19 @@
|
|||||||
loop_control:
|
loop_control:
|
||||||
index_var: idx
|
index_var: idx
|
||||||
register: created_gpg_private_keys
|
register: created_gpg_private_keys
|
||||||
|
- name: Acquire GPG private keys
|
||||||
|
when: files_mode
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: gnupg/{{ item }}.asc
|
||||||
|
dest: "{{ ansible_facts['user_dir'] }}/.gnupg/{{ item }}.priv.asc"
|
||||||
|
force: yes
|
||||||
|
backup: yes
|
||||||
|
mode: "0600"
|
||||||
|
state: present
|
||||||
|
loop: "{{ gpg_origin_private_keyids }}"
|
||||||
|
loop_control:
|
||||||
|
index_var: idx
|
||||||
|
register: created_gpg_private_keys
|
||||||
- name: Import GPG private keys
|
- name: Import GPG private keys
|
||||||
when: (gpg_origin_private_key_passwords | length) == (gpg_origin_private_keyids | length)
|
when: (gpg_origin_private_key_passwords | length) == (gpg_origin_private_keyids | length)
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
|
|||||||
Reference in New Issue
Block a user