Files
sib_12_handlers/apache.yml
2025-09-23 10:20:19 +02:00

52 lines
1.0 KiB
YAML

---
- name: install apache via ansible playbook
hosts: centos
handlers:
- name: restart apache
service:
name: httpd
state: restarted
tasks:
- name: install apache
ansible.builtin.package:
name: httpd
state: latest
- name: conf httpd
ansible.builtin.template:
src: vhost.conf
dest: /etc/httpd/conf.d/vhost.conf
mode: 0640
owner: root
group: apache
notify: restart apache
- name: call handlers, if needed
ansible.builtin.meta: flush_handlers
- name: activate apache
ansible.builtin.service:
name: httpd
enabled: yes
state: started
- name: open firewall port
ansible.posix.firewalld:
service: http
permanent: yes
immediate: yes
state: enabled
ignore_errors: yes
- name: create documentroot
ansible.builtin.file:
name: /var/www/html/example.org
state: directory
- name: create index file
ansible.builtin.copy:
src: index.txt
dest: /var/www/html/example.org/index.html
mode: 0644