-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathdestroy.yml
More file actions
executable file
·34 lines (32 loc) · 1.47 KB
/
destroy.yml
File metadata and controls
executable file
·34 lines (32 loc) · 1.47 KB
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
#!/usr/local/bin/ansible-playbook --inventory=inventory
- name: '{{ ansible_name }} | bundle | build'
hosts: containerone
vars_files:
- '../p1.yml'
- 'vars/{{ target_environment }}.yml'
- 'vars/global.yml'
vars:
module: "build"
state_provider: "local"
terraform_module_path: "{{ dir_git_tfcore }}"
terraform_global_variables: "{{ dir_terraform }}/p1.tfvars"
ansible_name_module: "{{ ansible_name }} | {{ module }}"
name_bucket: '{{ target_environment }}-{{ name_cluster_vpc }}-openshift-artifacts'
cloud_key_id_special: "{{ lookup('ini', 'aws_access_key_id section=default file={{ dir_artifacts }}/.aws/govcloud.credentials') }}"
cloud_key_secret_special: "{{ lookup('ini', 'aws_secret_access_key section=default file={{ dir_artifacts }}/.aws/govcloud.credentials') }}"
tasks:
####### Terraform Apply
- name: '{{ ansible_name_module }} | terraform | Build VPC'
terraform:
state: absent
project_path: "{{ terraform_module_path }}"
#variables_file: "{{ terraform_global_variables }}"
register: terraform_output
####### Destroy S3 Bucket
- name: '{{ ansible_name_module }} | aws_s3 | Purge AWS S3 Artifact Bucket: {{ name_cluster_vpc }}-{{ cluster_domain }}'
aws_s3:
bucket: '{{ name_cluster_vpc }}-{{ cluster_domain }}'
region: '{{ cloud_region }}'
mode: delete
aws_access_key: '{{ cloud_key_id_special }}'
aws_secret_key: '{{ cloud_key_secret_special }}'