Use a template for rendering index.html
authorLorin Hochstein <lorin.hochstein@sendgrid.com>
Sun, 15 Feb 2015 22:07:08 +0000 (17:07 -0500)
committerLorin Hochstein <lorin.hochstein@sendgrid.com>
Sun, 15 Feb 2015 22:53:31 +0000 (17:53 -0500)
ch02/playbooks/templates/index.html.j2 [new file with mode: 0644]
ch02/playbooks/web-notls.yml
ch02/playbooks/web-tls.yml

diff --git a/ch02/playbooks/templates/index.html.j2 b/ch02/playbooks/templates/index.html.j2
new file mode 100644 (file)
index 0000000..a276e9d
--- /dev/null
@@ -0,0 +1,12 @@
+<html>
+  <head>
+    <title>Welcome to ansible</title>
+  </head>
+  <body>
+  <h1>nginx, configured by Ansible</h1>
+  <p>If you can see this, Ansible successfully installed nginx.</p>
+
+  <p>{{ ansible_managed }}</p>
+  </body>
+</html>
+
index 31ffc17..ea66c8f 100644 (file)
@@ -13,6 +13,6 @@
         src=/etc/nginx/sites-available/default
         state=link
     - name: copy index.html
-      copy: src=files/index.html dest=/usr/share/nginx/html/index.html mode=0644
+      template: src=templates/index.html.j2 dest=/usr/share/nginx/html/index.html mode=0644
     - name: restart nginx
       service: name=nginx state=restarted
index c69a5c8..fdb7cba 100644 (file)
@@ -25,7 +25,7 @@
       file: dest=/etc/nginx/sites-enabled/default src={{ conf_file }} state=link
       notify: restart nginx
     - name: copy index.html
-      copy: src=files/index.html dest=/usr/share/nginx/html/index.html mode=0644
+      template: src=templates/index.html.j2 dest=/usr/share/nginx/html/index.html mode=0644
   handlers:
     - name: restart nginx
       service: name=nginx state=restarted