Files
sib_10_premier_playbook/apache.yml

53 lines
1.1 KiB
YAML

---
- name: install apache via ansible playbook
hosts: centos
tasks:
- name: install apache
ansible.builtin.package:
name: httpd
state: present
- name: conf httpd
ansible.builtin.template:
src: 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: open firewall port
ansible.posix.firewalld:
service: "{{ item }}"
permanent: yes
immediate: yes
state: enabled
loop:
- http
- https
- name: create documentroot
ansible.builtin.file:
name: /var/www/html/example.org/
state: directory
- name: copy index file
ansible.builtin.template:
src: index.txt
dest: /var/www/html/example.org/index.html
mode: 0644