Compare commits

9 Commits

Author SHA1 Message Date
df32926ad2 fqcn'd 2025-09-23 10:20:19 +02:00
f5669f671d flush 2022-11-14 14:01:12 +01:00
07eb50aeea typo 2022-11-14 13:52:44 +01:00
d8f1b79189 typo 2022-07-01 09:04:48 +02:00
da43eabcbe typo 2021-05-11 09:46:37 +02:00
312335742f Merge branch 'solution' of ssh://infra.opendoor.fr:2222/srv/git/repos/tom/sib_12_handlers into solution 2021-04-20 10:02:13 +02:00
072a555f21 solution 2021-04-20 09:59:18 +02:00
33c48d2b74 solution 2021-04-20 09:57:12 +02:00
d3dd99b100 solution 2021-03-16 21:51:14 +01:00
4 changed files with 27 additions and 27 deletions

View File

@@ -1,11 +0,0 @@
## Les handlers
**Tâche**: Relancer un service uniquement en cas de modification de la configuration
**Condition**: déploiement d'un service
**Norme**: handler
**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.
Attention, il vous faudra rajouter la directive *hosts* dans le playbook.

View File

@@ -1,27 +1,38 @@
---
- name: install apache via ansible playbook
gather_facts: false
hosts: centos
handlers:
- name: restart apache
service:
name: httpd
state: restarted
tasks:
- name: install apache
yum:
ansible.builtin.package:
name: httpd
state: latest
- name: conf httpd
template:
ansible.builtin.template:
src: vhost.conf
dest: /etc/httpd/conf.d/vhost.conf
mode: 0640
owner: root
group: apache
notify: restart apache
- name: call handlers, if needed
ansible.builtin.meta: flush_handlers
- name: activate apache
service:
ansible.builtin.service:
name: httpd
enabled: yes
state: started
- name: open firewall port
firewalld:
ansible.posix.firewalld:
service: http
permanent: yes
immediate: yes
@@ -29,12 +40,12 @@
ignore_errors: yes
- name: create documentroot
file:
name: /var/www/html/orsys.fr
ansible.builtin.file:
name: /var/www/html/example.org
state: directory
- name: create index file
copy:
src: index.html
dest: /var/www/html/orsys.fr/index.html
ansible.builtin.copy:
src: index.txt
dest: /var/www/html/example.org/index.html
mode: 0644

View File

@@ -1,16 +1,16 @@
<VirtualHost *:80>
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
ServerName example.org
ServerAlias www.example.org
DocumentRoot /var/www/html/example.org/
CustomLog /var/log/httpd/example.org_access.log combined
ErrorLog /var/log/httpd/example.org_error.log
<Directory />
Options none
Allowoverride none
Require all denied
</Directory>
<Directory /var/www/html/orsys.fr>
<Directory /var/www/html/example.org>
Require all granted
</Directory>
</VirtualHost>