Files
sib_20_conditions/apache.yml
2022-11-14 16:39:33 +01:00

72 lines
1.3 KiB
YAML

---
- name: install apache via ansible playbook
hosts: centos
handlers:
- name: restart apache
service:
name: httpd
state: restarted
tasks:
- name: install apache
yum:
name: httpd
state: latest
- name: conf httpd
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
service:
name: httpd
enabled: yes
state: started
- name: open firewall port
firewalld:
service: http
permanent: yes
immediate: yes
state: enabled
ignore_errors: yes
- name: create documentroot
file:
name: /var/www/html/example.org
state: directory
- name: create index file
copy:
src: index.txt
dest: /var/www/html/example.org/index.html
mode: 0644
- name: install php
block:
- name: php install
package:
name: php-fpm
state: present
- name: php service
service:
name: php-fpm
state: started
enabled: true
- name: php config
copy:
src: php-fpm.conf
dest: /etc/httpd/conf.d/
notify: restart apache
when: apache_use_php| default( false )