diff options
author | B Stack <bgstack15@gmail.com> | 2016-10-06 15:22:05 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2016-10-06 15:22:05 -0400 |
commit | 2c3fb0d51f0e1044eaca306cc74045b01a202891 (patch) | |
tree | 83bb69098cfc5d07d3a5ceb27794f1a2fbaae00b /roles/ldap_certs/tasks/main.yml | |
parent | Fixed a few things, added ldap_certs stub (diff) | |
download | ansible01-2c3fb0d51f0e1044eaca306cc74045b01a202891.tar.gz ansible01-2c3fb0d51f0e1044eaca306cc74045b01a202891.tar.bz2 ansible01-2c3fb0d51f0e1044eaca306cc74045b01a202891.zip |
Diffstat (limited to 'roles/ldap_certs/tasks/main.yml')
-rw-r--r-- | roles/ldap_certs/tasks/main.yml | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/roles/ldap_certs/tasks/main.yml b/roles/ldap_certs/tasks/main.yml index 685cd79..a088b38 100644 --- a/roles/ldap_certs/tasks/main.yml +++ b/roles/ldap_certs/tasks/main.yml @@ -14,3 +14,41 @@ - files: - 'roles/ldap_certs/hosts/{{ ansible_fqdn }}.yml' skip: true + +- name: ldap_certs deploy files that exist + template: src='{{ item.file }}' dest='{{ ldap_certs_cert_dir }}/{{ item.file | regex_replace('.*/','') }}' owner='{{ ldap_certs_owner }}' group='{{ ldap_certs_group }}' mode=0644 #' + with_items: + - '{{ ldap_certs }}' + when: + - ( not '{{ item.exists | lower }}' == 'false' ) + - ldap_certs is defined + +- name: ldap_certs remove files that should not exist + file: path='{{ ldap_certs_cert_dir }}/{{ item.file | regex_replace('.*/','') }}' state='absent' + with_items: + - '{{ ldap_certs }}' + when: + - ( not '{{ item.exists }}' ) or ( '{{ item.exists | lower }}' == 'false' ) + - ldap_certs is defined + +- name: ldap_certs get hash values + command: openssl x509 -in "{{ ldap_certs_cert_dir }}/{{ item.file | regex_replace('.*/','') }}" -hash -noout + register: hashes + with_items: + - '{{ ldap_certs }}' + when: + - '{{ item.exists }}' + - ( not '{{ item.gets_hashlink | lower }}' == 'false' ) + - ldap_certs is defined + +- name: ldap_certs deploy hashlink files + file: + path: "{{ ldap_certs_hashlink_dir }}/{{ item.stdout | quote }}.0" + src: "{{ ldap_certs_cert_dir}}/{{ item.item.file | regex_replace('.*/','') }}" + state: 'link' + with_items: + - '{{ hashes.results }}' + when: + - hashes is defined + - item.stdout is defined + - ldap_certs is defined |