-
Notifications
You must be signed in to change notification settings - Fork 2
/
playbook.yml
45 lines (39 loc) · 1.1 KB
/
playbook.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
# WIP Ansible to Terraform - Do not use now
- hosts: all
vars:
name: Terraform project dir
project_dir: "/home/ec2-user/aws-terraform"
home_dir: "/home/ec2-user/aws-terraform"
tasks:
- git:
repo: 'https://github.com/dwaiba/aws-terraform'
dest: "{{ home_dir }}"
clone: yes
update: yes
# Basic deploy of a service
- terraform:
project_path: "{{ project_dir }}"
state: present
# init
- terraform:
project_path: '/home/ec2-user/aws-terraform'
state: "{{ state }}"
force_init: true
- debug:
var: init_result.stdout_lines
- name: terraform plan
terraform:
project_path: "{{ project_dir }}"
plan_file: "{{ project_dir }}/myplan.tfplan"
state: planned
register: plan_result
- debug:
var: plan_result.stdout_lines
- name: terraform apply
terraform:
project_path: "{{ project_dir }}"
state: present
plan_file: "{{ project_dir }}/myplan.tfplan"
register: apply_result
- debug:
var: apply_result.stdout_lines