2
0
Files
SIB_Exercices/17.1_variable/myapache/tasks/main.yml

50 lines
941 B
YAML

---
# tasks file for myapache
- name: remove old conf file, if any
file:
path: /etc/httpd/conf.d/vhost.conf
state: absent
- name: remove old documentRoot, if any
file:
path: /var/www/html/orsys.fr
state: absent
- name: install apache
yum:
name: httpd
state: latest
- name: conf httpd
notify: reload httpd
template:
src: vhost.conf.jj
dest: "/etc/httpd/conf.d/vhost_{{ apache_servername }}.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: "{{ apache_documentroot }}"
state: directory
- name: create index file
template:
src: index.html
dest: "{{ apache_documentroot }}/index.html"
mode: 0644