forked from redhat-cop/agnosticd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_runtime.yml
74 lines (64 loc) · 1.83 KB
/
setup_runtime.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
---
- name: Step 0000 Setup runtime
hosts: localhost
connection: local
gather_facts: false
become: false
tasks:
- debug:
msg: "Warning: ANSIBLE_REPO_PATH variable is deprecated, you don't have to use it anymore."
when: ANSIBLE_REPO_PATH is defined
- name: Ensure cloud provider is supported
vars:
agnosticd_cloud_providers:
- ec2
- azure
- osp
- gcp
- ibm
- equinix_metal
- none
- test
assert:
that: cloud_provider in agnosticd_cloud_providers
msg: "Cloud provider {{ cloud_provider }} is not supported."
- 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: Stat output_dir
stat:
path: "{{ output_dir }}"
register: rstat_output_dir
- name: Create output_dir if it does not exists
file:
path: "{{ output_dir }}"
state: directory
when: not rstat_output_dir.stat.exists
- name: Create empty user-info.yaml and user-data.yaml in output dir
copy:
content: |
---
dest: "{{ output_dir }}/{{ item }}"
loop:
- user-info.yaml
- user-data.yaml
# include global vars from the config
- import_playbook: include_vars.yml
# Load galaxy roles of the config
- import_playbook: install_galaxy_roles.yml
tags: galaxy_roles
- name: Step 0000 Setup output_dir
hosts: localhost
connection: local
gather_facts: false
become: false
tasks:
- name: Attempt to restore output_dir contents
when: agnosticd_save_output_dir_archive is defined
include_role:
name: agnosticd_restore_output_dir