Compare commits

7 Commits

Author SHA1 Message Date
0f231ee7cf flush 2022-11-14 13:59:49 +01:00
b9f189bcfb typo 2022-11-14 13:51:53 +01:00
823ddf1ae2 ajout index.txt 2021-11-15 16:56:55 +01:00
5cfbe08e66 typoe 2021-06-08 16:22:46 +02:00
19ca29be0b typo 2021-05-11 09:46:00 +02:00
2dd9eb923a rajout apache.yml 2021-03-16 21:54:21 +01:00
20b3b4caa1 solution 2021-03-16 21:52:03 +01:00
5 changed files with 21 additions and 17 deletions

View File

@@ -8,4 +8,6 @@
**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.
Solution: voir branche "solution"
Pratique bis: utiliser le module _ansible.builtin.meta_ afin de forcer l'exécution du handler (si besoin) juste après la tâche "conf httpd"

View File

@@ -1,11 +1,12 @@
---
- name: install apache via ansible playbook
gather_facts: false
hosts: centos
tasks:
- name: install apache
yum:
name: httpd
state: latest
state: present
- name: conf httpd
template:
@@ -19,6 +20,7 @@
service:
name: httpd
enabled: yes
state: started
- name: open firewall port
firewalld:
@@ -26,15 +28,15 @@
permanent: yes
immediate: yes
state: enabled
ignore_errors: yes
ignore_errors: true
- name: create documentroot
file:
name: /var/www/html/orsys.fr
name: /var/www/html/example.org/
state: directory
- name: create index file
copy:
src: index.html
dest: /var/www/html/orsys.fr/index.html
mode: 0644
- name: copy index file
template:
src: index.txt
dest: /var/www/html/example.org/index.html
mode: 0644

View File

@@ -1 +0,0 @@
<span style="text-align: center;background-color: #FD5401; font-size: 42px;">Hello World</span>

1
index.txt Normal file
View File

@@ -0,0 +1 @@
<h1>hello World</h1>

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>