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/