initial commit
This commit is contained in:
63
apache.yml
Normal file
63
apache.yml
Normal file
@@ -0,0 +1,63 @@
|
||||
---
|
||||
- name: install apache via ansible playbook
|
||||
hosts: centos
|
||||
|
||||
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
|
||||
become: false
|
||||
|
||||
post_tasks:
|
||||
- name: cleanup
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: absent
|
||||
loop:
|
||||
- /tmp/index.txt
|
||||
- /tmp/vhost.conf
|
||||
become: false
|
||||
delegate_to: localhost
|
||||
|
||||
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/{{ ansible_hostname }}
|
||||
state: directory
|
||||
|
||||
- name: copy index file
|
||||
template:
|
||||
src: /tmp/index.txt
|
||||
dest: /var/www/html/{{ ansible_hostname }}/index.html
|
||||
mode: 0644
|
||||
Reference in New Issue
Block a user