Files
sib_17.0_variables/ansible_apache_formation/tasks/apache.yml

60 lines
1.2 KiB
YAML

---
- name: import OS variables
include_vars: "{{ ansible_distribution |lower }}{{ ansible_distribution_major_version }}.yml"
- name: installation
package:
name: "{{ apache_package_name }}"
state: present
- name: configuration
notify: reload httpd
template:
src: vhost.conf
dest: "{{ apache_config_dir }}/vhost.conf"
mode: 0640
owner: root
group: "{{ apache_group_name }}"
- name: enable service
service:
name: "{{ apache_service_name }}"
enabled: yes
- name: open firewall port
firewalld:
service: http
permanent: yes
immediate: yes
state: enabled
ignore_errors: yes
- name: create documentroot
file:
name: "/var/www/{{ apache_server_name }}"
state: directory
- name: create index file
template:
src: index.html
dest: "/var/www/{{ apache_server_name }}/index.html"
mode: 0644
- name: install python passlib package
package:
name: "{{ python_passlib_package }}"
state: present
- name: passwd file
htpasswd:
path: "{{ apache_config_dir }}/passwd"
name: tom
password: "123Soleil"
mode: 0640
owner: root
group: "{{ apache_group_name }}"
- name: start service
service:
name: "{{ apache_service_name }}"
state: started