diff --git a/Readme.md b/Readme.md
new file mode 100644
index 0000000..036691e
--- /dev/null
+++ b/Readme.md
@@ -0,0 +1,16 @@
+## Les tags
+
+**Tâche**: Utiliser les tags pour n'exécuter qu'une sélection de tâches.
+
+**Condition**: Lors du développement d'un playbook, ou de l'utilisation d'un playbook volumineux.
+
+**Norme**: tags
+
+**Pratique**: Modifiez le playbook apache.yml afin de *tagguer* chaque tâche avec les étiquettes suivantes:
+
+ * firewall (uniquement la tâche d'ouverture du parefeu)
+ * apache (toutes les tâches)
+ * docroot (uniquement les 2 dernières tâches)
+
+
+Expérimentez en exécutant le playbook en utilisant les options --list-tasks et --tags ou --skip-tags
diff --git a/apache.yml b/apache.yml
index 050b169..90b14dc 100644
--- a/apache.yml
+++ b/apache.yml
@@ -16,13 +16,11 @@
tasks:
- name: install apache
- tags: httpd
- yum:
+ yum:
name: httpd
state: latest
- name: conf httpd
- tags: httpd
notify: reload httpd
template:
src: vhost.conf
@@ -32,13 +30,11 @@
group: apache
- name: activate apache
- tags: httpd
service:
name: httpd
enabled: yes
- name: open firewall port
- tags: [firewall,httpd]
firewalld:
service: http
permanent: yes
@@ -48,13 +44,11 @@
notify: reload firewalld
- name: create documentroot
- tags: httpd
file:
name: /var/www/html/orsys.fr
state: directory
- name: create index file
- tags: httpd
copy:
src: index.html
dest: /var/www/html/orsys.fr/index.html
diff --git a/apache_correction.yml b/apache_correction.yml
new file mode 100644
index 0000000..9df1298
--- /dev/null
+++ b/apache_correction.yml
@@ -0,0 +1,62 @@
+---
+- name: install apache via ansible playbook
+ hosts: test
+ user: ansible
+ become: true
+ handlers:
+ - name: reload httpd
+ service:
+ name: httpd
+ state: reloaded
+
+ - name: reload firewalld
+ service:
+ name: firewalld
+ state: reloaded
+
+ tags: apache
+ tasks:
+ - name: install apache
+ yum:
+ name: httpd
+ state: latest
+
+ - name: conf httpd
+ notify: reload httpd
+ template:
+ src: vhost.conf
+ dest: /etc/httpd/conf.d/vhost.conf
+ mode: 0640
+ owner: root
+ group: apache
+
+ - name: activate apache
+ service:
+ name: httpd
+ enabled: yes
+
+ - name: open firewall port
+ tags: firewall
+ firewalld:
+ service: http
+ permanent: yes
+ immediate: yes
+ state: enabled
+ ignore_errors: yes
+ notify: reload firewalld
+
+ - name: create documentroot
+ tags:
+ - docroot
+ file:
+ name: /var/www/html/orsys.fr
+ state: directory
+
+ - name: create index file
+ tags:
+ - docroot
+ copy:
+ src: index.html
+ dest: /var/www/html/orsys.fr/index.html
+ mode: 0644
+
diff --git a/index.html b/index.html
index 9daeafb..949801e 100644
--- a/index.html
+++ b/index.html
@@ -1 +1 @@
-test
+Hello World
diff --git a/vhost.conf b/vhost.conf
index b352f6d..0556a2c 100644
--- a/vhost.conf
+++ b/vhost.conf
@@ -1,11 +1,10 @@
- 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
-
+ 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
+
Options none
Allowoverride none
Require all denied