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

Merge pull request #42 from iiab/master

sync from iiab/iiab
This commit is contained in:
A Holt 2017-12-07 10:59:04 -05:00 committed by GitHub
commit 7bf5bfe690
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
28 changed files with 420 additions and 292 deletions

View file

@ -0,0 +1,26 @@
- name: Does systemd startup service exist
stat: path="{{ systemd_location }}/iiab-startup.service"
register: startup_unit
- name: Copy startup service to /etc/systemd/system
template: src=iiab-startup.service
dest=/etc/systemd/system/
when: startup_unit.stat.exists is defined and not startup_unit.stat.exists
- name: Copy startup script
template: src=iiab-startup.sh
dest=/usr/libexec/
mode=0755
when: startup_unit.stat.exists is defined and not startup_unit.stat.exists
- name: Ask systemd to recognize the changes
shell: systemctl daemon-reload
when: startup_unit.stat.exists is defined and not startup_unit.stat.exists
- name: Restart so systemd recognizes the changes
shell: systemctl restart iiab-startup.service
when: startup_unit.stat.exists is defined and not startup_unit.stat.exists
- name: Enable the reload service
shell: systemctl enable iiab-startup.service
when: startup_unit.stat.exists is defined and not startup_unit.stat.exists

View file

@ -44,6 +44,8 @@
- include_tasks: udev.yml - include_tasks: udev.yml
- include_tasks: iiab-startup.yml
- name: Recording STAGE 2 HAS COMPLETED ========================== - name: Recording STAGE 2 HAS COMPLETED ==========================
lineinfile: dest=/etc/iiab/iiab.env lineinfile: dest=/etc/iiab/iiab.env
regexp='^STAGE=*' regexp='^STAGE=*'

View file

@ -0,0 +1,10 @@
[Unit]
Description=Execute startup script
After=network-online.target
[Service]
Type=oneshot
ExecStart=/usr/libexec/iiab-startup.sh
[Install]
WantedBy=multi-user.target

View file

@ -0,0 +1,8 @@
#!/bin/bash
# put initialization that needs to happen at every startup for IIAB here
if [ ! -f /etc/iiab/uuid ]; then
uuidgen > /etc/iiab/uuid
fi
exit 0

View file

@ -77,13 +77,15 @@
#async: 900 #async: 900
#poll: 5 #poll: 5
- name: Add 'calibre-serve' to service list at /etc/iiab/iiab.ini - name: Add 'calibre' to list of services at /etc/iiab/iiab.ini
ini_file: ini_file:
dest: "{{ service_filelist }}" dest: "{{ service_filelist }}"
section: calibre section: calibre
option: "{{ item.option }}" option: "{{ item.option }}"
value: "{{ item.value }}" value: "{{ item.value }}"
with_items: with_items:
- option: name
value: Calibre
- option: description - option: description
value: '"Calibre is an extremely popular personal library system for e-books."' value: '"Calibre is an extremely popular personal library system for e-books."'
- option: url - option: url

View file

@ -1,5 +1,5 @@
elgg_xx: elgg elgg_xx: elgg
elgg_version: "2.3.4" elgg_version: "2.3.5"
# elgg_mysql_password: defined in default_vars # elgg_mysql_password: defined in default_vars
elgg_url: /elgg elgg_url: /elgg

View file

@ -34,14 +34,15 @@
- include_tasks: enable.yml - include_tasks: enable.yml
- name: Add 'kalite-serve' to service list - name: Add 'kalite' to list of services at /etc/iiab/iiab.ini
ini_file: dest='{{ service_filelist }}' ini_file:
section=kalite dest: "{{ service_filelist }}"
option='{{ item.option }}' section: kalite
value='{{ item.value }}' option: "{{ item.option }}"
value: "{{ item.value }}"
with_items: with_items:
- option: name - option: name
value: kalite value: "KA Lite"
- option: description - option: description
value: '"KA Lite is a server to present Khan Academy videos offline and to download them."' value: '"KA Lite is a server to present Khan Academy videos offline and to download them."'
- option: path - option: path

View file

@ -1,24 +1,29 @@
# Which kiwix-tools to download from http://download.iiab.io/packages/ (origin: http://download.kiwix.org/nightly/) # Which kiwix-tools to download from http://download.iiab.io/packages/ (origin: http://download.kiwix.org/nightly/)
kiwix_src_file_linux64: "kiwix-tools_linux64_2017-11-12.tar.gz" kiwix_src_file_armhf: "kiwix-tools_armhf_2017-12-01.tar.gz"
kiwix_src_file_armhf: "kiwix-tools_armhf_2017-11-12.tar.gz" kiwix_src_file_linux64: "kiwix_tools_linux64_2017-12-01.tar.gz"
# Experimental kiwix-0.10 from Oct 2016: (to be replaced before Feb 2018, SEE https://github.com/kiwix/kiwix-build/issues/94) kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" # Published Oct 2016 ("experimental")
kiwix_src_file_i686: "kiwix-0.10-linux-i686.tar.bz2" # kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2" # Published May 2014 ("use v0.9 to test legacy ZIM content")
# Appears to be kiwix-0.9 from May 2014: # KIWIX FOR i686 SHOULD BE REPLACED BEFORE FEB 2018: https://github.com/kiwix/kiwix-build/issues/94
# kiwix_src_file_i686: "kiwix-linux-i686.tar.bz2"
# The following 2 lines are unused as of Nov 2017:
# kiwix_url: /kiwix
# kiwix_path: "{{ iiab_base }}/kiwix"
kiwix_port: 3000 kiwix_port: 3000
# Expected to be used soon for Kiwix proxy:
kiwix_url: /kiwix/
# Unused in Nov 2017, but should be:
kiwix_path: "{{ iiab_base }}/kiwix"
# /library/zims contains 3 important things: {library.xml, content, index} # /library/zims contains 3 important things:
# - library.xml
# - content directory for all *.zim's
# - index directory for legacy *.zim.idx's
iiab_zim_path: "{{ content_base }}/zims" iiab_zim_path: "{{ content_base }}/zims"
kiwix_library_xml: "{{ iiab_zim_path }}/library.xml" kiwix_library_xml: "{{ iiab_zim_path }}/library.xml"
kiwix_content_path: "{{ iiab_zim_path }}/content" # Unused: (Nov 2017)
# kiwix_content_path: "{{ iiab_zim_path }}/content"
# Installation variables # Installation Variables
kiwix_install: True kiwix_install: True
kiwix_enabled: True kiwix_enabled: True
# The following line is unused as of Nov 2017: # MOVE FILE /opt/iiab/kiwix/bin/kiwix-serve TO FORCE A REINSTALL OF kiwix-tools
kiwix_force_install: False
# Unused: (Nov 2017)
# kiwix_content_found: False # kiwix_content_found: False
kiwix_first_pass: False

View file

@ -1,4 +1,6 @@
- name: Create various directories for Kiwix's ZIM files # 1. CREATE/VERIFY CRITICAL DIRECTORIES & FILES ARE IN PLACE
- name: Create various directories for Kiwix ZIM files
file: file:
path: "{{ item }}" path: "{{ item }}"
owner: root owner: root
@ -7,7 +9,7 @@
state: directory state: directory
with_items: with_items:
- "{{ iiab_zim_path }}" - "{{ iiab_zim_path }}"
- "{{ kiwix_content_path }}" - "{{ iiab_zim_path }}/content"
- "{{ iiab_zim_path }}/index" - "{{ iiab_zim_path }}/index"
- name: Check for /library/zims/library.xml - name: Check for /library/zims/library.xml
@ -29,69 +31,57 @@
- name: Check for /opt/iiab/kiwix/bin/kiwix-serve binary - name: Check for /opt/iiab/kiwix/bin/kiwix-serve binary
stat: stat:
path: "{{ iiab_base }}/kiwix/bin/kiwix-serve" path: "{{ kiwix_path }}/bin/kiwix-serve"
register: kiwix_bin register: kiwix_bin
- name: Set kiwix_first_pass if kiwix-serve not found - name: Set kiwix_force_install if kiwix-serve not found
set_fact: set_fact:
kiwix_first_pass: True kiwix_force_install: True
when: kiwix_bin.stat.exists is defined and not kiwix_bin.stat.exists when: not kiwix_bin.stat.exists
- name: Copy test.zim file - name: Copy test.zim file if kiwix_force_install
copy: copy:
src: test.zim src: test.zim
dest: "{{ kiwix_content_path }}/test.zim" dest: "{{ iiab_zim_path }}/content/test.zim"
mode: 0644 mode: 0644
owner: root owner: root
group: root group: root
force: no force: no
when: kiwix_first_pass when: kiwix_force_install
# We get a whole web server for i686 but only the kiwix execs for linux64 & armhf - name: Create /opt/iiab/kiwix/bin directory
file:
path: "{{ kiwix_path }}/bin"
owner: root
group: root
mode: 0755
state: directory
# EXPERIMENTAL i686 CODE PATH: as of Nov 2017 bunzip2 then untar unpacks # 2. INSTALL KIWIX-TOOLS EXECUTABLES IF kiwix_force_install
# to /tmp/kiwix-0.10-i686/bin WHOSE CONTENTS NEEDS TO BE MOVED TO # (We get a whole web server for i686 but only kiwix execs for linux64 & armhf)
# /opt/iiab/kiwix/bin (STANZA FURTHER BELOW). All i686 code needs testing.
# ALSO: code below may need to be revived to chown -R root:root & chmod - name: Unarchive Kiwix binaries to permanent location (NOT i686)
- name: Unarchive kiwix-*-linux-i686.tar.bz2 to /tmp (not bin_only, i.e. i686) unarchive:
src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
dest: "{{ kiwix_path }}/bin"
owner: root
group: root
when: kiwix_src_bin_only and kiwix_force_install
- name: Unarchive kiwix*i686.tar.bz2 to /tmp (i686)
unarchive: unarchive:
src: "{{ downloads_dir }}/{{ kiwix_src_file }}" src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
dest: /tmp dest: /tmp
# dest: "{{ iiab_base }}" # dest: "{{ iiab_base }}"
owner: root owner: root
group: root group: root
when: not kiwix_src_bin_only and kiwix_first_pass when: not kiwix_src_bin_only and kiwix_force_install
- name: Create kiwix/bin directory - name: Move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (i686)
file: shell: "mv /tmp/kiwix*i686/bin/* {{ kiwix_path }}/bin/"
path: "{{ iiab_base }}/kiwix/bin" when: not kiwix_src_bin_only and kiwix_force_install
owner: root
group: root
mode: 0755
state: directory
# EXPERIMENTAL i686 CODE PATH # 3. ENABLE MODS FOR APACHE PROXY IF DEBUNTU
- name: move /tmp/kiwix*i686/bin/* to permanent location /opt/iiab/kiwix/bin (not bin_only, i.e. i686)
shell: "mv /tmp/kiwix*i686/bin/* /opt/iiab/kiwix/bin/"
when: not kiwix_src_bin_only and kiwix_first_pass
- name: Unarchive Kiwix to permanent location (bin_only, i.e. not i686)
unarchive:
src: "{{ downloads_dir }}/{{ kiwix_src_file }}"
dest: "{{ iiab_base }}/kiwix/bin"
owner: root
group: root
when: kiwix_src_bin_only and kiwix_first_pass
# MIGHT BE RESTORED LATER FOR i686? Unused as of Nov 2017:
# # workaround because unarchive does not set ownership properly
# - name: "Set ownership as if: 'chown -R root:root /opt/iiab/kiwix'"
# file:
# path: "{{ iiab_base }}/kiwix"
# owner: root
# group: root
# recurse: yes
# mode: ????
- name: Enable the mods which permit Apache to proxy (debuntu) - name: Enable the mods which permit Apache to proxy (debuntu)
apache2_module: apache2_module:
@ -103,24 +93,9 @@
- rewrite - rewrite
when: is_debuntu when: is_debuntu
# workaround because kiwix-serve does not stay running # 4. CREATE/ENABLE/DISABLE KIWIX SERVICE & ITS CRON JOB
- name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu)
# * * * * * user-name command to be executed
lineinfile:
line: "0 4 * * * root /bin/systemctl restart kiwix-serve.service"
dest: /etc/crontab
when: is_debuntu
- name: Make a crontab entry to restart kiwix-serve at 4AM (redhat) - name: Create 'kiwix-serve' service and related files
# * * * * * user-name command to be executed
lineinfile:
line: "0 4 * * * root /usr/bin/systemctl restart kiwix-serve.service"
dest: /etc/crontab
when: is_redhat
# Create Kiwix service
- name: Create 'kiwix-serve' service
template: template:
backup: no backup: no
src: "{{ item.src }}" src: "{{ item.src }}"
@ -133,7 +108,14 @@
# - { src: 'kiwix-serve-init.j2', dest: '/usr/libexec/kiwix-serve-init', mode: '0755'} # - { src: 'kiwix-serve-init.j2', dest: '/usr/libexec/kiwix-serve-init', mode: '0755'}
- { src: 'iiab-make-kiwix-lib', dest: '/usr/bin/iiab-make-kiwix-lib', mode: '0755'} - { src: 'iiab-make-kiwix-lib', dest: '/usr/bin/iiab-make-kiwix-lib', mode: '0755'}
- { src: 'iiab-make-kiwix-lib.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755'} - { src: 'iiab-make-kiwix-lib.py', dest: '/usr/bin/iiab-make-kiwix-lib.py', mode: '0755'}
- { src: 'iiab-make-apache-config.py', dest: '/usr/bin/iiab-make-apache-config.py', mode: '0755'} # - { src: 'iiab-make-apache-config.py', dest: '/usr/bin/iiab-make-apache-config.py', mode: '0755'}
- { src: 'kiwix.conf.j2', dest: '/etc/{{ apache_config_dir }}/kiwix.conf', mode: '0644'}
- name: Enable Kiwix Proxy in Apache - is disabled by turning off kiwix service
file: path=/etc/apache2/sites-enabled/kiwix.conf
src=/etc/apache2/sites-available/kiwix.conf
state=link
when: is_debuntu
- name: Enable 'kiwix-serve' service - name: Enable 'kiwix-serve' service
service: service:
@ -148,8 +130,33 @@
enabled: no enabled: no
state: stopped state: stopped
when: not kiwix_enabled when: not kiwix_enabled
# IN THEORY: BOTH CRON ENTRIES BELOW *SHOULD* BE DELETED "when: not kiwix_enabled"
- name: Add 'kiwix-serve' to list of services at /opt/iiab/iiab.ini # In the past kiwix-serve did not stay running, so we'd been doing this hourly.
# @mgautierfr & others suggest kiwix-serve might be auto-restarted w/o cron in
# future, whenever service fails, if this really catches all cases??
# https://github.com/iiab/iiab/issues/484#issuecomment-342151726
- name: Make a crontab entry to restart kiwix-serve at 4AM (debuntu)
lineinfile:
# mn hr dy mo day-of-week[Sunday=0] username command-to-be-executed
line: "0 4 * * * root /bin/systemctl restart kiwix-serve.service"
dest: /etc/crontab
when: kiwix_enabled and is_debuntu
- name: Make a crontab entry to restart kiwix-serve at 4AM (redhat)
# * * * * * user-name command to be executed
lineinfile:
# mn hr dy mo day-of-week[Sunday=0] username command-to-be-executed
line: "0 4 * * * root /usr/bin/systemctl restart kiwix-serve.service"
dest: /etc/crontab
when: kiwix_enabled and is_redhat
- name: Restart apache, so it picks up kiwix.conf
service: name={{ apache_service }} state=restarted
# 5. FINALIZE
- name: Add 'kiwix-serve' to list of services at /etc/iiab/iiab.ini
ini_file: ini_file:
dest: "{{ service_filelist }}" dest: "{{ service_filelist }}"
section: kiwix-serve section: kiwix-serve
@ -160,18 +167,18 @@
value: kiwix-serve value: kiwix-serve
- option: description - option: description
value: '"Part of https://github.com/kiwix/kiwix-tools/ - kiwix-serve is the most used web server for ZIM files."' value: '"Part of https://github.com/kiwix/kiwix-tools/ - kiwix-serve is the most used web server for ZIM files."'
# The following 4 lines are unused as of Nov 2017: - option: kiwix_url
# - option: kiwix_url value: "{{ kiwix_url }}"
# value: "{{ kiwix_url }}" - option: kiwix_path
# - option: kiwix_path value: "{{ kiwix_path }}"
# value: "{{ kiwix_path }}"
- option: kiwix_port - option: kiwix_port
value: "{{ kiwix_port }}" value: "{{ kiwix_port }}"
- option: iiab_zim_path - option: iiab_zim_path
value: "{{ iiab_zim_path }}" value: "{{ iiab_zim_path }}"
- option: kiwix_library_xml - option: kiwix_library_xml
value: "{{ kiwix_library_xml }}" value: "{{ kiwix_library_xml }}"
- option: kiwix_content_path # The following 2 lines are unused: (Nov 2017)
value: "{{ kiwix_content_path }}" # - option: kiwix_content_path
# value: "{{ kiwix_content_path }}"
- option: enabled - option: enabled
value: "{{ kiwix_enabled }}" value: "{{ kiwix_enabled }}"

View file

@ -1,9 +1,8 @@
# EXPERIMENTAL i686 CODE PATH - name: "Set Kiwix filename to d/l: {{ kiwix_src_file_armhf }} (armv6l or armv71)"
- name: "Set Kiwix filename to d/l: {{ kiwix_src_file_i686 }} (i686)"
set_fact: set_fact:
kiwix_src_file: "{{ kiwix_src_file_i686 }}" kiwix_src_file: "{{ kiwix_src_file_armhf }}"
kiwix_src_bin_only: False kiwix_src_bin_only: True
when: ansible_machine == "i686" when: ansible_machine == "armv7l" or ansible_machine == "armv6l"
- name: "Set Kiwix filename to d/l: {{ kiwix_src_file_linux64 }} (x86_64)" - name: "Set Kiwix filename to d/l: {{ kiwix_src_file_linux64 }} (x86_64)"
set_fact: set_fact:
@ -11,11 +10,18 @@
kiwix_src_bin_only: True kiwix_src_bin_only: True
when: ansible_machine == "x86_64" when: ansible_machine == "x86_64"
- name: "Set Kiwix filename to d/l: {{ kiwix_src_file_armhf }} (armv6l or armv71)" - name: "Set Kiwix filename to d/l: {{ kiwix_src_file_i686 }} (i686)"
set_fact: set_fact:
kiwix_src_file: "{{ kiwix_src_file_armhf }}" kiwix_src_file: "{{ kiwix_src_file_i686 }}"
kiwix_src_bin_only: True kiwix_src_bin_only: False
when: ansible_machine == "armv7l" or ansible_machine == "armv6l" when: ansible_machine == "i686"
# COMMENT OUT LINE ABOVE TO TEST i686 CODE PATH ON X86_64 (WORKS NOV 2017)
- name: FAIL (force Ansible to exit) IF kiwix-tools appears unavailable for OS/architecture
# debug:
fail:
msg: "WARNING: kiwix-tools SOFTWARE APPEARS UNAVAILABLE FOR YOUR {{ ansible_machine }} OS/ARCHITECTURE."
when: not kiwix_src_file
- name: Download Kiwix software to /opt/iiab/downloads - name: Download Kiwix software to /opt/iiab/downloads
get_url: get_url:
@ -23,11 +29,16 @@
dest: "{{ downloads_dir }}/{{ kiwix_src_file }}" dest: "{{ downloads_dir }}/{{ kiwix_src_file }}"
when: internet_available when: internet_available
- name: Check for /opt/iiab/downloads/{{ kiwix_src_file }}
stat:
path: "{{ downloads_dir }}/{{ kiwix_src_file }}"
register: kiwix_src
- name: FAIL (force Ansible to exit) IF /opt/iiab/downloads/{{ kiwix_src_file }} doesn't exist
fail:
msg: "{ downloads_dir }}/{{ kiwix_src_file }} is REQUIRED in order to install Kiwix."
when: not kiwix_src.stat.exists
- include_tasks: kiwix_install.yml - include_tasks: kiwix_install.yml
when: kiwix_src_file is defined
tags: tags:
- kiwix - kiwix
- debug:
msg: "WARNING: kiwix-tools SOFTWARE NOT FOUND FOR YOUR OS/ARCHITECTURE."
when: not kiwix_src_file

View file

@ -2,7 +2,7 @@
{{ systemctl_program }} stop kiwix-serve {{ systemctl_program }} stop kiwix-serve
/usr/bin/iiab-make-kiwix-lib.py /usr/bin/iiab-make-kiwix-lib.py
/usr/bin/iiab-make-apache-config.py #/usr/bin/iiab-make-apache-config.py
{{ systemctl_program }} start kiwix-serve {{ systemctl_program }} start kiwix-serve
exit 0 exit 0

View file

@ -4,7 +4,7 @@ After=syslog.target network.target local-fs.target
[Service] [Service]
Type=forking Type=forking
ExecStart={{ iiab_base }}/kiwix/bin/kiwix-serve --daemon --port {{ kiwix_port }} --nolibrarybutton --library {{ kiwix_library_xml }} ExecStart={{ iiab_base }}/kiwix/bin/kiwix-serve --daemon --port {{ kiwix_port }} --nolibrarybutton --library {{ kiwix_library_xml }} --urlRootLocation={{ kiwix_url }}
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target

View file

@ -0,0 +1 @@
ProxyPass {{ kiwix_url }} http://127.0.0.1:{{ kiwix_port }}{{ kiwix_url }}

View file

@ -8,7 +8,7 @@
- name: Create a config template for hostapd - name: Create a config template for hostapd
template: src=hostapd/iiab-hostapd.conf.j2 template: src=hostapd/iiab-hostapd.conf.j2
dest=/etc/hostapd/hostapd.conf.template dest=/etc/hostapd/hostapd.conf.iiab
owner=root owner=root
group=root group=root
mode=0644 mode=0644

View file

@ -8,13 +8,13 @@
- network - network
- network-discover - network-discover
- name: RPi hack for AP post install via wifi so the services are right - name: RPi - reboot to AP post install - installed via wifi so the services are ready
set_fact: set_fact:
iiab_lan_iface: br0 iiab_lan_iface: br0
iiab_wan_iface: "{{ discovered_wired_iface }}" iiab_wan_iface: "{{ discovered_wired_iface }}"
iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}" iiab_wireless_lan_iface: "{{ discovered_wireless_iface }}"
iiab_wired_lan_iface: "" iiab_wired_lan_iface: ""
when: is_rpi and discovered_wireless_iface is defined and discovered_wireless_iface == iiab_wan_iface when: is_rpi and discovered_wireless_iface is defined and discovered_wireless_iface == iiab_wan_iface and reboot_to_AP
- include_tasks: computed_network.yml - include_tasks: computed_network.yml
when: not installing when: not installing
@ -27,7 +27,7 @@
- network - network
- AP - AP
- name: RPi hack for AP post install via wifi don't blow away current network - name: RPi reboot to AP post install - installed via wifi - don't blow away current network
set_fact: set_fact:
no_net_restart: True no_net_restart: True
hostapd_enabled: False hostapd_enabled: False

View file

@ -90,3 +90,6 @@
file: path=/etc/{{ apache_config_dir }}/dns-jail.conf file: path=/etc/{{ apache_config_dir }}/dns-jail.conf
state=absent state=absent
when: not is_debuntu and not dns_jail_enabled when: not is_debuntu and not dns_jail_enabled
- name: Start named after copying files
service: name={{ dns_service }} state=started

View file

@ -2,6 +2,8 @@
sed -i -e "s/^denyinterfaces*/#denyinterfaces/" /etc/dhcpcd.conf sed -i -e "s/^denyinterfaces*/#denyinterfaces/" /etc/dhcpcd.conf
systemctl disable hostapd systemctl disable hostapd
systemctl stop hostapd systemctl stop hostapd
systemctl disable dhcpd
systemctl stop dhcpd
systemctl daemon-reload systemctl daemon-reload
systemctl restart dhcpcd systemctl restart dhcpcd
systemctl restart networking systemctl restart networking

View file

@ -1,7 +1,10 @@
#!/bin/bash #!/bin/bash
cp -f /etc/hostapd/hostapd.conf.iiab /etc/hostapd/hostapd.conf
sed -i -e "s/#denyinterfaces*/denyinterfaces/" /etc/dhcpcd.conf sed -i -e "s/#denyinterfaces*/denyinterfaces/" /etc/dhcpcd.conf
systemctl enable hostapd systemctl enable hostapd
systemctl enable dhcpd
systemctl daemon-reload systemctl daemon-reload
systemctl restart dhcpcd systemctl restart dhcpcd
systemctl restart networking systemctl restart networking
systemctl start hostapd systemctl start hostapd
systemctl start dhcpd

View file

@ -7,6 +7,8 @@ auto br0
iface br0 inet manual iface br0 inet manual
{% if iiab_wired_lan_iface is defined %} {% if iiab_wired_lan_iface is defined %}
bridge_ports {{ iiab_wired_lan_iface }} bridge_ports {{ iiab_wired_lan_iface }}
{% else %}
bridge_ports none
{% endif %} {% endif %}
bridge_maxwait 0 bridge_maxwait 0
dns-nameservers 127.0.0.1 dns-nameservers 127.0.0.1

View file

@ -1,11 +1,15 @@
nextcloud_install: True nextcloud_install: True
nextcloud_enabled: False nextcloud_enabled: False
# REMOVE /opt/nextcloud/version.php TO FORCE AN INSTALL OR REINSTALL OR UPGRADE
nextcloud_force_install: False
nextcloud_url: /nextcloud nextcloud_url: /nextcloud
nextcloud_prefix: /opt nextcloud_prefix: /opt
nextcloud_data_dir: "{{ content_base }}/nextcloud/data" nextcloud_data_dir: "{{ content_base }}/nextcloud/data"
nextcloud_dl_url: https://download.nextcloud.com/server/releases/ nextcloud_dl_url: https://download.nextcloud.com/server/releases/
nextcloud_src_file: latest-12.tar.bz2 nextcloud_orig_src_file: latest-12.tar.bz2
nextcloud_src_file: nextcloud_{{ nextcloud_orig_src_file }}
# we install on mysql with these setting or those from default_vars, etc. # we install on mysql with these setting or those from default_vars, etc.
nextcloud_dbname: nextcloud nextcloud_dbname: nextcloud

View file

@ -1,31 +1,43 @@
# we need to install the rpm in order to get the dependencies - name: See if Nextcloud version page exists
# but we only need to do this the first time stat:
path: "{{ nextcloud_prefix }}/nextcloud/version.php"
- name: See if the Nextcloud startup page exists # path: "{{ nextcloud_prefix }}/nextcloud/index.php"
stat: path={{ nextcloud_prefix }}/nextcloud/index.php
register: nextcloud_page register: nextcloud_page
- name: FORCE INSTALL OR REINSTALL OR UPGRADE IF /opt/nextcloud/version.php DOESN'T EXIST
set_fact:
nextcloud_force_install: True
when: not nextcloud_page.stat.exists
# but we use the tar file to get the latest version # - debug:
# msg: "nextcloud_force_install: {{ nextcloud_force_install }}"
- name: Get the Nextcloud software
get_url: url={{ nextcloud_dl_url }}/{{ nextcloud_src_file }} dest={{ downloads_dir }}/{{ nextcloud_src_file }} - name: Download latest Nextcloud software to /opt/iiab/download/{{ nextcloud_src_file }}
when: internet_available get_url:
url: "{{ nextcloud_dl_url }}/{{ nextcloud_orig_src_file }}"
dest: "{{ downloads_dir }}/{{ nextcloud_src_file }}"
force: yes
when: internet_available and nextcloud_force_install
async: 900 async: 900
poll: 15 poll: 15
tags: tags:
- download - download
- name: Ubuntu and Debian treat names differently (Debian) - name: Ubuntu and Debian treat names differently (Debian)
package: name={{ item }} state=present package:
name: "{{ item }}"
state: present
with_items: with_items:
- libapache2-mod-php{{ php_version }} - "libapache2-mod-php{{ php_version }}"
- php{{ php_version }}-mbstring - "php{{ php_version }}-mbstring"
- php{{ php_version }}-zip - "php{{ php_version }}-zip"
when: is_debian when: is_debian
- name: Ubuntu and Debian treat names differently (Ubuntu) - name: Ubuntu and Debian treat names differently (Ubuntu)
package: name={{ item }} state=present package:
name: "{{ item }}"
state: present
with_items: with_items:
- libapache2-mod-php - libapache2-mod-php
- php-imagick - php-imagick
@ -34,18 +46,25 @@
when: is_ubuntu when: is_ubuntu
- name: Install list of packages (debuntu) - name: Install list of packages (debuntu)
package: name={{ item }} state=present package:
name: "{{ item }}"
state: present
with_items: with_items:
- php{{ php_version }}-gd - "php{{ php_version }}-gd"
- php{{ php_version }}-json - "php{{ php_version }}-json"
- php{{ php_version }}-mysql - "php{{ php_version }}-mysql"
- php{{ php_version }}-curl - "php{{ php_version }}-curl"
- php{{ php_version }}-intl - "php{{ php_version }}-intl"
- php{{ php_version }}-mcrypt - "php{{ php_version }}-mcrypt"
when: is_debuntu when: is_debuntu
# we need to install the rpm in order to get the dependencies
# but we only need to do this the first time
- name: Install list of packages (redhat) - name: Install list of packages (redhat)
package: name={{ item }} state=present package:
name: "{{ item }}"
state: present
with_items: with_items:
- php - php
- php-gd - php-gd
@ -59,52 +78,63 @@
when: is_redhat when: is_redhat
- name: Copy it to permanent location /opt (OS's other than Fedora 18) - name: Copy it to permanent location /opt (OS's other than Fedora 18)
unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }} unarchive:
dest={{ nextcloud_prefix }} src: "{{ downloads_dir }}/{{ nextcloud_src_file }}"
creates={{ nextcloud_prefix }}/nextcloud/version.php dest: "{{ nextcloud_prefix }}"
when: not is_F18 # creates: "{{ nextcloud_prefix }}/nextcloud/version.php"
when: not is_F18 and nextcloud_force_install
# ansible 1.4.1 does not have "creates" # Ansible 1.4.1 does not have "creates" (but hopefully has "when")
- name: Copy it to permanent location /opt (Fedora 18) - name: Copy it to permanent location /opt (Fedora 18)
unarchive: src={{ downloads_dir }}/{{ nextcloud_src_file }} unarchive:
dest={{ nextcloud_prefix }} src: "{{ downloads_dir }}/{{ nextcloud_src_file }}"
when: is_F18 dest: "{{ nextcloud_prefix }}"
when: is_F18 and nextcloud_force_install
- name: In CentOS, the following config dir is symlink to /etc/nextcloud - name: In CentOS, the following config dir is symlink to /etc/nextcloud
file: path=/etc/nextcloud file:
state=directory path: /etc/nextcloud
state: directory
when: is_centos when: is_centos
- name: Add autoconfig file (CentOS) - name: Add autoconfig file (CentOS)
template: src=autoconfig.php.j2 template:
dest={{ nextcloud_prefix }}/nextcloud/config/autoconfig.php src: autoconfig.php.j2
owner={{ apache_user }} dest: "{{ nextcloud_prefix }}/nextcloud/config/autoconfig.php"
group={{ apache_user }} owner: "{{ apache_user }}"
mode=0640 group: "{{ apache_user }}"
mode: 0640
when: is_centos when: is_centos
- name: Make Apache owner - name: Make Apache owner
file: path={{ nextcloud_prefix }}/nextcloud file:
owner={{ apache_user }} path: "{{ nextcloud_prefix }}/nextcloud"
group={{ apache_user }} owner: "{{ apache_user }}"
recurse=yes group: "{{ apache_user }}"
state=directory recurse: yes
state: directory
- name: Create data directory library - name: Create data directory library
file: path={{ item }} file:
mode=0750 path: "{{ item }}"
owner={{ apache_user }} owner: "{{ apache_user }}"
group={{ apache_user }} group: "{{ apache_user }}"
state=directory mode: 0750
state: directory
with_items: with_items:
- "{{ nextcloud_data_dir }}" - "{{ nextcloud_data_dir }}"
- name: Create a MySQL database for Nextcloud - name: Create a MySQL database for Nextcloud
mysql_db: name={{ nextcloud_dbname }} mysql_db:
name: "{{ nextcloud_dbname }}"
when: mysql_enabled and nextcloud_enabled when: mysql_enabled and nextcloud_enabled
- name: Create a user to access the Nextcloud database - name: Create a user to access the Nextcloud database
mysql_user: name={{ nextcloud_dbuser }} host={{ item }} password={{ nextcloud_dbpassword }} priv={{ nextcloud_dbname }}.*:ALL,GRANT mysql_user:
name: "{{ nextcloud_dbuser }}"
host: "{{ item }}"
password: "{{ nextcloud_dbpassword }}"
priv: "{{ nextcloud_dbname }}.*:ALL,GRANT"
with_items: with_items:
- "{{ nextcloud_dbhost }}" - "{{ nextcloud_dbhost }}"
- 127.0.0.1 - 127.0.0.1
@ -114,7 +144,10 @@
- name: Restart Apache, so it picks up the new aliases - name: Restart Apache, so it picks up the new aliases
service: name={{ apache_service }} state=restarted service:
name: "{{ apache_service }}"
state: restarted
# when: nextcloud_enabled # taken care of by nextcloud_enabled.yml below
when: not nextcloud_enabled when: not nextcloud_enabled
# Enable nextcloud by copying template to httpd config # Enable nextcloud by copying template to httpd config
@ -122,14 +155,15 @@
# following enables and disables # following enables and disables
- include_tasks: nextcloud_enabled.yml - include_tasks: nextcloud_enabled.yml
- name: Add 'nextcloud' to service list - name: Add 'nextcloud' to list of services at /etc/iiab/iiab.ini
ini_file: dest='{{ service_filelist }}' ini_file:
section=nextcloud dest: "{{ service_filelist }}"
option='{{ item.option }}' section: Nextcloud
value='{{ item.value }}' option: "{{ item.option }}"
value: "{{ item.value }}"
with_items: with_items:
- option: name - option: name
value: nextcloud value: Nextcloud
- option: description - option: description
value: '"NextCloud is a local server-based facility for sharing files, photos, contacts, calendars, etc."' value: '"NextCloud is a local server-based facility for sharing files, photos, contacts, calendars, etc."'
- option: path - option: path

View file

@ -102,14 +102,15 @@
when: not openvpn_enabled and not installing when: not openvpn_enabled and not installing
- name: Add OpenVPN to service list - name: Add 'openvpn' to list of services at /etc/iiab/iiab.ini
ini_file: dest='{{ service_filelist }}' ini_file:
section=openvpn dest: "{{ service_filelist }}"
option='{{ item.option }}' section: openvpn
value='{{ item.value }}' option: "{{ item.option }}"
value: "{{ item.value }}"
with_items: with_items:
- option: name - option: name
value: "openvpn" value: OpenVPN
- option: description - option: description
value: '"OpenVPN is a means of connecting to a server anywhere on the internet, via a middleman server."' value: '"OpenVPN is a means of connecting to a server anywhere on the internet, via a middleman server."'
- option: middleman_url - option: middleman_url

View file

@ -71,13 +71,13 @@
osm_path: "{{ osm_venv }}/lib/python2.7/site-packages/iiab" osm_path: "{{ osm_venv }}/lib/python2.7/site-packages/iiab"
when: osm_enabled and is_debuntu when: osm_enabled and is_debuntu
- name: All - Point wsgi to virtual environment - name: Point wsgi to virtual environment (all OS's)
lineinfile: dest={{ osm_venv }}/bin/iiab.wsgi lineinfile: dest={{ osm_venv }}/bin/iiab.wsgi
regexp="path_to_virtualenv = None" regexp="path_to_virtualenv = None"
line="path_to_virtualenv = '/usr/local/osm'" line="path_to_virtualenv = '/usr/local/osm'"
state=present state=present
- name: All - Copy OSM config file - name: Copy OSM config file (all OS's)
template: backup=no template: backup=no
src=osm.conf.j2 src=osm.conf.j2
dest=/etc/{{ apache_config_dir }}/osm.conf dest=/etc/{{ apache_config_dir }}/osm.conf
@ -86,28 +86,28 @@
mode=0644 mode=0644
when: osm_enabled when: osm_enabled
- name: Debuntu - Create a link from sites-enabled to sites-available - name: Create a link from sites-enabled to sites-available (debuntu)
file: src=/etc/{{ apache_config_dir }}/osm.conf file: src=/etc/{{ apache_config_dir }}/osm.conf
dest=/etc/apache2/sites-enabled/osm.conf dest=/etc/apache2/sites-enabled/osm.conf
state=link state=link
when: osm_enabled and is_debuntu when: osm_enabled and is_debuntu
- name: Debuntu - Remove the link from sites-enabled to sites-available - name: Remove the link from sites-enabled to sites-available (debuntu)
file: dest=/etc/apache2/sites-enabled/osm.conf file: dest=/etc/apache2/sites-enabled/osm.conf
state=absent state=absent
when: not osm_enabled and is_debuntu when: not osm_enabled and is_debuntu
- name: Redhat - Remove the osm.conf - name: Remove the osm.conf (redhat)
file: dest=/{{ apache_config_dir }}/osm.conf file: dest=/{{ apache_config_dir }}/osm.conf
state=absent state=absent
when: not osm_enabled and is_redhat when: not osm_enabled and is_redhat
- name: All - Remove link to cgi - name: Remove link to cgi (all OS's)
file: dest={{ doc_root }}/osm.wsgi file: dest={{ doc_root }}/osm.wsgi
state=absent state=absent
when: not osm_enabled when: not osm_enabled
- name: All - Create link to cgi - name: Create link to cgi (all OS's)
file: src={{ osm_venv }}/bin/iiab.wsgi file: src={{ osm_venv }}/bin/iiab.wsgi
dest={{ doc_root }}/osm.wsgi dest={{ doc_root }}/osm.wsgi
owner=root owner=root
@ -137,16 +137,18 @@
service: name={{ apache_service }} service: name={{ apache_service }}
state=restarted state=restarted
- name: Add OSM to service list - name: Add 'osm' to list of services at /etc/iiab/iiab.ini
ini_file: dest='{{ service_filelist }}' ini_file:
section=osm dest: "{{ service_filelist }}"
option='{{ item.option }}' section: osm
value='{{ item.value }}' option: "{{ item.option }}"
value: "{{ item.value }}"
with_items: with_items:
- option: name - option: name
value: Internet-in-a-Box value: OpenStreetMap
- option: description - option: description
value: '"The Internet-in-a-Box is a small, inexpensive device which provides essential Internet resources without any Internet connection. It provides a local copy of half a terabyte of the worlds Free information."' value: '"OpenStreetMap offers beautiful maps of the entire planet, continually created & updated by volunteers (much in the same way as Wikipedia) but for maps."'
# value: '"The Internet-in-a-Box is a small, inexpensive device which provides essential Internet resources without any Internet connection. It provides a local copy of half a terabyte of the worlds Free information."'
- option: path - option: path
value: /osm value: /osm
- option: enabled - option: enabled

View file

@ -1,4 +1,4 @@
phpmyadmin_install: False phpmyadmin_install: False
phpmyadmin_enabled: False phpmyadmin_enabled: False
phpmyadmin_name: "phpMyAdmin-4.7.5-all-languages" phpmyadmin_name: "phpMyAdmin-4.7.6-all-languages"
phpmyadmin_name_zip: "{{ phpmyadmin_name }}.zip" phpmyadmin_name_zip: "{{ phpmyadmin_name }}.zip"

View file

@ -64,7 +64,7 @@
state: absent state: absent
when: not phpmyadmin_enabled and is_debuntu when: not phpmyadmin_enabled and is_debuntu
- name: Add phpmyadmin to service list - name: Add 'phpmyadmin' to list of services at /etc/iiab/iiab.ini
ini_file: ini_file:
dest: "{{ service_filelist }}" dest: "{{ service_filelist }}"
section: phpmyadmin section: phpmyadmin

View file

@ -96,7 +96,7 @@
- { name: sugarizer } - { name: sugarizer }
when: not sugarizer_enabled when: not sugarizer_enabled
- name: Add 'sugarizer' to service list at /etc/iiab/iiab.ini - name: Add 'sugarizer' to list of services at /etc/iiab/iiab.ini
ini_file: ini_file:
dest: "{{ service_filelist }}" dest: "{{ service_filelist }}"
section: sugarizer section: sugarizer

View file

@ -1,16 +1,15 @@
# IF YOU NEED TO REINSTALL FROM /opt/iiab/downloads/wordpress.tar.gz # "Emergency" reinstalls (from /opt/iiab/downloads/wordpress.tar.gz
# TO /library/wordpress DURING YOUR NEXT RUN OF "./runtags wordpress" OR # to /library/wordpress) should also work offline...
# "./iiab-install" THEN YOU FIRST NEED TO:
# #
# - "mv /library/wordpress /library/wordpress.old" (MUST) # ONLINE OR OFFLINE, IF YOU NEED A CLEAN REINSTALL OF WORDPRESS DURING YOUR
# - back up then drop the database (RECOMMENDED) # NEXT RUN OF "./runtags wordpress" OR "./iiab-install" PLEASE FIRST DO:
#
# - "mv /library/wordpress /library/wordpress.old"
# - back up WordPress's database then drop it
# #
# REASON: "keep_newer: yes" below tries to preserves WordPress's self-upgrades # REASON: "keep_newer: yes" below tries to preserves WordPress's self-upgrades
# & security enhancements within /library/wordpress, that can occur without # and security enhancements using timestamps under /library/wordpress, as these
# warning when WordPress is online, since WordPress ~4.8 especially. # can arise without warning when WordPress is online, since WordPress ~4.8.
#
# Such "emergency" reinstalls from /opt/iiab/downloads/wordpress.tar.gz to
# /library/wordpress should also work offline.
- name: Download the latest WordPress software - name: Download the latest WordPress software
get_url: get_url:
@ -123,14 +122,15 @@
- name: Restart Apache, so it picks up the new aliases - name: Restart Apache, so it picks up the new aliases
service: name={{ apache_service }} state=restarted service: name={{ apache_service }} state=restarted
- name: Add 'wordpress' to service list - name: Add 'wordpress' to list of services at /etc/iiab/iiab.ini
ini_file: dest='{{ service_filelist }}' ini_file:
section=wordpress dest: "{{ service_filelist }}"
option='{{ item.option }}' section: wordpress
value='{{ item.value }}' option: "{{ item.option }}"
value: "{{ item.value }}"
with_items: with_items:
- option: name - option: name
value: wordpress value: WordPress
- option: description - option: description
value: '"WordPress is a blog and web site management application."' value: '"WordPress is a blog and web site management application."'
- option: wordpress_src - option: wordpress_src

View file

@ -69,6 +69,10 @@ host_wifi_mode: g
host_channel: 6 host_channel: 6
hostapd_secure: False hostapd_secure: False
hostapd_password: changeme hostapd_password: changeme
# For those installing IIAB over WiFi: "reboot_to_AP: True" makes the internal
# WiFi Access active after the next reboot. This is equivalent to manually
# running "iiab-hotspot-on". Note this variable only works with RPi's for now.
reboot_to_AP: False
# Gateway mode # Gateway mode
iiab_lan_enabled: True iiab_lan_enabled: True