Exercice: commit initial
This commit is contained in:
50
17.3_variable/myapache3/tasks/main.yml
Normal file
50
17.3_variable/myapache3/tasks/main.yml
Normal file
@@ -0,0 +1,50 @@
|
||||
---
|
||||
# tasks file for myapache
|
||||
- name: install apache
|
||||
tags: httpd
|
||||
yum:
|
||||
name: httpd
|
||||
state: latest
|
||||
- name: conf httpd
|
||||
tags: httpd
|
||||
notify: reload httpd
|
||||
template:
|
||||
src: vhost.conf.jj
|
||||
dest: /etc/httpd/conf.d/vhost.conf
|
||||
mode: 0640
|
||||
owner: root
|
||||
group: apache
|
||||
|
||||
- name: activate apache
|
||||
tags: httpd
|
||||
service:
|
||||
name: httpd
|
||||
enabled: yes
|
||||
state: restarted
|
||||
|
||||
- name: open firewall port
|
||||
tags: httpd
|
||||
firewalld:
|
||||
service: http
|
||||
permanent: yes
|
||||
immediate: yes
|
||||
state: enabled
|
||||
ignore_errors: yes
|
||||
notify: reload firewalld
|
||||
|
||||
- name: create documentroot
|
||||
tags: httpd
|
||||
file:
|
||||
name: "/var/www/html/{{ item.documentroot }}"
|
||||
state: directory
|
||||
with_items:
|
||||
- "{{ apache_vhosts }}"
|
||||
|
||||
- name: create index file
|
||||
tags: httpd
|
||||
copy:
|
||||
src: index.html
|
||||
dest: "/var/www/html/{{ item.documentroot }}/index.html"
|
||||
mode: 0644
|
||||
with_items:
|
||||
- "{{ apache_vhosts }}"
|
||||
Reference in New Issue
Block a user