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