initial commit

This commit is contained in:
2020-09-22 15:42:05 +02:00
commit c4efc2c331
17 changed files with 290 additions and 0 deletions

58
myapache4/tasks/main.yml Normal file
View File

@@ -0,0 +1,58 @@
---
# tasks file for myapache
- name: import distribution specific variables
include_vars: "{{ ansible_distribution|lower }}.yml"
- name: install apache
tags: httpd
package:
name: "{{ package_name }}"
state: latest
- name: conf httpd
tags: httpd
notify: reload httpd
template:
src: vhost.conf.jj
dest: "{{ apache_conf_dir }}/vhost.conf"
mode: 0640
owner: root
group: "{{ apache_group }}"
- name: activate apache
tags: httpd
service:
name: "{{ service_name }}"
enabled: yes
- name: open firewall port
tags: httpd
firewalld:
service: http
permanent: yes
immediate: yes
state: enabled
ignore_errors: yes
notify: reload firewalld
when: ansible_distribution|lower != "debian"
- name: create documentroot
tags: httpd
file:
name: "{{ item.documentroot }}"
state: directory
with_items:
- "{{ apache_vhosts }}"
- name: create index file
tags: httpd
copy:
src: index.html
dest: "{{ item.documentroot }}/index.html"
mode: 0644
with_items:
- "{{ apache_vhosts }}"
- name: include php stuff
include_tasks: php.yml
when: use_php

20
myapache4/tasks/php.yml Normal file
View File

@@ -0,0 +1,20 @@
---
- name: install php-fpm
yum:
name: php-fpm
state: present
- name: start php-fpm
service:
name: php-fpm
state: started
enabled: true
- name: create info file
copy:
src: info.php
dest: "{{ item.documentroot }}/info.php"
mode: 0644
with_items:
- "{{ apache_vhosts }}"