-
Notifications
You must be signed in to change notification settings - Fork 0
/
ansible.yml
31 lines (28 loc) · 927 Bytes
/
ansible.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
- hosts: all
name: Copies terraform configs to remotes, plans and applies terraform
vars:
plan_only: yes
state: present
env: dev
become: true
tasks:
- name: Copy base tf module dir to remotes
copy:
dest: ~/terraform/
src: terraform/
- name: Copy live tf module dir to remotes
copy:
dest: "~/live/{{ env }}/"
src: "live/{{ env }}/"
- name: Run Terraform Task
check_mode: "{{ plan_only }}" # can pass via env yes | no
register: terraform
community.general.terraform:
project_path: "~/live/{{ env }}/"
state: "{{ state }}"
variables: "{{ terraform_tvars | default(omit) }}"
variables_files: "{{ terraform_tvars_files | default(omit) }}"
backend_config_files: "{{ backend_config_files | default(omit) }}"
force_init: true
- name: View Output
debug: var=terraform.stdout_lines