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
|
||||
afin que le déploiement d'une nouvelle version du fichier vhost.conf
|
||||
**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.
|
||||
|
||||
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
|
||||
hosts: test
|
||||
handlers:
|
||||
- name: reload httpd
|
||||
service:
|
||||
name: httpd
|
||||
state: restarted
|
||||
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: install apache
|
||||
yum:
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
|
||||
- name: conf httpd
|
||||
notify: reload httpd
|
||||
template:
|
||||
src: 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>
|
||||
ServerName orsys.fr
|
||||
ServerAlias www.orsys.fr
|
||||
ServerAlias 100.0.0.100
|
||||
DocumentRoot /var/www/html/orsys.fr/
|
||||
CustomLog /var/log/httpd/orsys.fr_access.log combined
|
||||
ErrorLog /var/log/httpd/orsys.fr_error.log
|
||||
<Directory />
|
||||
ServerName orsys.fr
|
||||
ServerAlias www.orsys.fr
|
||||
DocumentRoot /var/www/html/orsys.fr/
|
||||
CustomLog /var/log/httpd/orsys.fr_access.log combined
|
||||
ErrorLog /var/log/httpd/orsys.fr_error.log
|
||||
<Directory />
|
||||
Options none
|
||||
Allowoverride none
|
||||
Require all denied
|
||||
|
||||
Reference in New Issue
Block a user