self-hosting/roles/deux_puissance_x/tasks/apache2.yml
2024-04-09 20:21:59 +02:00

39 lines
1,000 B
YAML

---
- name: Create 2px directory
become: true
ansible.builtin.file:
path: "/var/www/{{ deux_puissance_x_domain }}"
owner: "{{ deux_puissance_x_apache2_owner }}"
group: "{{ deux_puissance_x_apache2_group }}"
state: directory
mode: 0775
- name: Install mod_wsgi
become: true
ansible.builtin.apt:
name: libapache2-mod-wsgi-py3
state: present
notify: Reload apache2 service
- name: Enable wsgi module
become: true
community.general.apache2_module:
name: wsgi
state: present
notify: Reload apache2 service
- name: Copy vHost conf
become: true
ansible.builtin.template:
src: apache2/vhost.conf.j2
dest: "/etc/apache2/sites-available/{{ deux_puissance_x_domain }}.conf"
mode: 0644
notify: Reload apache2 service
- name: Activate vHost
become: true
ansible.builtin.command: "a2ensite {{ deux_puissance_x_domain }}.conf"
register: result
changed_when: "'already enabled' not in result.stdout"
notify: Reload apache2 service