forked from redhat-cop/agnosticd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_output_dir.yml
53 lines (48 loc) · 1.51 KB
/
setup_output_dir.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
- name: Step 0000 Setup Output Directory
hosts: localhost
connection: local
gather_facts: false
become: false
tasks:
- name: Set output_dir if not defined
set_fact:
output_dir: >-
{{
ANSIBLE_REPO_PATH + '/workdir' if ANSIBLE_REPO_PATH is defined
else '/tmp/output_dir'
}}
when: output_dir is not defined
- name: Create output_dir if it does not exists
file:
path: "{{ output_dir }}"
state: directory
- name: Attempt to restore output_dir contents
when: agnosticd_save_output_dir_archive is defined
include_role:
name: agnosticd_restore_output_dir
- name: Touch file provision-user-data.yaml and provision-user-info.yaml
file:
state: touch
path: "{{ [ output_dir, 'provision-' ~ item ] | path_join }}"
loop:
- user-info.yaml
- user-data.yaml
- name: Create empty user-info.yaml and user-data.yaml in output dir
when: not agnosticd_preserve_user_data | default(false) | bool
copy:
content: |
---
dest: "{{ [ output_dir, ACTION ~ '-' ~ item ] | path_join }}"
loop:
- user-info.yaml
- user-data.yaml
- name: Create symlink user-data.yaml -> provision-user-data.yaml
file:
src: "{{ [ output_dir, 'provision-' ~ item ] | path_join }}"
dest: "{{ [ output_dir, item ] | path_join }}"
state: link
force: true
loop:
- user-info.yaml
- user-data.yaml