2
0
Files
SIB_Exercices/12_handlers/apache.yml

54 lines
1023 B
YAML

---
- name: install apache via ansible playbook
hosts: test
user: formation
become: true
handlers:
- name: reload httpd
service:
name: httpd
state: restarted
- name: reload firewalld
service:
name: firewalld
state: reloaded
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
firewalld:
service: http
permanent: yes
immediate: yes
state: enabled
ignore_errors: yes
notify: reload firewalld
- name: create documentroot
file:
name: /var/www/html/orsys.fr
state: directory
- name: create index file
copy:
src: index.html
dest: /var/www/html/orsys.fr/index.html
mode: 0644