Files
sib_10_premier_playbook/apache.yml

74 lines
1.6 KiB
YAML

---
- name: install apache via ansible playbook
hosts: centos
tasks:
- name: retrieve ansible.builtin.files
ansible.builtin.git:
repo: https://infra.opendoor.fr/git/tom/sib_10_premier_playbook
dest: /tmp/sib_10
delegate_to: localhost
become: false
- name: install apache
ansible.builtin.package:
name: httpd
state: present
- name: conf httpd
ansible.builtin.template:
src: /tmp/sib_10/vhost.conf
dest: /etc/httpd/conf.d/vhost.conf
mode: 0640
owner: root
group: apache
- name: activate apache
ansible.builtin.service:
name: httpd
enabled: yes
state: started
- name: setup firewall
block:
- name: install firewalld packages
ansible.builtin.package:
name:
- python3-firewall
- firewalld
state: present
- name: enable firewalld service
ansible.builtin.service:
name: firewalld
enabled: true
state: started
- name: open firewall port
ansible.posix.firewalld:
service: "{{ item }}"
permanent: yes
immediate: yes
state: enabled
loop:
- http
- https
ignore_errors: true
- name: create documentroot
ansible.builtin.file:
name: /var/www/html/example.org/
state: directory
- name: copy index ansible.builtin.file
ansible.builtin.template:
src: /tmp/sib_10/index.txt
dest: /var/www/html/example.org/index.html
mode: 0644
- name: delete temp ansible.builtin.files
ansible.builtin.file:
path: /tmp/sib_10
state: absent
delegate_to: localhost
become: false