-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathsite.yml
47 lines (41 loc) · 1.49 KB
/
site.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
#!/usr/local/bin/ansible-playbook --inventory=inventory
- name: ' Konductor UPI '
hosts: local
vars:
module: "build"
state_provider: "local"
tf_module_path: "{{ dir_terraform }}/shaman"
vars_module_path: "{{ dir_terraform }}"
ansible_name_module: " Konductor | UPI | {{ module }}"
vars_files:
- vars/global.yml
tasks:
- name: '{{ ansible_name_module }} | file | Create ~/.aws'
file:
path: "/root/.aws"
state: directory
####### Stage Variables & AWS Creds
- name: '{{ ansible_name_module }} | template | Terraform Vars & aws credentials'
template:
src: "{{ item.name }}"
dest: "{{ item.dest }}"
mode: "{{ item.mode }}"
loop:
- { mode: '755', name: "templates/terraform/global.tfvars.j2", dest: "{{ tf_module_path }}/global.tfvars"}
- { mode: '600', name: "templates/aws/credentials.j2", dest: "{{ local_home }}/.aws/credentials"}
####### Terraform Init
- name: '{{ ansible_name_module }} | shell | terraform init'
shell: terraform init
loop:
- "{{ tf_module_path }}/elb"
- "{{ tf_module_path }}/control-plane"
####### Terraform Apply
- name: '{{ ansible_name_module }} | terraform | apply'
terraform:
project_path: "{{ item }}"
variables_file: "{{ vars_module_path }}/global.tfvars"
state: present
loop:
- "{{ tf_module_path }}/elb"
- "{{ tf_module_path }}/control-plane"
register: tf_output