60 lines
1.1 KiB
YAML
60 lines
1.1 KiB
YAML
---
|
|
- name: install apache via ansible playbook
|
|
hosts: amue-sib-centos-01.formation.actilis.fr
|
|
|
|
pre_tasks:
|
|
- name: get ressources
|
|
get_url:
|
|
url: "{{ item }}"
|
|
dest: /tmp
|
|
loop:
|
|
- https://cours.opendoor.fr/Fichiers/SIB/index.txt
|
|
- https://cours.opendoor.fr/Fichiers/SIB/vhost.conf
|
|
delegate_to: localhost
|
|
|
|
post_tasks:
|
|
- name: cleanup
|
|
file:
|
|
path: "{{ item }}"
|
|
state: absent
|
|
loop:
|
|
- /tmp/index.txt
|
|
- /tmp/vhost.conf
|
|
|
|
tasks:
|
|
- name: install apache
|
|
yum:
|
|
name: httpd
|
|
state: present
|
|
|
|
- name: conf httpd
|
|
template:
|
|
src: /tmp/vhost.conf
|
|
dest: /etc/httpd/conf.d/vhost.conf
|
|
mode: 0640
|
|
owner: root
|
|
group: apache
|
|
|
|
- name: activate apache
|
|
service:
|
|
name: httpd
|
|
enabled: yes
|
|
state: started
|
|
|
|
- name: open firewall port
|
|
firewalld:
|
|
service: http
|
|
permanent: yes
|
|
immediate: yes
|
|
state: enabled
|
|
|
|
- name: create documentroot
|
|
file:
|
|
name: /var/www/html/orsys.fr
|
|
state: directory
|
|
|
|
- name: copy index file
|
|
copy:
|
|
src: /tmp/index.txt
|
|
dest: /var/www/html/orsys.fr/index.html
|
|
mode: 0644 |