mirror of
https://github.com/iiab/iiab.git
synced 2025-03-09 15:40:17 +00:00
commit
c898fa55b2
9 changed files with 52 additions and 48 deletions
|
@ -37,14 +37,3 @@
|
||||||
src: "{{ doc_root }}/common/fonts" # /library/www/html
|
src: "{{ doc_root }}/common/fonts" # /library/www/html
|
||||||
path: "{{ doc_root }}/common/webfonts"
|
path: "{{ doc_root }}/common/webfonts"
|
||||||
state: link
|
state: link
|
||||||
|
|
||||||
- name: File Layout - Create log file directories {{ apache_log_dir }} & {{ nginx_log_dir }}
|
|
||||||
file:
|
|
||||||
path: "{{ item }}"
|
|
||||||
owner: "{{ apache_user }}" # www-data
|
|
||||||
group: "{{ apache_user }}" # www-data
|
|
||||||
mode: '0770'
|
|
||||||
state: directory
|
|
||||||
with_items:
|
|
||||||
- "{{ apache_log_dir }}" # /var/log/apache2 typically, as set in /opt/iiab/iiab/vars/<OS>.yml
|
|
||||||
- "{{ nginx_log_dir }}" # /var/log/nginx
|
|
||||||
|
|
|
@ -14,6 +14,14 @@
|
||||||
state: directory
|
state: directory
|
||||||
owner: "{{ apache_user }}"
|
owner: "{{ apache_user }}"
|
||||||
|
|
||||||
|
- name: Create directory /var/log/captiveportal for logs; set owner to {{ apache_user }}
|
||||||
|
file:
|
||||||
|
path: /var/log/captiveportal
|
||||||
|
state: directory
|
||||||
|
owner: "{{ apache_user }}"
|
||||||
|
group: "{{ apache_user }}"
|
||||||
|
mode: 0750 # same as /var/log/apache2
|
||||||
|
|
||||||
- name: "Install 3 scripts from template: /opt/iiab/captiveportal/checkurls, /usr/sbin/iiab-make-cp-servers.py, /usr/sbin/iiab-divert-to-nginx"
|
- name: "Install 3 scripts from template: /opt/iiab/captiveportal/checkurls, /usr/sbin/iiab-make-cp-servers.py, /usr/sbin/iiab-divert-to-nginx"
|
||||||
template:
|
template:
|
||||||
src: "{{ item.src }}"
|
src: "{{ item.src }}"
|
||||||
|
@ -41,11 +49,11 @@
|
||||||
- mac.template
|
- mac.template
|
||||||
#- roles/captiveportal/files/mac.template
|
#- roles/captiveportal/files/mac.template
|
||||||
|
|
||||||
- name: Install uWSGI config file /opt/iiab/captiveportal/captiveportal.ini from template
|
#- name: Install /etc/systemd/system/uwsgi-captiveportal.service from template
|
||||||
template:
|
# template:
|
||||||
src: captiveportal.ini.j2
|
# src: uwsgi-captiveportal.service
|
||||||
#src: roles/captiveportal/templates/captiveportal.ini.j2
|
# #src: roles/captiveportal/templates/uwsgi-captiveportal.service
|
||||||
dest: /opt/iiab/captiveportal/captiveportal.ini
|
# dest: /etc/systemd/system/
|
||||||
|
|
||||||
- name: "Add 'captiveportal_installed: True' to {{ iiab_state_file }}"
|
- name: "Add 'captiveportal_installed: True' to {{ iiab_state_file }}"
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -55,25 +63,38 @@
|
||||||
|
|
||||||
# TO DO: move most/all 7-10 stanzas below into enable-or-disable.yml
|
# TO DO: move most/all 7-10 stanzas below into enable-or-disable.yml
|
||||||
|
|
||||||
- name: Install /etc/systemd/system/uwsgi-captiveportal.service from template
|
#- name: Restart & Enable 'uwsgi-captiveportal' systemd service (uWSGI server) that responds to browsers trying to detect a Captive Portal
|
||||||
template:
|
# systemd:
|
||||||
src: uwsgi-captiveportal.service
|
# name: uwsgi-captiveportal
|
||||||
#src: roles/captiveportal/templates/uwsgi-captiveportal.service
|
# daemon_reload: yes
|
||||||
dest: /etc/systemd/system/
|
# state: restarted
|
||||||
|
# enabled: True
|
||||||
|
# when: captiveportal_enabled | bool
|
||||||
|
|
||||||
- name: Restart & Enable 'uwsgi-captiveportal' systemd service (uWSGI server) that responds to browsers trying to detect a Captive Portal
|
#- name: Stop & Disable 'uwsgi-captiveportal' systemd service (uWSGI server) if Captive Portal has been disabled
|
||||||
|
# systemd:
|
||||||
|
# name: uwsgi-captiveportal
|
||||||
|
# state: stopped
|
||||||
|
# enabled: False
|
||||||
|
# when: not captiveportal_enabled
|
||||||
|
|
||||||
|
- name: Stop uwsgi
|
||||||
systemd:
|
systemd:
|
||||||
name: uwsgi-captiveportal
|
name: uwsgi
|
||||||
daemon_reload: yes
|
state: stopped
|
||||||
state: restarted
|
|
||||||
enabled: True
|
- name: Install uWSGI config file /etc/uwsgi/apps-enabled/captiveportal.ini from template
|
||||||
|
template:
|
||||||
|
src: captiveportal.ini.j2
|
||||||
|
#src: roles/captiveportal/templates/captiveportal.ini.j2
|
||||||
|
dest: /etc/uwsgi/apps-enabled/captiveportal.ini
|
||||||
when: captiveportal_enabled | bool
|
when: captiveportal_enabled | bool
|
||||||
|
|
||||||
- name: Stop & Disable 'uwsgi-captiveportal' systemd service (uWSGI server) if Captive Portal has been disabled
|
- name: Delete uWSGI config file /etc/uwsgi/apps-enabled/captiveportal.ini when disabled
|
||||||
systemd:
|
file:
|
||||||
name: uwsgi-captiveportal
|
#src: /etc/nginx/sites-available/capture.conf
|
||||||
state: stopped
|
path: /etc/uwsgi/apps-enabled/captiveportal.ini
|
||||||
enabled: False
|
state: absent
|
||||||
when: not captiveportal_enabled
|
when: not captiveportal_enabled
|
||||||
|
|
||||||
- name: Run iiab-divert-to-nginx to generate diversion lists for NGINX
|
- name: Run iiab-divert-to-nginx to generate diversion lists for NGINX
|
||||||
|
@ -104,13 +125,13 @@
|
||||||
state: absent
|
state: absent
|
||||||
when: not captiveportal_enabled
|
when: not captiveportal_enabled
|
||||||
|
|
||||||
#- name: Restart dnsmasq
|
# lets assume admin-console was/will be installed anyway
|
||||||
# systemd:
|
- name: Start uwsgi
|
||||||
# name: dnsmasq
|
systemd:
|
||||||
# state: restarted
|
name: uwsgi
|
||||||
# when: dnsmasq_enabled | bool
|
daemon_reload: yes
|
||||||
|
state: started
|
||||||
# ABOVE DOES NOT WORK ON UBUNTU 16.04 -- what follows is a crude hack (seems to work!)
|
enabled: true
|
||||||
|
|
||||||
- name: Stop 'dnsmasq' systemd service
|
- name: Stop 'dnsmasq' systemd service
|
||||||
systemd:
|
systemd:
|
||||||
|
|
|
@ -46,9 +46,9 @@ if len(sys.argv) > 1:
|
||||||
loggingLevel = "DEBUG"
|
loggingLevel = "DEBUG"
|
||||||
|
|
||||||
# set up some logging -- selectable for diagnostics
|
# set up some logging -- selectable for diagnostics
|
||||||
logging.basicConfig(filename='{{ nginx_log_dir }}/portal.log',format='%(asctime)s.%(msecs)03d:%(name)s:%(message)s', datefmt='%M:%S',level=loggingLevel)
|
logging.basicConfig(filename='/var/log/captiveportal/captiveportal.log',format='%(asctime)s.%(msecs)03d:%(name)s:%(message)s', datefmt='%M:%S',level=loggingLevel)
|
||||||
logger = logging.getLogger('{{ nginx_log_dir }}/portal.log')
|
logger = logging.getLogger('/var/log/captiveportal/captiveportal.log')
|
||||||
handler = RotatingFileHandler("{{ nginx_log_dir }}/portal.log", maxBytes=100000, backupCount=2)
|
handler = RotatingFileHandler("/var/log/captiveportal/captiveportal.log", maxBytes=100000, backupCount=2)
|
||||||
logger.addHandler(handler)
|
logger.addHandler(handler)
|
||||||
|
|
||||||
PORT={{ captiveportal_port }}
|
PORT={{ captiveportal_port }}
|
||||||
|
|
|
@ -27,13 +27,6 @@
|
||||||
- { src: 'roles/nginx/templates/server.conf.j2', dest: '/etc/nginx/server.conf' }
|
- { src: 'roles/nginx/templates/server.conf.j2', dest: '/etc/nginx/server.conf' }
|
||||||
- { src: 'roles/nginx/templates/nginx.conf.j2', dest: '/etc/nginx/nginx.conf' }
|
- { src: 'roles/nginx/templates/nginx.conf.j2', dest: '/etc/nginx/nginx.conf' }
|
||||||
- { src: 'roles/nginx/templates/ports.conf.j2', dest: '/etc/{{ apache_service }}/ports.conf' }
|
- { src: 'roles/nginx/templates/ports.conf.j2', dest: '/etc/{{ apache_service }}/ports.conf' }
|
||||||
- { src: 'roles/nginx/templates/uwsgi.service', dest: '/etc/systemd/system/' }
|
|
||||||
|
|
||||||
- name: Let uwsgi (running as {{ apache_user }}) write log files
|
|
||||||
file:
|
|
||||||
path: /var/log/uwsgi/app
|
|
||||||
state: directory
|
|
||||||
owner: "{{ apache_user }}"
|
|
||||||
|
|
||||||
- name: "Add 'nginx_installed: True' to {{ iiab_state_file }}"
|
- name: "Add 'nginx_installed: True' to {{ iiab_state_file }}"
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
path: "{{ item.path }}"
|
path: "{{ item.path }}"
|
||||||
state: absent
|
state: absent
|
||||||
with_items:
|
with_items:
|
||||||
|
- { path: "/etc/systemd/system/uwsgi.service" }
|
||||||
- { path: "{{ nginx_config_dir }}/usb-lib.conf" }
|
- { path: "{{ nginx_config_dir }}/usb-lib.conf" }
|
||||||
- { path: "{{ nginx_config_dir }}/modules.conf" }
|
- { path: "{{ nginx_config_dir }}/modules.conf" }
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue