2017-08-05 02:18:11 +08:00
|
|
|
---
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: set_fact crt_files
|
2017-08-05 02:18:11 +08:00
|
|
|
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: stat path={{ fetch_directory }}/{{ fsid }}/{{ item }}
|
|
|
|
with_items: "{{ crt_files }}"
|
|
|
|
changed_when: false
|
|
|
|
failed_when: false
|
|
|
|
always_run: true
|
|
|
|
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
|
|
|
|
|
2017-09-21 16:07:37 +08:00
|
|
|
- name: set_fact generate_crt
|
|
|
|
set_fact:
|
|
|
|
generate_crt: true
|
|
|
|
with_items: "{{ crt_files_exist.results }}"
|
|
|
|
when: item.stat.exists == false
|
|
|
|
|
2017-09-15 06:48:53 +08:00
|
|
|
- name: include generate_crt.yml
|
|
|
|
include: generate_crt.yml
|
2017-10-03 22:48:17 +08:00
|
|
|
when: generate_crt|default(false)|bool
|