feat: port over configuration

This commit is contained in:
2025-12-30 11:23:26 -05:00
parent 2bafd28c5f
commit 1ef0bd58cf
8 changed files with 123 additions and 0 deletions

15
playbooks/destroy.yml Normal file
View File

@@ -0,0 +1,15 @@
- name: Deploy terraform infrastructure.
hosts: localhost
gather_facts: false
vars_files:
- ../vault.yml
tasks:
- name: Destroy
community.general.terraform:
project_path: '../terraform'
state: "absent"
init_reconfigure: true
force_init: true
backend_config: "{{ terraform.backend }}"
variables: "{{ terraform.variables }}"
complex_vars: true

40
playbooks/provision.yml Normal file
View File

@@ -0,0 +1,40 @@
- name: Deploy terraform infrastructure.
hosts: localhost
gather_facts: false
vars_files:
- ../vault.yml
tasks:
- name: Reconfigure and plan.
community.general.terraform:
project_path: '../terraform'
state: "planned"
plan_file: plan.out
init_reconfigure: true
force_init: true
backend_config: "{{ terraform.backend }}"
variables: "{{ terraform.variables }}"
complex_vars: true
- name: Apply.
community.general.terraform:
project_path: '../terraform'
state: "present"
plan_file: plan.out
backend_config: "{{ terraform.backend }}"
variables: "{{ terraform.variables }}"
complex_vars: true
no_color: false
register: terraform_apply
- name: Create secret directory.
ansible.builtin.file:
path: ../secrets
recurse: true
mode: "0755"
state: directory
- name: Send outputs to file.
ansible.builtin.copy:
content: "{{ terraform_apply.outputs }}"
dest: ../secrets/terraform_outputs.yml
mode: '0755'