ceph-ansible/roles/ceph-iscsi-gw/tasks/deploy_ssl_keys.yml

42 lines
1009 B
YAML

---
- name: set_fact crt_files
set_fact:
crt_files:
- "/etc/ceph/iscsi-gateway.crt"
- "/etc/ceph/iscsi-gateway.key"
- "/etc/ceph/iscsi-gateway.pem"
- "/etc/ceph/iscsi-gateway-pub.key"
- name: stat for crt file(s)
local_action:
module: stat
path: "{{ fetch_directory }}/{{ fsid }}/{{ item }}"
with_items: "{{ crt_files }}"
changed_when: false
failed_when: false
check_mode: no
register: crt_files_exist
- name: try to fetch crt file(s)
copy:
src: "{{ fetch_directory }}/{{ fsid }}/{{ item.0 }}"
dest: "{{ item.0 }}"
owner: root
group: root
mode: 0400
changed_when: false
with_together:
- "{{ crt_files }}"
- "{{ crt_files_exist.results }}"
when: item.1.stat.exists == true
- name: set_fact generate_crt
set_fact:
generate_crt: true
with_items: "{{ crt_files_exist.results }}"
when: item.stat.exists == false
- name: include generate_crt.yml
include: generate_crt.yml
when: generate_crt|default(false)|bool