diff --git a/17.1_variable/apache.yml b/17.1_variable/apache.yml index c6ef875..054e9d0 100644 --- a/17.1_variable/apache.yml +++ b/17.1_variable/apache.yml @@ -4,5 +4,4 @@ user: ansible become: true roles: - - { role: myapache, servername: 'thomas.fr' } - - { role: myapache, servername: 'sophie.fr' } + - myapache diff --git a/17.1_variable/host_vars/cible1 b/17.1_variable/host_vars/cible1 index 59520e5..80b2caa 100644 --- a/17.1_variable/host_vars/cible1 +++ b/17.1_variable/host_vars/cible1 @@ -1,5 +1,5 @@ servername: cines.fr -serveralias: www.cines.fr -documentroot: /var/www/html/cines.fr -accesslog: /var/log/httpd/access_cines.fr_log -errorlog: /var/log/httpd/error_cines.fr_log \ No newline at end of file +serveralias: www.{{ servername }} +documentroot: /var/www/html/{{ servername }} +accesslog: /var/log/httpd/access_{{ servername }}_log +errorlog: /var/log/httpd/error_{{ servername }}_log \ No newline at end of file diff --git a/17.1_variable/myapache/tasks/main.yml b/17.1_variable/myapache/tasks/main.yml index 1c7c3ec..83c9a22 100644 --- a/17.1_variable/myapache/tasks/main.yml +++ b/17.1_variable/myapache/tasks/main.yml @@ -1,9 +1,20 @@ --- # 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 yum: name: httpd state: latest + - name: conf httpd notify: reload httpd template: @@ -33,7 +44,7 @@ state: directory - name: create index file - copy: + template: src: index.html dest: "{{ documentroot }}/index.html" mode: 0644 \ No newline at end of file diff --git a/17.1_variable/myapache/templates/index.html b/17.1_variable/myapache/templates/index.html new file mode 100644 index 0000000..14125e9 --- /dev/null +++ b/17.1_variable/myapache/templates/index.html @@ -0,0 +1 @@ +