1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-03-09 15:40:17 +00:00

Update captive_portal.yml

This commit is contained in:
A Holt 2018-10-03 15:57:07 -04:00 committed by GitHub
parent d41abbbbc3
commit a6b0bceef8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,120 +1,107 @@
- name: Get python dateutil - name: Download & install python-dateutil, sqlite3
package: package:
name: '{{ item }}' name: "{{ item }}"
state: present state: present
when: py_captive_portal_install
with_items: with_items:
- python-dateutil - python-dateutil
- sqlite3 - sqlite3 # @georgehunt hopes to move this to 2-common (or more like stage 3-base-server, alongside MySQL) in October 2018
- name: Create directory for Captive Portal script - name: Create directory /opt/iiab/captive-portal for scripts & templates
file: file:
path: /opt/iiab/captive-portal path: /opt/iiab/captive-portal
state: directory state: directory
when: py_captive_portal_install
- name: Copy Captive Portal script - name: Copy scripts: checkurls, capture-wsgi.py
template: template:
src: "{{ item.src }}" src: "{{ item.src }}"
dest: /opt/iiab/captive-portal/ dest: /opt/iiab/captive-portal/
mode: "{{ item.mode }}" mode: "{{ item.mode }}"
with_items: with_items:
- { src: roles/network/templates/captive-portal/checkurls, mode: '0644' } - { src: roles/network/templates/captive-portal/checkurls, mode: '0644' }
- { src: roles/network/templates/captive-portal/capture-wsgi.py, mode: '0755' } - { src: roles/network/templates/captive-portal/capture-wsgi.py, mode: '0755' }
when: py_captive_portal_install
- name: Copy the jinja2 template to captive portal - name: Copy templates: simple.template, mac.template
copy: copy:
src: roles/network/files/simple.template src: "{{ item }}"
dest: /opt/iiab/captive-portal/ dest: /opt/iiab/captive-portal/
with_items:
- roles/network/files/simple.template
- roles/network/files/mac.template
- name: Copy the jinja2 template to captive portal - name: Copy iiab-catch & iiab-uncatch into /usr/bin/
copy:
src: roles/network/files/mac.template
dest: /opt/iiab/captive-portal/
- name: Copy Captive Portal scripts
template: template:
src: "{{ item.src }}" src: "{{ item }}"
dest: /usr/bin/ dest: /usr/bin/
owner: root owner: root
group: root group: root
mode: 0755 mode: 0755
with_items: with_items:
- src: roles/network/templates/captive-portal/iiab-catch - roles/network/templates/captive-portal/iiab-catch
- src: roles/network/templates/captive-portal/iiab-uncatch - roles/network/templates/captive-portal/iiab-uncatch
when: py_captive_portal_install
- name: Generate the diversion lists for dnsmasq and apache2 - name: Run iiab-uncatch to generate diversion lists for dnsmasq and apache2
shell: /usr/bin/iiab-uncatch shell: /usr/bin/iiab-uncatch
when: py_captive_portal_install
- name: Copy Captive Portal service file - name: Install systemd unit file py-captive-portal.service from template
template: template:
src: roles/network/templates/captive-portal/py-captive-portal.service.j2 src: roles/network/templates/captive-portal/py-captive-portal.service.j2
dest: /etc/systemd/system/py-captive-portal.service dest: /etc/systemd/system/py-captive-portal.service
owner: root owner: root
group: root group: root
mode: 0644 mode: 0644
when: py_captive_portal_install
- name: Copy Captive Portal Apache config file - name: Install Apache's captive-portal.conf from template if py_captive_portal_enabled
template: template:
src: roles/network/templates/captive-portal/captive-portal.conf src: roles/network/templates/captive-portal/captive-portal.conf
dest: /etc/{{ apache_config_dir }}/captive-portal.conf dest: /etc/{{ apache_config_dir }}/captive-portal.conf
owner: root owner: root
group: root group: root
mode: 0740 mode: 0740
when: py_captive_portal_install and py_captive_portal_enabled when: py_captive_portal_enabled
- name: Enable captive-portal after copying files - name: Enable Apache's captive-portal.conf if py_captive_portal_enabled (debuntu)
systemd:
name: py-captive-portal.service
enabled: yes
daemon-reload: yes
when: py_captive_portal_install and py_captive_portal_enabled
- name: Enable Apache config file
file: file:
src: /etc/apache2/sites-available/captive-portal.conf src: /etc/apache2/sites-available/captive-portal.conf
dest: /etc/apache2/sites-enabled/captive-portal.conf path: /etc/apache2/sites-enabled/captive-portal.conf
state: link state: link
when: py_captive_portal_enabled and is_debuntu when: py_captive_portal_enabled and is_debuntu
- name: Enable Apache ssl config file - name: Enable Apache's default-ssl.conf if py_captive_portal_enabled (debuntu)
file: file:
src: /etc/apache2/sites-available/default-ssl.conf src: /etc/apache2/sites-available/default-ssl.conf
dest: /etc/apache2/sites-enabled/default-ssl.conf path: /etc/apache2/sites-enabled/default-ssl.conf
state: link state: link
when: py_captive_portal_enabled and is_debuntu when: py_captive_portal_enabled and is_debuntu
- name: Start captive-portal after copying files - name: Enable & Start systemd service py-captive-portal.service if py_captive_portal_enabled
systemd: systemd:
name: py-captive-portal.service name: py-captive-portal.service
daemon-reload: yes
enabled: yes
state: started state: started
when: py_captive_portal_install and py_captive_portal_enabled when: py_captive_portal_enabled
- name: Disable captive-portal after copying files - name: Disable & Stop py-captive-portal.service if not py_captive_portal_enabled
systemd: systemd:
name: py-captive-portal.service name: py-captive-portal.service
enabled: no 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: py-captive-portal.service
state: stopped state: stopped
when: py_captive_portal_install and not py_captive_portal_enabled when: not py_captive_portal_enabled
- name: Disable Apache config file - name: Disable Apache's captive-portal.conf if not py_captive_portal_enabled (debuntu)
file: file:
dest: /etc/apache2/sites-enabled/captive-portal.conf path: /etc/apache2/sites-enabled/captive-portal.conf
state: absent state: absent
when: not py_captive_portal_enabled and is_debuntu when: not py_captive_portal_enabled and is_debuntu
- name: Make sure dnsmasq is not diverting if captive-portal disabled - name: Disable Apache's default-ssl.conf if not py_captive_portal_enabled (debuntu)
file: file:
dest: /etc/dnsmasq.d/capture path: /etc/apache2/sites-enabled/default-ssl.conf
state: absent
when: not py_captive_portal_enabled and is_debuntu
- name: Make sure dnsmasq is not diverting if not py_captive_portal_enabled
file:
path: /etc/dnsmasq.d/capture
state: absent state: absent
when: not py_captive_portal_enabled when: not py_captive_portal_enabled