mirror of
https://github.com/iiab/iiab.git
synced 2025-02-13 19:52:06 +00:00
120 lines
3.4 KiB
YAML
120 lines
3.4 KiB
YAML
- name: Get python dateutil
|
|
package:
|
|
name: '{{ item }}'
|
|
state: present
|
|
when: py_captive_portal_install
|
|
with_items:
|
|
- python-dateutil
|
|
- sqlite3
|
|
|
|
- name: Create directory for Captive Portal script
|
|
file:
|
|
path: /opt/iiab/captive-portal
|
|
state: directory
|
|
when: py_captive_portal_install
|
|
|
|
- name: Copy Captive Portal script
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: /opt/iiab/captive-portal/
|
|
mode: "{{ item.mode }}"
|
|
with_items:
|
|
- { src: roles/network/templates/captive-portal/checkurls, mode: '0644' }
|
|
- { src: roles/network/templates/captive-portal/capture-wsgi.py, mode: '0755' }
|
|
when: py_captive_portal_install
|
|
|
|
- name: Copy the jinja2 template to captive portal
|
|
copy:
|
|
src: roles/network/files/simple.template
|
|
dest: /opt/iiab/captive-portal/
|
|
|
|
- name: Copy the jinja2 template to captive portal
|
|
copy:
|
|
src: roles/network/files/mac.template
|
|
dest: /opt/iiab/captive-portal/
|
|
|
|
- name: Copy Captive Portal scripts
|
|
template:
|
|
src: "{{ item.src }}"
|
|
dest: /usr/bin/
|
|
owner: root
|
|
group: root
|
|
mode: 0755
|
|
with_items:
|
|
- src: roles/network/templates/captive-portal/iiab-catch
|
|
- src: roles/network/templates/captive-portal/iiab-uncatch
|
|
when: py_captive_portal_install
|
|
|
|
- name: Generate the diversion lists for dnsmasq and apache2
|
|
shell: /usr/bin/iiab-uncatch
|
|
when: py_captive_portal_install
|
|
|
|
- name: Copy Captive Portal service file
|
|
template:
|
|
src: roles/network/templates/captive-portal/captive-portal.service.j2
|
|
dest: /etc/systemd/system/captive-portal.service
|
|
owner: root
|
|
group: root
|
|
mode: 0644
|
|
when: py_captive_portal_install
|
|
|
|
- name: Copy Captive Portal Apache config file
|
|
template:
|
|
src: roles/network/templates/captive-portal/captive-portal.conf
|
|
dest: /etc/{{ apache_config_dir }}/captive-portal.conf
|
|
owner: root
|
|
group: root
|
|
mode: 0740
|
|
when: py_captive_portal_install and py_captive_portal_enabled
|
|
|
|
- name: Enable captive-portal after copying files
|
|
systemd:
|
|
name: captive-portal.service
|
|
enabled: yes
|
|
daemon-reload: yes
|
|
when: py_captive_portal_install and py_captive_portal_enabled
|
|
|
|
- name: Enable Apache config file
|
|
file:
|
|
src: /etc/apache2/sites-available/captive-portal.conf
|
|
dest: /etc/apache2/sites-enabled/captive-portal.conf
|
|
state: link
|
|
when: py_captive_portal_enabled and is_debuntu
|
|
|
|
- name: Enable Apache ssl config file
|
|
file:
|
|
src: /etc/apache2/sites-available/default-ssl.conf
|
|
dest: /etc/apache2/sites-enabled/default-ssl.conf
|
|
state: link
|
|
when: py_captive_portal_enabled and is_debuntu
|
|
|
|
- name: Start captive-portal after copying files
|
|
systemd:
|
|
name: captive-portal.service
|
|
state: started
|
|
when: py_captive_portal_install and py_captive_portal_enabled
|
|
|
|
- name: Disable captive-portal after copying files
|
|
systemd:
|
|
name: captive-portal.service
|
|
enabled: no
|
|
daemon-reload: yes
|
|
when: py_captive_portal_install and not py_captive_portal_enabled
|
|
|
|
- name: Stop captive-portal after copying files
|
|
service:
|
|
name: captive-portal.service
|
|
state: stopped
|
|
when: py_captive_portal_install and not py_captive_portal_enabled
|
|
|
|
- name: Disable Apache config file
|
|
file:
|
|
dest: /etc/apache2/sites-enabled/captive-portal.conf
|
|
state: absent
|
|
when: not py_captive_portal_enabled and is_debuntu
|
|
|
|
- name: Make sure dnsmasq is not diverting if captive-portal disabled
|
|
file:
|
|
dest: /etc/dnsmasq.d/capture
|
|
state: absent
|
|
when: not py_captive_portal_enabled
|