diff --git a/17.1_variable/apache.yml b/17.1_variable/apache.yml index 054e9d0..209d447 100644 --- a/17.1_variable/apache.yml +++ b/17.1_variable/apache.yml @@ -1,6 +1,6 @@ --- - name: install apache via ansible playbook - hosts: test + hosts: centos user: ansible become: true roles: diff --git a/17.1_variable/myapache/README.md b/17.1_variable/myapache/README.md index f6a79dd..add3500 100644 --- a/17.1_variable/myapache/README.md +++ b/17.1_variable/myapache/README.md @@ -19,11 +19,11 @@ http_port: 80 Hosts Variables: --------------- -apache_servername: orsys.fr -apache_serveralias: "www.orsys.fr" -apache_documentroot: /var/www/html/orsys.fr -apache_accesslog: /var/log/httpd/access_orsys.fr_log -apache_errorlog: /var/log/httpd/error_orsys.fr_log +apache_servername: no default +apache_serveralias: no default +apache_documentroot: /var/www/html/{{ apache_servername }} +apache_accesslog: /var/log/httpd/access_{{ apache_servername }}_log +apache_errorlog: /var/log/httpd/error_{{ apache_servername }}_log Dependencies ------------ diff --git a/17.1_variable/myapache/defaults/main.yml b/17.1_variable/myapache/defaults/main.yml index 23578c8..86179ae 100644 --- a/17.1_variable/myapache/defaults/main.yml +++ b/17.1_variable/myapache/defaults/main.yml @@ -1,3 +1,6 @@ --- # defaults file for myapache -http_port: 80 \ No newline at end of file +http_port: 80 +apache_documentroot: "/var/www/html/{{ apache_servername }}" +apache_accesslog: "/var/log/httpd/access_{{ apache_servername }}_log" +apache_errorlog: "/var/log/httpd/error_{{ apache_servername }}_log" diff --git a/17.1_variable/myapache/tasks/main.yml b/17.1_variable/myapache/tasks/main.yml index 535a553..ba22c34 100644 --- a/17.1_variable/myapache/tasks/main.yml +++ b/17.1_variable/myapache/tasks/main.yml @@ -19,7 +19,7 @@ notify: reload httpd template: src: vhost.conf.jj - dest: /etc/httpd/conf.d/vhost_{{ apache_servername }}.conf + dest: "/etc/httpd/conf.d/vhost_{{ apache_servername }}.conf" mode: 0640 owner: root group: apache