Skip to content

Commit 1e0c704

Browse files
committed
Merge branch 'master' of https://github.com/thaumos/ansible-terraform into thaumos-master
2 parents f9cd487 + 3937e46 commit 1e0c704

File tree

4 files changed

+27
-14
lines changed

4 files changed

+27
-14
lines changed

ansible/httpd.yml

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,29 @@
11
---
2-
- hosts: all
2+
- hosts: http
33
become: yes
44
become_user: root
5+
6+
vars:
7+
helloworld: Meow!
8+
59
tasks:
610
- name: Install firewalld
711
yum: name=firewalld
812
- name: Stop firewalld
9-
service: name=firewalld state=stopped
13+
service:
14+
name: firewalld
15+
state: stopped
16+
1017
- name: Install the httpd package
11-
yum: name=httpd
18+
yum:
19+
name: httpd
20+
1221
- name: Start the httpd service
13-
service: name=httpd state=started
22+
service:
23+
name: httpd
24+
state: started
25+
1426
- name: Configure Cat App
15-
script: ../files/webapp.sh
27+
template:
28+
src: ../files/index.j2
29+
dest: /var/www/html/index.html

ansible/inventory.yaml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
http:
2+
hosts:
3+
ec2-13-57-34-111.us-west-1.compute.amazonaws.com:
4+
vars:
5+
ansible_ssh_user: centos
Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1-
#!/bin/sh
2-
3-
cat << EOM > /var/www/html/index.html
41
<html>
5-
<head><title>Meow!</title></head>
2+
<head><title>{{ helloworld }}</title></head>
63
<body style="background-image: linear-gradient(red,orange,yellow,green,blue,indigo,violet);">
74
<center><img src="http://placekitten.com/800/600"></img></center>
85
<marquee><h1>Meow World</h1></marquee>
96
</body>
10-
</html>
11-
EOM
12-
13-
echo "Your demo is now ready."
7+
</html>

terraform_azure/main.tf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ resource "azurerm_virtual_machine" "site" {
122122
}
123123

124124
provisioner "local-exec" {
125-
command = "ansible-playbook -i '${azurerm_public_ip.tf-ansible-pip.fqdn},' --private-key ${var.ssh_key_path} ../ansible/httpd.yml"
125+
command = "ansible-playbook -i ../ansible/inventory.yaml --private-key ${var.ssh_key_path} ../ansible/httpd.yml"
126126
}
127127

128128
}

0 commit comments

Comments
 (0)