mirror of
https://github.com/Aviortheking/Blog_IMIE.git
synced 2025-04-23 11:22:12 +00:00
66 lines
1.3 KiB
YAML
66 lines
1.3 KiB
YAML
---
|
|
- hosts: hifive
|
|
become: yes
|
|
become_user: root
|
|
vars:
|
|
http_port: 80
|
|
domain: example.com
|
|
tasks:
|
|
- name: Install apache2
|
|
apt:
|
|
pkg:
|
|
- apache2
|
|
- python-passlib
|
|
state: present
|
|
|
|
- name: Permissions apache2
|
|
file:
|
|
path: /etc/apache2
|
|
owner: www-data
|
|
group: www-data
|
|
recurse: yes
|
|
|
|
- name: Permissions www
|
|
file:
|
|
path: /var/www
|
|
owner: www-data
|
|
group: www-data
|
|
recurse: yes
|
|
|
|
- name: Start service httpd, if not started
|
|
service:
|
|
name: apache2
|
|
state: started
|
|
|
|
- name: Enable service apache2, and not touch the state
|
|
service:
|
|
name: apache2
|
|
enabled: yes
|
|
|
|
- name: Enable mod_rewrite
|
|
apache2_module:
|
|
name: rewrite
|
|
state: present
|
|
|
|
- htpasswd:
|
|
path: /etc/apache2/.htpasswd
|
|
name: hifive
|
|
password: hifive
|
|
owner: root
|
|
group: www-data
|
|
mode: 0640
|
|
|
|
- name: Create virtual host file
|
|
template:
|
|
src: virtualhost.j2
|
|
dest: /etc/apache2/sites-available/{{ domain }}.conf
|
|
force: yes
|
|
|
|
- name: a2ensite {{ domain }}
|
|
command: a2ensite {{ domain }}
|
|
|
|
- name: Reload service apache2
|
|
service:
|
|
name: apache2
|
|
state: reloaded
|