Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions roles/4-server-options/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,21 @@
- name: ...IS BEGINNING ==================================
command: echo

- name: Installing Captive Portal
include_tasks: roles/captive-portal/tasks/main.yml
when: captive_portal_install
tags: base, captive-portal, network, domain

- name: Install dnsmasq
include_tasks: roles/network/tasks/dnsmasq.yml
when: dnsmasq_install
tags: base, domain, dnsmasq, network
when: dnsmasq_install or captive_portal_install
tags: base, captive-portal, domain, dnsmasq, network

- name: Install named / BIND
include_tasks: roles/network/tasks/named.yml
when: named_install
tags: base, named, network, domain

- name: Installing captive portal
include_tasks: roles/captive-portal/tasks/main.yml
when: captive_portal_install
tags: base, captive-portal, network, domain

- name: Installing dhcpd
include_tasks: roles/network/tasks/dhcpd.yml
when: dhcpd_install
Expand Down
68 changes: 0 additions & 68 deletions roles/captive-portal/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
dest: /opt/iiab/captive-portal/
mode: "{{ item.mode }}"
with_items:
- { src: roles/captive-portal/templates/checkurls, mode: '0644' }
- { src: roles/captive-portal/templates/capture-wsgi.py, mode: '0755' }

- name: 'Copy templates: simple.template, mac.template'
Expand Down Expand Up @@ -49,70 +48,3 @@
owner: root
group: root
mode: 0644

- name: Install Apache's captive-portal.conf from template if captive_portal_enabled
template:
src: roles/captive-portal/templates/001-captive-portal.conf
dest: /etc/{{ apache_config_dir }}/001-captive-portal.conf
owner: root
group: root
mode: 0644
when: captive_portal_enabled

- name: Enable Apache's captive-portal.conf if captive_portal_enabled (debuntu)
file:
src: /etc/apache2/sites-available/001-captive-portal.conf
path: /etc/apache2/sites-enabled/001-captive-portal.conf
state: link
when: captive_portal_enabled and is_debuntu

- name: Enable Apache's default-ssl.conf if captive_portal_enabled (debuntu)
file:
src: /etc/apache2/sites-available/default-ssl.conf
path: /etc/apache2/sites-enabled/default-ssl.conf
state: link
when: captive_portal_enabled and is_debuntu

- name: Enable & Start systemd service captive-portal.service if captive_portal_enabled
systemd:
name: captive-portal.service
daemon-reload: yes
enabled: yes
state: started
when: captive_portal_enabled

- name: Disable & Stop captive-portal.service if not captive_portal_enabled
systemd:
name: captive-portal.service
enabled: no
state: stopped
when: not captive_portal_enabled

- name: Disable Apache's captive-portal.conf if not captive_portal_enabled (debuntu)
file:
path: /etc/apache2/sites-enabled/001-captive-portal.conf
state: absent
when: not captive_portal_enabled and is_debuntu

- name: Disable Apache's default-ssl.conf if not captive_portal_enabled (debuntu)
file:
path: /etc/apache2/sites-enabled/default-ssl.conf
state: absent
when: not captive_portal_enabled and is_debuntu

- name: Make sure dnsmasq is not diverting if not captive_portal_enabled
file:
path: /etc/dnsmasq.d/capture
state: absent
when: not captive_portal_enabled

- name: Restart apache2
systemd:
name: apache2
state: restarted

- name: Restart dnsmasq
systemd:
name: dnsmasq
state: restarted
when: dnsmasq_enabled
2 changes: 0 additions & 2 deletions roles/captive-portal/templates/iiab-uncatch
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,3 @@ awk '{print("address=/" $1 "/172.18.96.1")}' /opt/iiab/captive-portal/checkurls
echo "#following tells windows 7 that captive portal is active" >>/etc/dnsmasq.d/capture
echo "address=/dns.msftncsi.com/131.107.255.255" >> /etc/dnsmasq.d/capture
awk '{print("ServerAlias ",$1)}' /opt/iiab/captive-portal/checkurls > /etc/apache2/capture
systemctl start captive-portal
systemctl start {{ apache_service }}
72 changes: 72 additions & 0 deletions roles/network/tasks/captive_portal_enable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
- name: 'Copy scripts: checkurls, capture-wsgi.py'
template:
src: "{{ item.src }}"
dest: /opt/iiab/captive-portal/
mode: "{{ item.mode }}"
with_items:
- { src: roles/captive-portal/templates/checkurls, mode: '0644' }

- name: Run iiab-uncatch to generate diversion lists for dnsmasq and apache2
shell: /usr/bin/iiab-uncatch

- name: Install Apache's captive-portal.conf from template
template:
src: roles/captive-portal/templates/001-captive-portal.conf
dest: /etc/{{ apache_config_dir }}/001-captive-portal.conf
owner: root
group: root
mode: 0740
when: captive_portal_enabled

- name: Enable Apache's captive-portal.conf if py_captive_portal_enabled (debuntu)
file:
src: /etc/apache2/sites-available/001-captive-portal.conf
path: /etc/apache2/sites-enabled/001-captive-portal.conf
state: link
when: captive_portal_enabled and is_debuntu

- name: Enable Apache's default-ssl.conf if py_captive_portal_enabled (debuntu)
file:
src: /etc/apache2/sites-available/default-ssl.conf
path: /etc/apache2/sites-enabled/default-ssl.conf
state: link
when: captive_portal_enabled and is_debuntu

- name: Disable Apache's captive-portal.conf if not py_captive_portal_enabled (debuntu)
file:
path: /etc/apache2/sites-enabled/001-captive-portal.conf
state: absent
when: not captive_portal_enabled and is_debuntu

- name: Disable Apache's captive-portal.conf if not py_captive_portal_enabled (redhat)
file:
path: /etc/{{ apache_config_dir }}/001-captive-portal.conf
state: absent
when: not captive_portal_enabled and not is_debuntu

- name: Disable Apache's default-ssl.conf if not py_captive_portal_enabled (debuntu)
file:
path: /etc/apache2/sites-enabled/default-ssl.conf
state: absent
when: not py_captive_portal_enabled and is_debuntu

- name: Enable & Start systemd service py-captive-portal.service if py_captive_portal_enabled
systemd:
name: captive-portal.service
daemon-reload: yes
enabled: yes
state: started
when: captive_portal_enabled

- name: Disable & Stop py-captive-portal.service if not py_captive_portal_enabled
systemd:
name: captive-portal.service
enabled: no
state: stopped
daemon-reload: yes
when: not captive_portal_enabled

- name: Restart Apache
systemd:
name: "{{ apache_service }}"
state: restarted
1 change: 1 addition & 0 deletions roles/network/tasks/computed_services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
dansguardian_enabled: False
squid_enabled: False
wondershaper_enabled: False
captive_portal_enabled: False
iiab_network_mode: "Appliance"
when: iiab_lan_iface == "none" or user_lan_iface == "none"

Expand Down
6 changes: 6 additions & 0 deletions roles/network/tasks/enable_services.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,12 @@
enabled: yes
when: dnsmasq_enabled and dnsmasq_install

- name: Make sure dnsmasq is not diverting if not captive_portal_enabled
file:
path: /etc/dnsmasq.d/capture
state: absent
when: not captive_portal_enabled

- name: Enable DansGuardian systemd service, if dansguardian_enabled
systemd:
name: dansguardian
Expand Down
4 changes: 4 additions & 0 deletions roles/network/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@
- network

#### end network layout
- name: Captive Portal Configuration
include_tasks: captive_portal_enable.yml
when: captive_portal_install

- include_tasks: restart.yml
when: not installing
tags:
Expand Down
1 change: 1 addition & 0 deletions scripts/calibre-install-pinned-rpi.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ echo "deb http://raspbian.raspberrypi.org/raspbian/ testing main" > /etc/apt/sou
apt update
# WARNING: you MUST remove old .deb's from /opt/iiab/downloads if upgrading Calibre in this way, SEE: http://FAQ.IIAB.IO "Can I upgrade or reinstall server apps?"
apt -y install sqlite3 # Appears no longer nec as of 2018-10-23. Was required in Sept 2018 as workaround for https://github.com/iiab/iiab/issues/1139 that blocked install of Admin Console
apt -y install /opt/iiab/downloads/calibre*.deb
#sed -i '$ d' /etc/apt/sources.list.d/rpi-testing.list # Removes last line
rm /etc/apt/sources.list.d/rpi-testing.list
# Clears the cache of rpi/testing
Expand Down