Changeset - 279640b2178c
[Not reviewed]
0 2 0
Branko Majic (branko) - 7 years ago 2017-08-21 13:44:19
branko@majic.rs
MAR-121: Fixed key ID extraction in backup_client role to handle Ansible 2.x quirk.
2 files changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
roles/backup_client/defaults/main.yml
Show inline comments
 
@@ -14,10 +14,10 @@ backup_server_port: 2222
 
backup_client_gnupg_details:
 
  jessie:
 
    binary: gpg2
 
    cutoff: '{8}'
 
    cutoff: '8'
 
  stretch:
 
    binary: gpg
 
    cutoff: '{0}'
 
    cutoff: '0'
 

	
 
gnupg_binary: "{{ backup_client_gnupg_details[ansible_distribution_release]['binary'] }}"
 
gnupg_key_cutoff: "{{ backup_client_gnupg_details[ansible_distribution_release]['cutoff'] }}"
roles/backup_client/tasks/main.yml
Show inline comments
 
@@ -54,13 +54,13 @@
 
    - Import public keys
 

	
 
- name: Extract encryption key identifier (Duplicty requires key ID in hexadecimal format)
 
  shell: "{{ gnupg_binary }} --list-packets /etc/duply/main/private_keys.asc | grep keyid: | head -n1 | sed -e 's/.*: //' | sed -re 's/^.{{gnupg_key_cutoff}}//'"
 
  shell: "{{ gnupg_binary }} --list-packets /etc/duply/main/private_keys.asc | grep keyid: | head -n1 | sed -e 's/.*: //' | sed -re 's/^.{{ '{' + gnupg_key_cutoff + '}' }}//'"
 
  register: backup_encryption_key_id
 
  changed_when: False
 
  failed_when: backup_encryption_key_id.stdout == ""
 

	
 
- name: Extract additional encryption keys identifiers (Duplicty requires key ID in hexadecimal format)
 
  shell: "{{ gnupg_binary }} --list-packets /etc/duply/main/public_keys.asc | grep keyid: | sed -e 's/.*: //' | sort -u | sed -re 's/^.{{gnupg_key_cutoff}}//' | tr '\n' ',' | sed -e 's/,$//'"
 
  shell: "{{ gnupg_binary }} --list-packets /etc/duply/main/public_keys.asc | grep keyid: | sed -e 's/.*: //' | sort -u | sed -re 's/^.{{ '{' + gnupg_key_cutoff + '}' }}//' | tr '\n' ',' | sed -e 's/,$//'"
 
  when: backup_additional_encryption_keys
 
  register: backup_additional_encryption_keys_ids
 
  changed_when: False
0 comments (0 inline, 0 general)