-
Notifications
You must be signed in to change notification settings - Fork 7
/
run.yml
executable file
·68 lines (59 loc) · 2.19 KB
/
run.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
#!/usr/local/bin/ansible-playbook --inventory=inventory
- name: ' Konductor | Devkit | Build VPC'
hosts: local
vars:
module: "build"
state_provider: "local"
tf_module_path: "{{ dir_terraform }}/devkit-vpc"
ansible_name_module: " Konductor | Devkit VPC | {{ module }}"
vars_files:
- vars/global.yml
tasks:
####### Symlinks
# - name: '{{ ansible_name_module }} | variable | Create Provider symlink'
# file:
# src: "{{ tf_module_path }}/provider.tf"
# dest: "{{ item }}"
# state: link
# loop:
# - "{{ tf_module_path }}/vpc/provider.tf"
# - "{{ tf_module_path }}/security-groups/provider.tf"
# - "{{ tf_module_path }}/iam-roles/provider.tf"
# - "{{ tf_module_path }}/bastion-node/provider.tf"
# - "{{ tf_module_path }}/registry-node/provider.tf"
# - "{{ tf_module_path }}/route-53/provider.tf"
####### Terraform Init
- name: '{{ ansible_name_module }} | shell | terraform init'
shell: terraform init
loop:
- "{{ tf_module_path }}"
- "{{ tf_module_path }}/vpc"
- "{{ tf_module_path }}/security-groups"
- "{{ tf_module_path }}/iam-roles"
- "{{ tf_module_path }}/bastion-node"
- "{{ tf_module_path }}/registry-node"
- "{{ tf_module_path }}/route-53"
####### Terraform Apply
- name: '{{ ansible_name_module }} | terraform | apply'
terraform:
project_path: "{{ tf_module_path }}"
variables_file: "{{ tf_module_path }}/global.tfvars"
force_init: true
state: present
register: tf_output
# ####### Purge SSH known_hosts entries if previous entries found
# - name: '{{ ansible_name_module }} | lineinfile | purge previous known_hosts entries'
# lineinfile:
# dest: "{{ local_home }}/.ssh/known_hosts"
# regexp: "{{ item.regex }}"
# state: absent
# with_items:
# - { regex: ensign }
# - { regex: '{{ tf_output.outputs.public_ipv4.value }}' }
#
# ####### Declare result & public address of instance
# - name: 'Ensign Public IP Address'
# debug:
# msg:
# - "New instance created at the following ip address:"
# - "{{ tf_output.outputs.public_ipv4.value }}"