more variables
This commit is contained in:
@@ -4,5 +4,4 @@
|
|||||||
user: ansible
|
user: ansible
|
||||||
become: true
|
become: true
|
||||||
roles:
|
roles:
|
||||||
- { role: myapache, servername: 'thomas.fr' }
|
- myapache
|
||||||
- { role: myapache, servername: 'sophie.fr' }
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
servername: cines.fr
|
servername: cines.fr
|
||||||
serveralias: www.cines.fr
|
serveralias: www.{{ servername }}
|
||||||
documentroot: /var/www/html/cines.fr
|
documentroot: /var/www/html/{{ servername }}
|
||||||
accesslog: /var/log/httpd/access_cines.fr_log
|
accesslog: /var/log/httpd/access_{{ servername }}_log
|
||||||
errorlog: /var/log/httpd/error_cines.fr_log
|
errorlog: /var/log/httpd/error_{{ servername }}_log
|
||||||
@@ -1,9 +1,20 @@
|
|||||||
---
|
---
|
||||||
# tasks file for myapache
|
# tasks file for myapache
|
||||||
|
- name: remove old conf file, if any
|
||||||
|
file:
|
||||||
|
path: /etc/httpd/conf.d/vhost.conf
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- name: remove old documentRoot, if any
|
||||||
|
file:
|
||||||
|
path: /var/www/html/orsys.fr
|
||||||
|
state: absent
|
||||||
|
|
||||||
- name: install apache
|
- name: install apache
|
||||||
yum:
|
yum:
|
||||||
name: httpd
|
name: httpd
|
||||||
state: latest
|
state: latest
|
||||||
|
|
||||||
- name: conf httpd
|
- name: conf httpd
|
||||||
notify: reload httpd
|
notify: reload httpd
|
||||||
template:
|
template:
|
||||||
@@ -33,7 +44,7 @@
|
|||||||
state: directory
|
state: directory
|
||||||
|
|
||||||
- name: create index file
|
- name: create index file
|
||||||
copy:
|
template:
|
||||||
src: index.html
|
src: index.html
|
||||||
dest: "{{ documentroot }}/index.html"
|
dest: "{{ documentroot }}/index.html"
|
||||||
mode: 0644
|
mode: 0644
|
||||||
1
17.1_variable/myapache/templates/index.html
Normal file
1
17.1_variable/myapache/templates/index.html
Normal file
@@ -0,0 +1 @@
|
|||||||
|
<h1>hello World this is {{ servername}}</h1>
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
<VirtualHost *:{{ http_port }}>
|
<VirtualHost *:{{ http_port }}>
|
||||||
ServerName {{ servername }}
|
ServerName {{ servername }}
|
||||||
ServerAlias {{ serveralias }}
|
ServerAlias {{ serveralias }}
|
||||||
|
ServerAlias {{ inventory_hostname }}
|
||||||
DocumentRoot {{ documentroot }}
|
DocumentRoot {{ documentroot }}
|
||||||
CustomLog {{ accesslog }} combined
|
CustomLog {{ accesslog }} combined
|
||||||
ErrorLog {{ errorlog }}
|
ErrorLog {{ errorlog }}
|
||||||
|
|||||||
Reference in New Issue
Block a user