amelioration atelier
This commit is contained in:
14
Readme.md
14
Readme.md
@@ -1,13 +1,11 @@
|
|||||||
Les handlers
|
## Les handlers
|
||||||
-----
|
|
||||||
|
|
||||||
*Tâche*: Relancer un service uniquement en cas de modification de la conf
|
**Tâche**: Relancer un service uniquement en cas de modification de la configuration
|
||||||
|
|
||||||
*Condition*: déploiement d'un serveur apache
|
**Condition**: déploiement d'un service
|
||||||
|
|
||||||
*Norme*: handler
|
**Norme**: handler
|
||||||
|
|
||||||
*Pratique*: Modifier le playbook précédent
|
**Pratique**: Modifiez le playbook apache.yml afin que le déploiement d'une nouvelle version du fichier vhost.conf entraîne un redémarrage du service apache.
|
||||||
afin que le déploiement d'une nouvelle version du fichier vhost.conf
|
|
||||||
|
|
||||||
entraîne un redémarrage du service apache.
|
Attention, il vous faudra rajouter la directive *hosts* dans le playbook.
|
||||||
|
|||||||
11
apache.yml
11
apache.yml
@@ -1,20 +1,13 @@
|
|||||||
---
|
---
|
||||||
- name: install apache via ansible playbook
|
- name: install apache via ansible playbook
|
||||||
hosts: test
|
gather_facts: false
|
||||||
handlers:
|
|
||||||
- name: reload httpd
|
|
||||||
service:
|
|
||||||
name: httpd
|
|
||||||
state: restarted
|
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- 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
|
|
||||||
template:
|
template:
|
||||||
src: vhost.conf
|
src: vhost.conf
|
||||||
dest: /etc/httpd/conf.d/vhost.conf
|
dest: /etc/httpd/conf.d/vhost.conf
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
test
|
<span style="text-align: center;background-color: #FD5401; font-size: 42px;">Hello World</span>
|
||||||
|
|||||||
13
vhost.conf
13
vhost.conf
@@ -1,11 +1,10 @@
|
|||||||
<VirtualHost *:80>
|
<VirtualHost *:80>
|
||||||
ServerName orsys.fr
|
ServerName orsys.fr
|
||||||
ServerAlias www.orsys.fr
|
ServerAlias www.orsys.fr
|
||||||
ServerAlias 100.0.0.100
|
DocumentRoot /var/www/html/orsys.fr/
|
||||||
DocumentRoot /var/www/html/orsys.fr/
|
CustomLog /var/log/httpd/orsys.fr_access.log combined
|
||||||
CustomLog /var/log/httpd/orsys.fr_access.log combined
|
ErrorLog /var/log/httpd/orsys.fr_error.log
|
||||||
ErrorLog /var/log/httpd/orsys.fr_error.log
|
<Directory />
|
||||||
<Directory />
|
|
||||||
Options none
|
Options none
|
||||||
Allowoverride none
|
Allowoverride none
|
||||||
Require all denied
|
Require all denied
|
||||||
|
|||||||
Reference in New Issue
Block a user