From 61df4cf63887d22ae2c5525e827439a3a5b74fe9 Mon Sep 17 00:00:00 2001 From: raphanaud Date: Wed, 13 Oct 2021 11:55:05 +0200 Subject: [PATCH] 45-ansible/ --- sio2/sisr/45-ansible/testansible/hosts | 6 +++ sio2/sisr/45-ansible/tpansible/hosts | 6 +++ sio2/sisr/45-ansible/tpansible/index.html | 1 + sio2/sisr/45-ansible/tpansible/syslog-cli.yml | 29 +++++++++++++++ sio2/sisr/45-ansible/tpansible/syslog.yml | 37 +++++++++++++++++++ sio2/sisr/45-ansible/tpansible/web.yml | 18 +++++++++ 6 files changed, 97 insertions(+) create mode 100644 sio2/sisr/45-ansible/testansible/hosts create mode 100644 sio2/sisr/45-ansible/tpansible/hosts create mode 100644 sio2/sisr/45-ansible/tpansible/index.html create mode 100644 sio2/sisr/45-ansible/tpansible/syslog-cli.yml create mode 100644 sio2/sisr/45-ansible/tpansible/syslog.yml create mode 100644 sio2/sisr/45-ansible/tpansible/web.yml diff --git a/sio2/sisr/45-ansible/testansible/hosts b/sio2/sisr/45-ansible/testansible/hosts new file mode 100644 index 0000000..28c495b --- /dev/null +++ b/sio2/sisr/45-ansible/testansible/hosts @@ -0,0 +1,6 @@ +[adm] +infra + +[web] +web1 +web2 diff --git a/sio2/sisr/45-ansible/tpansible/hosts b/sio2/sisr/45-ansible/tpansible/hosts new file mode 100644 index 0000000..28c495b --- /dev/null +++ b/sio2/sisr/45-ansible/tpansible/hosts @@ -0,0 +1,6 @@ +[adm] +infra + +[web] +web1 +web2 diff --git a/sio2/sisr/45-ansible/tpansible/index.html b/sio2/sisr/45-ansible/tpansible/index.html new file mode 100644 index 0000000..3ef2bb5 --- /dev/null +++ b/sio2/sisr/45-ansible/tpansible/index.html @@ -0,0 +1 @@ +Salut diff --git a/sio2/sisr/45-ansible/tpansible/syslog-cli.yml b/sio2/sisr/45-ansible/tpansible/syslog-cli.yml new file mode 100644 index 0000000..95ce0a3 --- /dev/null +++ b/sio2/sisr/45-ansible/tpansible/syslog-cli.yml @@ -0,0 +1,29 @@ +- hosts: web + tasks: + + - name: decommente le chargement du module imudp dans rsyslog.conf + replace: + path: /etc/systemd/journald.conf + regexp: '^#ForwardToSyslog=yes' + replace: 'ForwardToSyslog=yes' + notify: + - restart journald + + - name: Ajoute l'indication de serveur syslog distant si elle n'est pas presente + lineinfile: + path: /etc/rsyslog.conf + line: '*.* @192.168.0.23:514' + create: yes + notify: + - restart rsyslog + + handlers: + - name: restart journald + service: + name: systemd-journald.service + state: restarted + + - name: restart syslog + service: + name: rsyslog + state: restarted diff --git a/sio2/sisr/45-ansible/tpansible/syslog.yml b/sio2/sisr/45-ansible/tpansible/syslog.yml new file mode 100644 index 0000000..f2791d8 --- /dev/null +++ b/sio2/sisr/45-ansible/tpansible/syslog.yml @@ -0,0 +1,37 @@ +- hosts: adm + tasks: + + - name: decommente le chargement du module imudp dans rsyslog.conf + replace: + path: /etc/rsyslog.conf + regexp: '^#module\(load="imudp"\)' + replace: 'module(load="imudp")' + notify: + - restart rsyslog + + - name: decommente le chargement du module imudp dans rsyslog.conf + replace: + path: /etc/rsyslog.conf + regexp: '^#input\(type="imudp" port="514"\)' + replace: 'input(type="imudp" port="514")' + notify: + - restart rsyslog + + - name: decommente le chargement du module imudp dans rsyslog.conf + replace: + path: /etc/systemd/journald.conf + regexp: '^#ForwardToSyslog=yes' + replace: 'ForwardToSyslog=yes' + notify: + - restart journald + + handlers: + - name: restart rsyslog + service: + name: rsyslog + state: restarted + + - name: restart journald + service: + name: systemd-journald.service + state: restarted diff --git a/sio2/sisr/45-ansible/tpansible/web.yml b/sio2/sisr/45-ansible/tpansible/web.yml new file mode 100644 index 0000000..87d9e2e --- /dev/null +++ b/sio2/sisr/45-ansible/tpansible/web.yml @@ -0,0 +1,18 @@ +- hosts: web + tasks: + - name: Installation apache2 + apt: + name: apache2 + state: present + - name: Installation php + apt: + name: php + state: present + - name: Installation php-mbstring + apt: + name: php-mbstring + state: present + - name: Copie index.html + copy: + src: index.html + dest: /var/www/html/