diff --git a/README.md b/README.md index 6e75e8ffe..f753d407f 100644 --- a/README.md +++ b/README.md @@ -1,37 +1,49 @@ +*Sharing the World's Free Knowledge* + # Internet-in-a-Box (IIAB) -Welcome to the Git repository for Internet-in-a-Box (IIAB). Internet-in-a-Box (IIAB) is a small, inexpensive device which provides essential Internet resources (Wikipedia, OpenStreetMap, Khan Academy and others) without any Internet connection. +[Internet-in-a-Box (IIAB)](http://internet-in-a-box.org) is a "learning hotspot" that brings the Internet's crown jewels +(Wikipedia in any language, thousands of Khan Academy videos, zoomable OpenStreetMap, electronic books, WordPress journaling, Toys from Trash electronics projects, ETC) to those without Internet. -You are encouraged to customize this local content hotspot or server with the best of the world’s Free Knowledge — to suit your own region, your school, your medical clinic, your library and/or for your very own family. +You can build your own tiny, affordable server (an offline digital library) for your school, your medical clinic, your prison, your region and/or your very own family — accessible with any nearby smartphone, tablet or laptop. -FYI this community product is enabled by professional volunteers working side-by-side with schools, clinics and libraries around the world. Thank you for being a part of our grassroots technology movement! +Internet-in-a-Box gives you the DIY tools to: +1. Download then drag-and-drop to arrange the [very best of the World’s Free Knowledge](http://internet-in-a-box.org/#quality-content). +2. Choose among [30 powerful educational apps](http://wiki.laptop.org/go/IIAB/FAQ#What_services_.28IIAB_apps.29_are_suggested_during_installation.3F) for your school or learning/teaching community, optionally with a complete LMS (learning management system). +3. Exchange local/indigenous knowledge with nearby communities, using our [Manage Content](https://github.com/iiab/iiab-admin-console/blob/master/roles/console/files/help/InstContent.rst#manage-content) interface and possible mesh networking. + +FYI this [community product](https://en.wikipedia.org/wiki/Internet-in-a-Box) is enabled by professional volunteers working [side-by-side](http://wiki.laptop.org/go/IIAB/FAQ#What_are_the_best_places_for_community_support.3F) with schools, clinics and libraries around the world. *Thank you for being a part of our http://OFF.NETWORK grassroots technology [movement](https://meta.wikimedia.org/wiki/Internet-in-a-Box)!* ## Installation -Pre-releases of Internet-in-a-Box (IIAB) are available from http://download.iiab.io — click on the highest version number and then launch the 1-line installer. +Install Internet-in-a-Box (IIAB) from [download.iiab.io](http://download.iiab.io/) -Please see "What are the best places for community support?" at http://FAQ.IIAB.IO which has 40+ questions and answers to help you along the way, as you put together the digital knowledge hotspot most suitable for your own community. +Please see [FAQ.IIAB.IO](http://FAQ.IIAB.IO) which has 40+ questions and answers to help you along the way, as you put together the "local learning hotspot" most suitable for your own teaching/learning community. -The [Installation](https://github.com/iiab/iiab/wiki/IIAB-Installation) wiki page has more intricate details e.g. if you're trying to install Internet-in-a-Box (IIAB) on a [different platform](https://github.com/iiab/iiab/wiki/IIAB-Platforms) that has not yet been tried. +Our [HOW-TO videos](https://www.youtube.com/channel/UC0cBGCxr_WPBPa3IqPVEe3g) can be very helpful and the [Installation](https://github.com/iiab/iiab/wiki/IIAB-Installation) wiki page has more intricate details e.g. if you're trying to install Internet-in-a-Box (IIAB) onto a [different Linux](https://github.com/iiab/iiab/wiki/IIAB-Platforms) that has not yet been tried. -#### Built with Ansible +After you've installed the software, you should [add content](https://github.com/iiab/iiab/wiki/IIAB-Installation#add-content), which can of course take time when downloading multi-gigabyte Content Packs! -FYI we use [Ansible](http://wiki.laptop.org/go/IIAB/FAQ#What_is_Ansible_and_what_version_should_I_use.3F) as the underlying technology to install, deploy, configure and manage the various software components. +Finally, you can [customize your Internet-in-a-Box home page](http://wiki.laptop.org/go/IIAB/FAQ#How_do_I_customize_my_Internet-in-a-Box_home_page.3F) (typically http://box or http://box.lan) using our **drag-and-drop** Admin Console (http://box.lan/admin) — to arrange Content Packs and IIAB Apps (services) for your local community's needs. -## Contributing +## Community -We greatly welcome contributions from educators, librarians *and* IT/UX/QA people of all kinds! +Internet-in-a-Box (IIAB) greatly welcomes contributions from educators, librarians *and* IT/UX/QA people of all kinds! -Please see "How can I help?" at http://FAQ.IIAB.IO +Please see "[How can I help?](http://wiki.laptop.org/go/IIAB/FAQ#How_can_I_help.3F)" at: [FAQ.IIAB.IO](http://FAQ.IIAB.IO) -Check out our [Contributors Guide](https://github.com/iiab/iiab/wiki/IIAB-Contributors-Guide) to learn more about contributing directly to Internet-in-a-Box (IIAB) software and its open community architecture for education. +To learn about our software architecture, check out our [Contributors Guide](https://github.com/iiab/iiab/wiki/IIAB-Contributors-Guide). FYI we use [Ansible](http://wiki.laptop.org/go/IIAB/FAQ#What_is_Ansible_and_what_version_should_I_use.3F) to install, deploy, configure and manage the various software components. -*Thank you for helping us enable offline access to the Internet's open knowledge jewels, as well as "Sneakernet-of-Alexandria" distribution of local/indigenous content, when mass media channels do not serve grassroots voices.* +To learn more about our open community architecture for "offline" education, start by reviewing "[What technical documentation exists?](http://wiki.laptop.org/go/IIAB/FAQ#What_technical_documentation_exists.3F)" -## Versioning +*Thank you for helping us enable offline access to the Internet's free/open knowledge jewels, as well as "Sneakernet-of-Alexandria" distribution of local/indigenous content, when mass media channels do not serve grassroots voices.* -Pre-releases of Internet-in-a-Box (IIAB) are available from http://download.iiab.io — click on the highest version number and then launch the 1-line installer. +## Versions -You can also track the latest Internet-in-a-Box (IIAB) [official releases here](https://github.com/iiab/iiab/releases). +Pre-releases of Internet-in-a-Box (IIAB) undergo continuous QA / continuous deployment and are strongly recommended. -Finally older versions are also available, from [github.com/xsce](http://github.com/xsce) and [schoolserver.org](http://schoolserver.org). +Install our latest pre-release using the 1-line installer at: [download.iiab.io](http://download.iiab.io/) + +You can also consider the official releases at: [github.com/iiab/iiab/releases](https://github.com/iiab/iiab/releases) + +For older versions, see: [github.com/xsce](http://github.com/xsce), [schoolserver.org](http://schoolserver.org) diff --git a/ansible.cfg b/ansible.cfg index a2b8d84f7..5fff0c430 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -1,5 +1,6 @@ # Future overrides of /etc/ansible/ansible.cfg belong in this file. # Also used by https://github.com/iiab/iiab-admin-console -[defaults] -squash_actions = apk, apt, dnf, homebrew, openbsd_pkg, pacman, pkgng, yum, zypper, package +#[defaults] +# Disallowed by Ansible 2.11+ -- see https://docs.ansible.com/ansible/devel/porting_guides/porting_guide_2.7.html#using-a-loop-on-a-package-module-via-squash-actions +#squash_actions = apk, apt, dnf, homebrew, openbsd_pkg, pacman, pkgng, yum, zypper, package diff --git a/iiab-install b/iiab-install index c019d4a8b..6d38c5598 100755 --- a/iiab-install +++ b/iiab-install @@ -10,7 +10,7 @@ CWD=`pwd` OS=`grep ^ID= /etc/*release|cut -d= -f2` OS=${OS//\"/} MIN_RPI_KERN=4.9.59-v7+ -MIN_ANSIBLE_VER=2.6.5 +MIN_ANSIBLE_VER=2.6.14 if [ ! -f /etc/iiab/local_vars.yml ]; then @@ -30,19 +30,8 @@ if [ ! -f /etc/iiab/local_vars.yml ]; then echo -e "(2) MIN/MEDIUM/BIG samples are included in /opt/iiab/iiab/vars" >&2 echo -e "(3) NO TIME FOR DETAILS? RUN INTERNET-IN-A-BOX'S FRIENDLY 1-LINE INSTALLER:\n" >&2 - echo -e ' http://download.iiab.io (click on "6.6" or a more recent version!)\n' >&2 + echo -e ' http://download.iiab.io (click on "6.7" or a more recent version!)\n' >&2 - #case $OS in - # OLPC | fedora) - # echo -e "Please examine /opt/iiab/iiab/vars/local_vars_olpc.yml for XO laptops.\n" >&2 - # ;; - # centos | debian | ubuntu | raspbian) - # echo -e "Please consider /opt/iiab/iiab/vars/local_vars_medium.yml or similar.\n" >&2 - # ;; - # *) - # echo -e "EXITING: IIAB requires Raspbian, Debian, Ubuntu, CentOS or OLPC/Fedora.\n" >&2 - # ;; - #esac exit 1 fi @@ -74,7 +63,7 @@ fi # Subroutine compares software version numbers. Generates rare false positives # like "1.0 > 1" and "2.4.0 > 2.4". Avoid risks by structuring conditionals w/ # a consistent # of decimal points e.g. "if version_gt w.x.y.z a.b.c.d; then" -function version_gt() { [ "$(printf '%s\n' "$@" | sort -V | head -1)" != "$1" ]; } +version_gt() { [ "$(printf '%s\n' "$@" | sort -V | head -1)" != "$1" ]; } # Verify that Raspbian is running a recent enough kernel. As Raspbian # updates on 4.9.41-v7+ broke bridging, WiFi AP & OpenVPN in Oct/Nov 2017. diff --git a/roles/0-init/README.rst b/roles/0-init/README.rst new file mode 100644 index 000000000..acceaff33 --- /dev/null +++ b/roles/0-init/README.rst @@ -0,0 +1,9 @@ +============= +0-init README +============= + +For a higher-level view, please see `IIAB Installation `_ and http://FAQ.IIAB.IO + +This 0th stage literally sets the stage for Internet-in-a-Box (IIAB) installation, prior to Ansible running `Stages 1-to-9 <.>`_ and then the `network <../network>`_ stage. + +This serves to confirm low-level Ansible facts from the OS — e.g. for housekeeping tasks related to TZ (time zone), hostname, FQDN (fully-qualified domain name), unusual systemwide dependencies etc — and whether Internet is live so that IIAB installation can proceed. diff --git a/roles/0-init/defaults/main.yml b/roles/0-init/defaults/main.yml index ccdfd58e0..1c5ec2081 100644 --- a/roles/0-init/defaults/main.yml +++ b/roles/0-init/defaults/main.yml @@ -1,5 +1,5 @@ # Use these to tag a release at a point in time, for {{ iiab_env_file }} -iiab_base_ver: 6.7 +iiab_base_ver: 7.0 iiab_revision: 0 # These entries should never be changed in this file. diff --git a/roles/0-init/tasks/first_run.yml b/roles/0-init/tasks/first_run.yml index 0c3b01281..332da85b7 100644 --- a/roles/0-init/tasks/first_run.yml +++ b/roles/0-init/tasks/first_run.yml @@ -1,5 +1,2 @@ -- name: Create the directory structure for IIAB - include_tasks: fl.yml - -- name: Write iiab_ini.yml for the first time +- name: Create {{ iiab_ini_file }} include_tasks: iiab_ini.yml diff --git a/roles/0-init/tasks/hostname.yml b/roles/0-init/tasks/hostname.yml index 56c8e8e9b..289b5a66e 100644 --- a/roles/0-init/tasks/hostname.yml +++ b/roles/0-init/tasks/hostname.yml @@ -1,21 +1,21 @@ -- name: Is ubuntu-18 server +- name: Does /etc/cloud/cloud.cfg exist i.e. is this ubuntu-18 server? stat: path: /etc/cloud/cloud.cfg register: U18_server -- name: Edit cloud.cfg yaml +- name: 'Put "preserve_hostname: true" in /etc/cloud/cloud.cfg (ubuntu-18 server)' lineinfile: - dest: /etc/cloud/cloud.cfg + path: /etc/cloud/cloud.cfg regexp: '^preserve_hostname*' line: 'preserve_hostname: true' state: present when: U18_server is defined and U18_server.stat.exists -- name: Turn the crank for systemd (debuntu) +- name: 'Turn the crank for systemd: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}" (debuntu)' shell: hostnamectl set-hostname "{{ iiab_hostname }}.{{ iiab_domain }}" when: is_debuntu -- name: Configure /etc/sysconfig/network (redhat) +- name: Install /etc/sysconfig/network from template (redhat) template: src: roles/network/templates/network/sysconfig.network.j2 dest: /etc/sysconfig/network @@ -24,9 +24,9 @@ mode: 0644 when: is_redhat -- name: Configure short hostname in /etc/hosts +- name: Put hostnames "127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}" in /etc/hosts lineinfile: - dest: /etc/hosts + path: /etc/hosts regexp: '^127\.0\.0\.1' line: '127.0.0.1 localhost.localdomain localhost box {{ iiab_hostname }}' owner: root diff --git a/roles/0-init/tasks/iiab_ini.yml b/roles/0-init/tasks/iiab_ini.yml index dcd7b06a3..346eab369 100644 --- a/roles/0-init/tasks/iiab_ini.yml +++ b/roles/0-init/tasks/iiab_ini.yml @@ -1,12 +1,12 @@ # workaround for fact that auto create does not work on iiab_ini_file (/etc/iiab/iiab.ini) - name: Create {{ iiab_ini_file }} file: - dest: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" state: touch -- name: Add location section to config file +- name: Add 'location' variable values to {{ iiab_ini_file }} ini_file: - dest: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" section: location option: "{{ item.option }}" value: "{{ item.value }}" @@ -18,7 +18,7 @@ - name: Add 'version' variable values to {{ iiab_ini_file }} ini_file: - dest: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" section: version option: "{{ item.option }}" value: "{{ item.value }}" diff --git a/roles/0-init/tasks/main.yml b/roles/0-init/tasks/main.yml index d4903c189..a16a68a29 100644 --- a/roles/0-init/tasks/main.yml +++ b/roles/0-init/tasks/main.yml @@ -5,14 +5,14 @@ path: "{{ iiab_env_file }}" register: NewInstall -- name: Setting first run flag +- name: Set first_run flag set_fact: first_run: True when: not NewInstall.stat.exists # We need to inialize the ini file and only write the location and version # sections once and only once to preserve the install date and git hash. -- name: Write iiab_ini.yml for the first time +- name: Create IIAB directory structure and {{ iiab_ini_file }}, if first_run include_tasks: first_run.yml when: first_run @@ -36,30 +36,30 @@ # nobridge: True when: ansible_local.local_facts.os == "raspbian" -- name: Set exFAT enabled for XO laptops +- name: Set exFAT_enabled if xo_model != "none" set_fact: exFAT_enabled: True when: xo_model != "none" # Discover: do we have a gateway? # If Ansible detects gateway, becomes WAN candidate. -- name: Finding gateway +- name: "Do we have a gateway? If so set discovered_wan_iface: {{ ansible_default_ipv4.alias }}, iiab_wan_iface: {{ discovered_wan_iface }}" set_fact: discovered_wan_iface: "{{ ansible_default_ipv4.alias }}" iiab_wan_iface: "{{ discovered_wan_iface }}" when: ansible_default_ipv4.gateway is defined -- name: Verify gateway present +- name: "Verify gateway active: ping -c4 {{ ansible_default_ipv4.gateway }}" shell: ping -c4 "{{ ansible_default_ipv4.gateway }}" | grep icmp_seq=4 | wc -l when: discovered_wan_iface != "none" register: gw_active_test -- name: Recording gateway response +- name: If so, set gw_active set_fact: gw_active: True when: discovered_wan_iface != "none" and gw_active_test.stdout == "1" -- name: Test for Internet access +- name: Test for Internet access ({{ iiab_download_url }}/heart-beat.txt) get_url: url: "{{ iiab_download_url }}/heart-beat.txt" dest: /tmp/heart-beat.txt @@ -70,12 +70,12 @@ # poll: 2 register: internet_access_test -- name: Set internet_available true if wget succeeded +- name: Set internet_available if download succeeded and not disregard_network set_fact: internet_available: True when: not internet_access_test.failed and not disregard_network -- name: Remove Internet test file +- name: Remove downloaded Internet test file /tmp/heart-beat.txt file: path: /tmp/heart-beat.txt state: absent @@ -84,17 +84,17 @@ - name: If the TZ is not set in env, set it to UTC include_tasks: tz.yml -- name: Set port 80 for Admin Console +- name: Set port 80 for Admin Console if not adm_cons_force_ssl set_fact: gui_port: 80 when: not adm_cons_force_ssl -- name: Set port 443 for Admin Console +- name: Set port 443 for Admin Console if adm_cons_force_ssl set_fact: gui_port: 443 when: adm_cons_force_ssl -- name: Require MySQL to be on (mandatory in Stage 3!) +- name: Turn on both vars for MySQL (mandatory in Stage 3!) set_fact: mysql_install: True mysql_enabled: True @@ -102,19 +102,21 @@ # We decided to enable mysql unconditionally. # when: elgg_enabled or rachel_enabled or owncloud_enabled or phpmyadmin_enabled or wordpress_enabled or iiab_menu_install -# Late 2017: Had commented out MongoDB on a trial basis, for a more basic/lightweight Sugarizer, per https://github.com/iiab/iiab/pull/427 -- name: Turn on vars for MongoDB if Sugarizer enabled - set_fact: - mongodb_install: True - mongodb_enabled: True - when: sugarizer_enabled +# MongoDB is auto-included by Sugarizer as of Feb 2019, thanks to: roles/sugarizer/meta/main.yml +# +## Late 2017: Had commented out MongoDB on a trial basis, for a more basic/lightweight Sugarizer, per https://github.com/iiab/iiab/pull/427 +#- name: Turn on both vars for MongoDB if sugarizer_enabled +# set_fact: +# mongodb_install: True +# mongodb_enabled: True +# when: sugarizer_enabled # There might be other db's -- name: Turn on vars for PostgreSQL if Moodle or Pathagar enabled +- name: Turn on both vars for PostgreSQL if moodle_enabled or pathagar_enabled set_fact: postgresql_install: True postgresql_enabled: True - when: moodle_enabled or (pathagar is defined and pathagar_enabled) + when: moodle_enabled or (pathagar_enabled is defined and pathagar_enabled) #- name: Turn on vars for Docker if SchoolTool is to be installed # set_fact: @@ -122,12 +124,12 @@ # docker_enabled: True # when: schooltool_enabled or schooltool_install -- name: Set python_path (redhat) +- name: "Set python_path: /lib/python2.7/site-packages/ (redhat)" set_fact: python_path: /lib/python2.7/site-packages/ when: is_redhat -- name: Set python_path (debuntu) +- name: "Set python_path: /usr/local/lib/python2.7/dist-packages/ (debuntu)" set_fact: python_path: /usr/local/lib/python2.7/dist-packages/ when: is_debuntu @@ -135,28 +137,31 @@ # For various reasons the mysql service cannot be enabled on Fedora 20, but # 'mariadb', which is its real name can. On Fedora 18 we need to use 'mysqld'. -- name: Set mysql_service to mariadb by default - set_fact: - mysql_service: mariadb +# BETTER TO USE /opt/iiab/iiab/vars/.yml +#- name: "Set mysql_service: mariadb by default" +# set_fact: +# mysql_service: mariadb -- name: Set mysql_service to mysqld etc (Fedora 18) +- name: "Set mysql_service: mysqld etc (Fedora 18)" set_fact: - mysql_service: mysqld + # BETTER TO USE /opt/iiab/iiab/vars/.yml + #mysql_service: mysqld no_NM_reload: True is_F18: True when: (ansible_distribution_release == "based on Fedora 18" or ansible_distribution_version == "18") and ansible_distribution == "Fedora" -- name: Set mysql_service to mysql (debuntu) - set_fact: - mysql_service: mysql - when: is_debuntu +# BETTER TO USE /opt/iiab/iiab/vars/.yml +#- name: "Set mysql_service: mysql (debuntu)" +# set_fact: +# mysql_service: mysql +# when: is_debuntu -- name: Set FQDN +- name: "Set iiab_fqdn: {{ iiab_hostname }}.{{ iiab_domain }}" set_fact: iiab_fqdn: "{{ iiab_hostname }}.{{ iiab_domain }}" FQDN_changed: False -- name: FQDN changed +- name: Set FQDN_changed when iiab_fqdn != ansible_fqdn ({{ ansible_fqdn }}) set_fact: FQDN_changed: True when: iiab_fqdn != ansible_fqdn @@ -206,6 +211,10 @@ value: "{{ first_run }}" - option: local_tz value: "{{ local_tz }}" + - option: no_NM_reload + value: "{{ no_NM_reload }}" + - option: is_F18 + value: "{{ is_F18 }}" - option: FQDN_changed value: "{{ FQDN_changed }}" diff --git a/roles/1-prep/files/iiab.conf b/roles/1-prep/files/iiab.conf new file mode 100644 index 000000000..8bde843fb --- /dev/null +++ b/roles/1-prep/files/iiab.conf @@ -0,0 +1,3 @@ +d /var/log/apache2 1750 www-data www-data +d /var/log/munin 1755 munin adm +d /var/log/mongodb 1755 mongodb root diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index 40dabc96d..418510c90 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -3,40 +3,65 @@ - name: ...IS BEGINNING ============================================ command: echo -- name: Install uuidgen program (debuntu) +- name: Install uuid-runtime package (debuntu) package: - name: uuid-runtime + name: + - uuid-runtime + - sudo state: present when: is_debuntu -- name: Test for /etc/iiab/uuid file +- name: Does /etc/iiab/uuid file exist? stat: path: /etc/iiab/uuid register: uuid_file -- name: Create folder to hold uuid - file: - path: /etc/iiab - state: directory - when: not uuid_file.stat.exists - - name: If no uuid exists, create one shell: uuidgen register: uuid_response when: not uuid_file.stat.exists -- name: Put the uuid in place +- name: Put uuid in place at /etc/iiab/uuid shell: echo {{ uuid_response.stdout_lines[0] }} > /etc/iiab/uuid when: not uuid_file.stat.exists -- name: Get the uuid +- name: Grab the uuid from /etc/iiab/uuid, into register stored_uuid command: cat /etc/iiab/uuid register: stored_uuid -- name: Get the value into a variable +- name: Place the uuid from register into variable/fact "uuid" set_fact: uuid: "{{ stored_uuid.stdout_lines[0] }}" +#- name: Does directory /ro exist? (indicating OS is Ubermix) +# stat: +# path: /ro +# register: ro_dir + +#- debug: +# var: ro_dir + +- name: Does 'ubermix' exist in /etc/lsb-release? + shell: grep -i ubermix /etc/lsb-release # Pipe to cat to avoid red errors? + register: grep_ubermix + failed_when: false # Universal way to hide alarmist red errors! + #ignore_errors: true + #check_mode: no + +#- debug: +# var: grep_ubermix + +- name: If so, install /etc/tmpfiles.d/iiab.conf to create /var/log subdirs on each boot, so {Apache, MongoDB, Munin} run on Ubermix + copy: + src: roles/1-prep/files/iiab.conf + dest: /etc/tmpfiles.d/ + owner: root + group: root + mode: 0644 + force: yes + when: grep_ubermix.rc == 0 # 1 if absent in file, 2 if file doesn't exist + #when: ro_dir.stat.exists + - name: SSHD include_role: name: sshd @@ -56,21 +81,19 @@ tags: openvpn # for rpi, without rtc, we need time as soon as possible -- name: Install chrony package +- name: Install chrony (an NTP package) especially for RPi's lacking RTC package: - name: "{{ item }}" + name: chrony state: present - with_items: - - chrony tags: - download #TODO: Use regexp filter instead of hard-code ip -- name: Update chrony config file +- name: Install /etc/chrony.conf from template template: - backup: no - dest: /etc/chrony.conf src: chrony.conf.j2 + dest: /etc/chrony.conf + backup: no - name: Disable AppArmor -- override OS default (ubuntu) service: @@ -95,12 +118,12 @@ - include_tasks: raspberry_pi.yml when: first_run and rpi_model != "none" -- name: Check if the identifier for Intel's NUC6 builtin WiFi is present +- name: Check if the identifier for Intel's NUC6 built-in WiFi is present shell: "lsusb | grep 8087:0a2b | wc | awk '{print $1}'" register: usb_NUC6 ignore_errors: true -- name: Download the firmware for built-in WiFi on NUC6 +- name: Download {{ iiab_download_url }}/iwlwifi-8000C-13.ucode to /lib/firmware for built-in WiFi on NUC6 # iiab_download_url is http://download.iiab.io/packages get_url: url: "{{ iiab_download_url }}/iwlwifi-8000C-13.ucode" dest: /lib/firmware diff --git a/roles/1-prep/tasks/raspberry_pi.yml b/roles/1-prep/tasks/raspberry_pi.yml index ccaafff24..564228a95 100644 --- a/roles/1-prep/tasks/raspberry_pi.yml +++ b/roles/1-prep/tasks/raspberry_pi.yml @@ -1,6 +1,6 @@ -# Setup specific to the Raspberry Pi +# Specific to Raspberry Pi -- name: Add a udev rule to transfer hwclock to system clock at dev creation +- name: Install udev rule /etc/udev/rules.d/92-rtc-i2c.rules from template, to transfer hwclock to system clock at dev creation, if rtc_id is defined and rtc_id != "none" template: src: 92-rtc-i2c.rules dest: /etc/udev/rules.d/92-rtc-i2c.rules @@ -10,42 +10,43 @@ when: rtc_id is defined and rtc_id != "none" # RTC requires a change to the device tree (and reboot) -- name: Check for needing to enable i2c rtc device in config.txt +- name: Enable i2c-rtc device (with "dtoverlay=i2c-rtc,{{ rtc_id }}=on" in /boot/config.txt, requires reboot!) if rtc_id is defined and rtc_id != "none" lineinfile: - dest: /boot/config.txt + path: /boot/config.txt line: "dtoverlay=i2c-rtc,{{ rtc_id }}=on" state: present - register: rpiconfig - when: rtc_id != "none" + register: rpiconfig # HMMM REGISTER "rpiconfig" IS *COMPLETELY UNUSED* AS OF 2018-11-02 + when: rtc_id is defined and rtc_id != "none" -- name: Add a udev rule to transfer hwclock to system clock at dev creation - template: - src: 92-rtc-i2c.rules - dest: /etc/udev/rules.d/92-rtc-i2c.rules - owner: root - group: root - mode: 0644 - when: rtc_id != "none" +#- name: Install udev rule /etc/udev/rules.d/92-rtc-i2c.rules from template, to transfer hwclock to system clock at dev creation, if rtc_id != "none" +# template: +# src: 92-rtc-i2c.rules +# dest: /etc/udev/rules.d/92-rtc-i2c.rules +# owner: root +# group: root +# mode: 0644 +# when: rtc_id != "none" -- name: Pre-install packages +- name: Install latest ntp package package: - name: "{{ item }}" + name: ntp state: latest - with_items: - - ntp -- name: Increase the swap file size, as kalite pip download fails (debuntu) +- name: Increase swap file size (to CONF_SWAPSIZE=500 in /etc/dphys-swapfile) as kalite pip download fails (debuntu) lineinfile: + path: /etc/dphys-swapfile regexp: "^CONF_SWAPSIZE" line: CONF_SWAPSIZE=500 - dest: /etc/dphys-swapfile when: is_debuntu -- name: Restart the swap service (debuntu) - command: /etc/init.d/dphys-swapfile restart +- name: Restart swap service "dphys-swapfile" (debuntu) + #command: /etc/init.d/dphys-swapfile restart + service: # A rare/legacy service that is NOT systemd + name: dphys-swapfile + state: restarted when: is_debuntu -- name: Add RPi rootfs resizing service +- name: Install RPi rootfs resizing (iiab-rpi-max-rootfs.sh) and its systemd service (iiab-rpi-root-resize.service), from templates template: src: "{{ item.src }}" dest: "{{ item.dest }}" @@ -56,7 +57,7 @@ - { src: 'iiab-rpi-max-rootfs.sh', dest: '/usr/sbin/iiab-rpi-max-rootfs.sh', mode: '0755'} - { src: 'iiab-rpi-root-resize.service', dest: '/etc/systemd/system/iiab-rpi-root-resize.service', mode: '0644'} -- name: Enable rootfs resizing service - service: +- name: Enable RPi rootfs resizing (systemd service iiab-rpi-root-resize.service) + systemd: name: iiab-rpi-root-resize enabled: yes diff --git a/roles/0-init/tasks/fl.yml b/roles/2-common/tasks/fl.yml similarity index 76% rename from roles/0-init/tasks/fl.yml rename to roles/2-common/tasks/fl.yml index f8d93144c..157c2b5a9 100644 --- a/roles/0-init/tasks/fl.yml +++ b/roles/2-common/tasks/fl.yml @@ -1,4 +1,6 @@ -- name: Create various library directories +# fl.yml signifies "file layout" + +- name: Create 19 directories with ownership root:root and permissions 0755 (1 in /etc, 3 in {{ iiab_base }} and 15 in /library) # iiab_base is /opt/iiab file: path: "{{ item }}" owner: root @@ -6,7 +8,7 @@ mode: 0755 state: directory with_items: - - /etc/iiab + - /etc/sysconfig/olpc-scripts/setup.d/installed/ - "{{ yum_packages_dir }}" - "{{ pip_packages_dir }}" - "{{ downloads_dir }}" @@ -25,10 +27,8 @@ - "{{ doc_root }}/common/images" - "{{ doc_root }}/common/assets" - "{{ doc_root }}/common/services" - - /etc/sysconfig/olpc-scripts/ - - /etc/sysconfig/olpc-scripts/setup.d/installed/ -- name: Create symlink from webfonts to fonts +- name: Symlink from {{ doc_root }}/common/webfonts to {{ doc_root }}/common/fonts file: src: "{{ doc_root }}/common/fonts" path: "{{ doc_root }}/common/webfonts" diff --git a/roles/2-common/tasks/iiab-startup.yml b/roles/2-common/tasks/iiab-startup.yml index 8509bba5b..65ac2f695 100644 --- a/roles/2-common/tasks/iiab-startup.yml +++ b/roles/2-common/tasks/iiab-startup.yml @@ -3,20 +3,20 @@ path: /usr/libexec/iiab-startup.sh register: startup_script -- name: Copy template script to /usr/libexec/iiab-startup.sh +- name: If not, install /usr/libexec/iiab-startup.sh from template template: src: iiab-startup.sh dest: /usr/libexec/ mode: 0755 when: not startup_script.stat.exists -- name: Copy iiab-startup.service to {{ systemd_location }} +- name: Install {{ systemd_location }}/iiab-startup.service from template template: src: iiab-startup.service dest: "{{ systemd_location }}" when: not startup_script.stat.exists -- name: Enable & restart the systemd service after daemon-reload +- name: Enable & restart systemd service (iiab-startup) after daemon-reload # shell: systemctl daemon-reload # shell: systemctl restart iiab-startup.service # shell: systemctl enable iiab-startup.service diff --git a/roles/2-common/tasks/iptables.yml b/roles/2-common/tasks/iptables.yml index d84900650..02db8ee97 100644 --- a/roles/2-common/tasks/iptables.yml +++ b/roles/2-common/tasks/iptables.yml @@ -4,12 +4,13 @@ enabled: no when: not is_debuntu -- name: Use larger hammer to disable firewalld -- 2 symbolic links involved (OS's other than debuntu) - shell: "systemctl disable firewalld.service" +# Likely no longer nec as of 2019 +- name: Use larger hammer -- systemctl disable firewalld -- 2 symbolic links involved (OS's other than debuntu) + shell: systemctl disable firewalld.service when: not is_debuntu - name: Mask firewalld service (OS's other than debuntu) - shell: 'systemctl mask firewalld' + shell: systemctl mask firewalld ignore_errors: yes when: not installing and not is_debuntu @@ -20,17 +21,17 @@ ignore_errors: yes when: not installing and not is_debuntu -- name: Remove iptables.service file from /etc +- name: Remove /etc/systemd/system/iptables.service file: path: /etc/systemd/system/iptables.service state: absent -- name: Remove iptables-xs.service file from /etc - file: - path: /etc/systemd/system/iptables-xs.service - state: absent +#- name: Remove iptables-xs.service file from /etc +# file: +# path: /etc/systemd/system/iptables-xs.service +# state: absent -- name: Install iptables service package (debuntu) +- name: Install package iptables-persistent (debuntu) package: name: iptables-persistent state: present @@ -38,7 +39,7 @@ tags: - download -- name: Install iptables service package (OS's other than debuntu) +- name: Install package iptables-services (OS's other than debuntu) package: name: iptables-services state: present @@ -46,17 +47,15 @@ tags: - download -- name: Install iptables services +- name: Install /etc/sysconfig/iptables-config from template template: - src: "{{ item.0 }}" - dest: "{{ item.1 }}" + src: iptables-config + dest: /etc/sysconfig/iptables-config owner: root group: root - mode: "{{ item.2 }}" - with_items: - - { 0: 'iptables-config', 1: '/etc/sysconfig/iptables-config', 2: '0644' } + mode: 0644 -- name: Install Debian config (debuntu) +- name: Install /etc/network/if-pre-up.d/iptables from template (debuntu) template: src: iptables dest: /etc/network/if-pre-up.d/iptables diff --git a/roles/2-common/tasks/main.yml b/roles/2-common/tasks/main.yml index 48a072231..a361c6918 100644 --- a/roles/2-common/tasks/main.yml +++ b/roles/2-common/tasks/main.yml @@ -3,6 +3,9 @@ - name: ...IS BEGINNING ========================================== command: echo +- name: Create IIAB directory structure ("file layout") + include_tasks: fl.yml + - include_tasks: centos.yml when: ansible_distribution == "CentOS" @@ -72,7 +75,7 @@ value: 1 state: present -- name: Install custom profile file +- name: Install custom /etc/profile.d/zzz_iiab.sh from template template: dest: /etc/profile.d/zzz_iiab.sh src: zzz_iiab.sh diff --git a/roles/2-common/tasks/packages.yml b/roles/2-common/tasks/packages.yml index 31284dc9c..348fa0524 100644 --- a/roles/2-common/tasks/packages.yml +++ b/roles/2-common/tasks/packages.yml @@ -1,124 +1,73 @@ -- name: Install yum packages (redhat) +- name: "Install 10 yum/dnf packages: avahi, avahi-tools, createrepo, linux-firmware, nss-mdns, openssl, syslog, wpa_supplicant, xml-common, yum-utils (redhat)" package: - name: "{{ item }}" + name: + - avahi + - avahi-tools + - createrepo + - linux-firmware + - nss-mdns + - openssl # FC 18 does not supply, but pear requires + - syslog + - wpa_supplicant + - xml-common + - yum-utils state: present - with_items: - - yum-utils - - createrepo - - wpa_supplicant - - linux-firmware - - syslog - - xml-common - - nss-mdns - - avahi - - avahi-tools when: is_redhat -- name: Download & install usbmount, missing from Debian Stretch (debian-9) +- name: Install {{ iiab_download_url }}/usbmount_0.0.14.1_all.deb, missing from Debian (debian-9 or debian-10, if NOT rpi) apt: deb: "{{ iiab_download_url }}/usbmount_0.0.14.1_all.deb" #timeout: "{{ download_timeout }}" # Ansible's apt module doesn't support timeout parameter; that's ok as usbmount_0.0.14.1_all.deb is only 10KB - when: internet_available and is_debian_9 + when: internet_available and (is_debian_9 or is_debian_10) and not is_rpi -#- name: Download usbmount -- not in Debian Stretch (debian-9) -# get_url: -# url: "{{ iiab_download_url }}/usbmount_0.0.14.1_all.deb" -# dest: "{{ downloads_dir }}" -# timeout: "{{ download_timeout }}" -# when: internet_available and is_debian_9 -# -#- name: Install usbmount (debian-9) -# command: apt install -y {{ downloads_dir }}/usbmount_0.0.14.1_all.deb -# when: is_debian_9 - -- name: Install packages (debuntu) +- name: "Install 7 deb/apt packages: avahi-daemon, avahi-discover, exfat-fuse, exfat-utils, inetutils-syslogd, libnss-mdns, wpasupplicant (debuntu)" package: - name: "{{ item }}" + name: + - avahi-daemon + - avahi-discover + - exfat-fuse + - exfat-utils + - inetutils-syslogd + - libnss-mdns + - wpasupplicant state: present - with_items: - - inetutils-syslogd - - wpasupplicant - - libnss-mdns - - avahi-daemon - - avahi-discover - - exfat-fuse - - exfat-utils when: is_debuntu -- name: Install common packages +- name: "Install 22 common packages: acpid, bridge-utils, bzip2, curl, gawk, hostapd, htop, i2c-tools, logrotate, make, mlocate, netmask, net-tools, ntfs-3g, pandoc, rsync, sudo, tar, unzip, usbmount, usbutils, wget" package: - name: "{{ item }}" + name: + - acpid + - bridge-utils + - bzip2 + - curl + #- etckeeper # "nobody is really using etckeeper and it's bloating the filesystem every time apt runs" per @jvonau at https://github.com/iiab/iiab/issues/1146 + - gawk + - hostapd + - htop + - i2c-tools + - logrotate + #- lynx # already installed by 1-prep's roles/iiab-admin/tasks/access.yml + - make + - mlocate + - netmask + - net-tools + - ntfs-3g + #- openssh-server # ssh (Raspbian) or openssh-server (other OS's) already installed by 1-prep's roles/sshd/tasks/main.yml + - pandoc + - rsync + - sudo + - tar + - unzip + - usbmount + - usbutils + - wget state: present - with_items: - - acpid - - mlocate - - rsync - - htop - #- etckeeper # "nobody is really using etckeeper and it's bloating the filesystem every time apt runs" per @jvonau at https://github.com/iiab/iiab/issues/1146 - - python-passlib - - usbmount - - net-tools - - openssh-server - - sudo - - logrotate - - make - - tar - - unzip - - bzip2 - - i2c-tools - - bridge-utils - - netmask - - usbutils - - hostapd - - wget - - openssl # FC 18 does not supply, but pear requires - - gawk - - curl - - pandoc - - lynx - - ntfs-3g -#- name: Install pip as a commonly required package management system -# command: curl https://bootstrap.pypa.io/get-pip.py -o {{ downloads_dir }}/get-pip.py - -#- name: Run the install script for pip -# command: python {{ downloads_dir }}/get-pip.py - -- name: Install common Python packages +- name: "Install 4 common Python packages: python-passlib, python-pip, python-setuptools, python-virtualenv" package: - name: "{{ item }}" + name: + - python-passlib + - python-pip + - python-setuptools + - python-virtualenv state: present - with_items: - - python-pip - - python-setuptools - - python-virtualenv - -# instructions state to start with a fully updated system before starting, stop using -# ansible as a crutch for developers not following the directions and taking short-cuts - -#- name: Update common packages (not Debian) -# package: name={{ item }} -# state=latest -# with_items: -# - NetworkManager -# - glibc # CVE-2015-7547 -# - bash -# - iptables -# when: is_redhat - -# Consensus decision to try to slim down https://github.com/iiab/iiab/issues/518 (per 2017-11-20 community/team call @ http://minutes.iiab.io) -#- name: Update common packages (debuntu) -# package: name={{ item }} -# state=latest -# with_items: -# - libc6 -# - bash -# - iptables -# when: is_debuntu - -#- name: If version of Network manager has changed, subsequent nmcli commands will fail,restart now -# service: name=NetworkManager -# state=restarted -# when: not installing -# the above should use a handler - all reboots should wait until all -# mods are preformed diff --git a/roles/3-base-server/tasks/main.yml b/roles/3-base-server/tasks/main.yml index 5d07b28af..6f43f84a2 100644 --- a/roles/3-base-server/tasks/main.yml +++ b/roles/3-base-server/tasks/main.yml @@ -15,12 +15,17 @@ # has no "when: XXXXX_install" flag tags: base, mysql -- name: Restart httpd - service: +- name: Restart Apache systemd service ({{ apache_service }}) + systemd: name: "{{ apache_service }}" state: restarted when: not installing +- name: Create a Python interface to iiab.env + template: + src: roles/1-prep/templates/iiab_env.py.j2 + dest: /etc/iiab/iiab_env.py + - name: Recording STAGE 3 HAS COMPLETED ===================== lineinfile: dest: "{{ iiab_env_file }}" diff --git a/roles/4-server-options/tasks/main.yml b/roles/4-server-options/tasks/main.yml index 5b70af543..4c56b0572 100644 --- a/roles/4-server-options/tasks/main.yml +++ b/roles/4-server-options/tasks/main.yml @@ -3,26 +3,34 @@ - name: ...IS BEGINNING ================================== command: echo -- name: Installing dnsmasq +- name: Install dnsmasq include_tasks: roles/network/tasks/dnsmasq.yml when: dnsmasq_install tags: base, domain, dnsmasq, network -- name: Installing named +- 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 tags: base, dhcpd, network, domain -- name: Installing Squid +- name: Install Squid (and DansGuardian if dansguardian_install) include_tasks: roles/network/tasks/squid.yml when: squid_install tags: base, squid, network, domain +# NETWORK moved to the very end, after Stage 9 (9-LOCAL-ADDONS) +# It can also be run manually using: cd /opt/iiab/iiab; ./iiab-network +# #- name: NETWORK # include_role: # name: network @@ -42,10 +50,11 @@ when: postgresql_install tags: postgresql, pathagar, moodle +# UNMAINTAINED - name: AUTHSERVER include_role: name: authserver - when: authserver_install + when: authserver_install is defined and authserver_install tags: olpc, authserver - name: CUPS @@ -66,13 +75,7 @@ when: usb_lib_install tags: usb-lib -# MANDATORY SO PERHAPS THIS BELONGS IN 3-BASE-SERVER ? -- name: Create a Python interface to iiab.env - template: - src: roles/1-prep/templates/iiab_env.py.j2 - dest: /etc/iiab/iiab_env.py - -- name: Run /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation (script was installed at the beginning of Stage 3 = roles/3-base-server/tasks/main.yml, which runs the HTTPD playbook = roles/httpd/tasks/main.yml) +- name: Run /usr/bin/iiab-refresh-wiki-docs (scraper script) to create http://box/info offline documentation. (This script was installed at the beginning of Stage 3 = roles/3-base-server/tasks/main.yml, which ran Apache playbook = roles/httpd/tasks/main.yml) command: /usr/bin/iiab-refresh-wiki-docs when: not nodocs diff --git a/roles/6-generic-apps/tasks/main.yml b/roles/6-generic-apps/tasks/main.yml index f9573ec69..4fcd4d494 100644 --- a/roles/6-generic-apps/tasks/main.yml +++ b/roles/6-generic-apps/tasks/main.yml @@ -27,6 +27,24 @@ when: ejabberd_install tags: ejabberd +- name: LOKOLE + include_role: + name: lokole + when: lokole_install + tags: lokole + +- name: MOSQUITTO + include_role: + name: mosquitto + when: mosquitto_install + tags: mosquitto + +- name: NODE-RED + include_role: + name: nodered + when: nodered_install + tags: nodered + - name: NEXTCLOUD include_role: name: nextcloud @@ -39,6 +57,12 @@ # when: owncloud_install # tags: owncloud +- name: PBX + include_role: + name: pbx + when: pbx_install + tags: pbx + - name: WORDPRESS include_role: name: wordpress diff --git a/roles/7-edu-apps/tasks/main.yml b/roles/7-edu-apps/tasks/main.yml index 04b2ed8c6..d3b9e264b 100644 --- a/roles/7-edu-apps/tasks/main.yml +++ b/roles/7-edu-apps/tasks/main.yml @@ -27,12 +27,14 @@ when: moodle_install tags: olpc, moodle +# UNMAINTAINED - name: OSM include_role: name: osm when: osm_install is defined and osm_install tags: osm +# UNMAINTAINED - name: PATHAGAR include_role: name: pathagar diff --git a/roles/8-mgmt-tools/tasks/main.yml b/roles/8-mgmt-tools/tasks/main.yml index 14766ddd2..f0522a44a 100644 --- a/roles/8-mgmt-tools/tasks/main.yml +++ b/roles/8-mgmt-tools/tasks/main.yml @@ -33,12 +33,14 @@ when: phpmyadmin_install tags: phpmyadmin +# UNMAINTAINED - name: SUGAR-STATS include_role: name: sugar-stats when: sugar_stats_install is defined and sugar_stats_install and ansible_distribution != "CentOS" tags: olpc, sugar-stats +# UNMAINTAINED - name: TEAMVIEWER include_role: name: teamviewer @@ -51,6 +53,7 @@ when: vnstat_install tags: vnstat +# UNMAINTAINED - name: XOVIS include_role: name: xovis diff --git a/roles/9-local-addons/tasks/main.yml b/roles/9-local-addons/tasks/main.yml index 674245bc6..fa65a7f2f 100644 --- a/roles/9-local-addons/tasks/main.yml +++ b/roles/9-local-addons/tasks/main.yml @@ -15,6 +15,12 @@ when: calibreweb_install tags: calibre-web +- name: MINETEST + include_role: + name: minetest + when: minetest_install + tags: minetest + - name: Recording STAGE 9 HAS COMPLETED ==================== lineinfile: dest: "{{ iiab_env_file }}" diff --git a/roles/activity-server/tasks/main.yml b/roles/activity-server/tasks/main.yml index 8be5c0805..b0593a613 100644 --- a/roles/activity-server/tasks/main.yml +++ b/roles/activity-server/tasks/main.yml @@ -116,11 +116,12 @@ enabled=yes state=restarted -- name: add xs-activity-server to service list - ini_file: dest='{{ iiab_ini_file }}' - section=activity-server - option='{{ item.option }}' - value='{{ item.value }}' +- name: Add 'activity-server' variable values to {{ iiab_ini_file }} + ini_file: + path: "{{ iiab_ini_file }}" + section: activity-server + option: "{{ item.option }}" + value: "{{ item.value }}" with_items: - option: name value: "Activity Server" diff --git a/roles/ajenti/tasks/main.yml b/roles/ajenti/tasks/main.yml index 045403d93..e5a03096a 100644 --- a/roles/ajenti/tasks/main.yml +++ b/roles/ajenti/tasks/main.yml @@ -47,11 +47,12 @@ state=restarted when: ajenti_enabled -- name: Add ajenti to service list - ini_file: dest='{{ iiab_ini_file }}' - section=ajenti - option='{{ item.option }}' - value='{{ item.value }}' +- name: Add 'ajenti' variable values to {{ iiab_ini_file }} + ini_file: + path: "{{ iiab_ini_file }}" + section: ajenti + option: "{{ item.option }}" + value: "{{ item.value }}" with_items: - option: name value: ajenti diff --git a/roles/authserver/tasks/main.yml b/roles/authserver/tasks/main.yml index 817068d0f..00ec12408 100644 --- a/roles/authserver/tasks/main.yml +++ b/roles/authserver/tasks/main.yml @@ -50,18 +50,19 @@ enabled=yes when: authserver_enabled -- name: add xs-authserver to service list - ini_file: dest='{{ iiab_ini_file }}' - section=xs-authserver - option='{{ item.option }}' - value='{{ item.value }}' +- name: Add 'authserver' variable values to {{ iiab_ini_file }} + ini_file: + path: "{{ iiab_ini_file }}" + section: authserver + option: "{{ item.option }}" + value: "{{ item.value }}" with_items: - option: name value: XS-authserver - option: description - value: '"xs-authserver implements a seamless web authentication service - using XO laptop registration capabilities. It is heavily inspired - by the Moodle OLPC-XS authentication plugin"' + value: '"authserver (xs-authserver) implements a seamless web authentication + service using XO laptop registration capabilities. It is heavily + inspired by the Moodle OLPC-XS authentication plugin"' - option: port value: 5000 - option: path diff --git a/roles/awstats/tasks/install.yml b/roles/awstats/tasks/install.yml index 8c0312fae..8109a5453 100644 --- a/roles/awstats/tasks/install.yml +++ b/roles/awstats/tasks/install.yml @@ -1,21 +1,19 @@ -- name: Install AWStats package +- name: 'Install 3 packages: awstats, openssl, pwauth' package: - name: "{{ item }}" + name: + - awstats + - pwauth + - openssl state: present - with_items: - - awstats - - pwauth - - openssl tags: - download -- name: Install AWStats package (debuntu) +- name: 'Install 2 packages: apache2-utils, libapache2-mod-authnz-external (debuntu)' package: - name: "{{ item }}" + name: + - libapache2-mod-authnz-external + - apache2-utils state: present - with_items: - - libapache2-mod-authnz-external - - apache2-utils when: is_debuntu tags: - download @@ -24,7 +22,7 @@ command: a2enmod cgi when: is_debuntu -- name: Create directory for AWStats to use as intermediate summary storage +- name: 'Mandate {{ apache_user }}:{{ apache_user }} perm 0750 dirs: {{ awstats_data_dir }} (intermediate summary storage) & {{ apache_log_dir }}' # /library/awstats & /var/log/apache2 typically file: path: "{{ item }}" mode: 0750 @@ -37,7 +35,7 @@ - "{{ awstats_data_dir }}" - "{{ apache_log_dir }}" -- name: Install the Apache config for AWStats (debuntu) +- name: Install Apache's awstats.conf from template (debuntu) template: src: apache.conf dest: "/etc/{{ apache_config_dir }}/awstats.conf" @@ -46,7 +44,7 @@ mode: 0644 when: awstats_enabled and is_debuntu -- name: Install the Apache config for AWStats (OS's other than debuntu) +- name: Install Apache's awstats.conf from template (OS's other than debuntu) template: src: apache-awstats.conf dest: "/etc/{{ apache_config_dir }}/awstats.conf" @@ -55,35 +53,41 @@ mode: 0644 when: awstats_enabled and not is_debuntu -- name: Make sure logrotate does not make logs unreadable (debuntu) +- name: Ensure logrotate doesn't make logs unreadable (debuntu) template: src: logrotate.d.apache2 dest: /etc/logrotate.d/apache2 when: is_debuntu -- name: See if AWStats package installed a config file +- name: Check if package installed /etc/awstats/awstats.conf stat: path: /etc/awstats/awstats.conf register: awstats -- name: If there was a config file installed by package, move it aside +- name: If so, move it aside to /etc/awstats/awstats.conf.dist command: mv /etc/awstats/awstats.conf /etc/awstats/awstats.conf.dist when: awstats.stat.islnk is defined and not awstats.stat.islnk -- name: Enable AWStats (debuntu) +- name: Create symlink awstats.conf from sites-enabled to sites-available (debuntu) file: src: /etc/apache2/sites-available/awstats.conf path: /etc/apache2/sites-enabled/awstats.conf state: link when: awstats_enabled and is_debuntu -- name: Disable AWStats (debuntu) +- name: Remove symlink from sites-enabled, to disable AWStats (debuntu) file: path: /etc/apache2/sites-enabled/awstats.conf state: absent when: not awstats_enabled and is_debuntu + +- name: Restart Apache service ({{ apache_service }}) + systemd: + name: "{{ apache_service }}" + state: restarted -- name: Install the AWStats config + +- name: Install /etc/awstats/awstats.schoolserver.conf template: src: awstats.schoolserver.conf.j2 dest: /etc/awstats/awstats.schoolserver.conf @@ -92,10 +96,10 @@ mode: 0644 when: awstats_enabled -- name: Create a symbolic link to use when access is by IP address +- name: Create a symlink /etc/awstats/awstats.conf for access by IP address file: src: /etc/awstats/awstats.schoolserver.conf - dest: /etc/awstats/awstats.conf + path: /etc/awstats/awstats.conf state: link when: awstats_enabled diff --git a/roles/awstats/tasks/main.yml b/roles/awstats/tasks/main.yml index eba3828b0..212fef1ca 100644 --- a/roles/awstats/tasks/main.yml +++ b/roles/awstats/tasks/main.yml @@ -1,9 +1,10 @@ -- include_tasks: install.yml +- name: Install AWStats if awstats_install + include_tasks: install.yml when: awstats_install -- name: Add 'awstats' to list of services at {{ iiab_ini_file }} +- name: Add 'awstats' variable values to {{ iiab_ini_file }} ini_file: - dest: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" section: awstats option: "{{ item.option }}" value: "{{ item.value }}" diff --git a/roles/calibre-web/README.rst b/roles/calibre-web/README.rst index 72f9f8451..1270f8029 100644 --- a/roles/calibre-web/README.rst +++ b/roles/calibre-web/README.rst @@ -74,6 +74,8 @@ See also:: /library/calibre-web/metadata_db_prefs_backup.json +See the official docs on Calibre-Web's `Runtime Configuration Options `_. + Back Up Everything ------------------ diff --git a/roles/calibre-web/defaults/main.yml b/roles/calibre-web/defaults/main.yml index fc8ebd242..8ad670c08 100644 --- a/roles/calibre-web/defaults/main.yml +++ b/roles/calibre-web/defaults/main.yml @@ -5,7 +5,7 @@ calibreweb_install: False calibreweb_enabled: False -calibreweb_port: 8083 +calibreweb_port: 8083 # PORT VARIABLE HAS NO EFFECT (as of January 2019) calibreweb_url: /books calibreweb_venv_path: /usr/local/calibre-web calibreweb_exec_path: "{{ calibreweb_venv_path }}/cps.py" diff --git a/roles/calibre-web/tasks/main.yml b/roles/calibre-web/tasks/main.yml index 0347aef79..8af95c611 100644 --- a/roles/calibre-web/tasks/main.yml +++ b/roles/calibre-web/tasks/main.yml @@ -1,4 +1,4 @@ -- name: Create Calibre-Web folders to store data and configuration files +- name: Create 3 Calibre-Web folders to store data and configuration files file: path: "{{ item }}" owner: "{{ calibreweb_user }}" @@ -11,7 +11,7 @@ - "{{ calibreweb_config }}" ## TODO: Calibre-web future release might get into pypi https://github.com/janeczku/calibre-web/issues/456 -- name: Download Calibre-Web github repository +- name: Download Calibre-Web github repository to {{ calibreweb_venv_path }} git: repo: https://github.com/janeczku/calibre-web.git dest: "{{ calibreweb_venv_path }}" @@ -30,29 +30,29 @@ # ignore_errors: True ## # Implementing this with Ansible command module for now. -- name: Download Calibre-Web dependencies into virtual environment +- name: Download Calibre-Web dependencies (using pip) into virtual environment pip: requirements: "{{ calibreweb_venv_path }}/requirements.txt" virtualenv: "{{ calibreweb_venv_path }}" virtualenv_site_packages: no when: internet_available -- name: Symlink 'vendor' to site-packages for python to keep cps.py happy +- name: Symlink {{ calibreweb_venv_path }}/vendor to {{ calibreweb_venv_path }}/lib/python2.7/site-packages to keep cps.py happy file: - state: link src: "{{ calibreweb_venv_path }}/lib/python2.7/site-packages" dest: "{{ calibreweb_venv_path }}/vendor" + state: link -- name: Create Calibre-Web systemd service unit file and calibre-web.conf for Apache +- name: Install unit file /etc/systemd/system/calibre-web.service & /etc/apache2/sites-available/calibre-web.conf for http://box{{ calibreweb_url }}, from templates template: src: "{{ item.src }}" dest: "{{ item.dest }}" - mode: "{{ item.mode }}" - owner: "{{ calibreweb_user }}" - group: "{{ apache_user }}" + owner: root + group: root + mode: 0644 with_items: - - { src: 'calibre-web.service.j2', dest: '/etc/systemd/system/calibre-web.service', mode: '0644' } - - { src: 'calibre-web.conf.j2', dest: '/etc/apache2/sites-available/calibre-web.conf', mode: '0644' } + - { src: 'calibre-web.service.j2', dest: '/etc/systemd/system/calibre-web.service' } + - { src: 'calibre-web.conf.j2', dest: '/etc/apache2/sites-available/calibre-web.conf' } - name: Does /library/calibre-web/metadata.db exist? stat: @@ -73,7 +73,7 @@ when: not metadatadb.stat.exists #when: calibreweb_provision -- name: Provision/Copy default admin settings to /library/calibre-web/config/app.db IF metadata.db did not exist +- name: Provision/Copy default admin settings to {{ calibreweb_config }}/app.db IF metadata.db did not exist # {{ calibreweb_config }} is /library/calibre-web/config copy: src: roles/calibre-web/files/app.db dest: "{{ calibreweb_config }}" @@ -84,7 +84,7 @@ when: not metadatadb.stat.exists #when: calibreweb_provision -- name: Enable and restart 'calibre-web' service +- name: Enable & Restart 'calibre-web' systemd service systemd: name: calibre-web daemon_reload: yes @@ -101,7 +101,7 @@ # command: apachectl -k graceful # when: calibreweb_enabled -- name: Disable 'calibre-web' service +- name: Disable 'calibre-web' systemd service systemd: name: calibre-web daemon_reload: yes @@ -117,14 +117,14 @@ # command: apachectl -k graceful # when: not calibreweb_enabled -- name: Restart Apache +- name: Restart Apache systemd service ({{ apache_service }}) systemd: name: "{{ apache_service }}" # httpd or apache2 state: restarted -- name: Add 'calibre-web' to list of services at {{ iiab_ini_file }} +- name: Add 'calibre-web' variable values to {{ iiab_ini_file }} ini_file: - dest: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" section: calibre-web option: "{{ item.option }}" value: "{{ item.value }}" diff --git a/roles/calibre-web/templates/calibre-web.conf.j2 b/roles/calibre-web/templates/calibre-web.conf.j2 index 052cc66ce..85db95f10 100644 --- a/roles/calibre-web/templates/calibre-web.conf.j2 +++ b/roles/calibre-web/templates/calibre-web.conf.j2 @@ -11,7 +11,9 @@ RequestHeader set X-SCHEME http ProxyPass {{ calibreweb_url }} http://localhost:{{ calibreweb_port }}/ -# Appears unnec: +# Possibly unnec? (ProxyPassReverse rewrites internal links, that come back +# from Apache proxy. Whereas e.g. kiwix.conf doesn't need this, as kiwix itself +# prefixes URLs, thanks to --urlRootLocation=/kiwix/ in its systemd file.) ProxyPassReverse {{ calibreweb_url }} http://localhost:{{ calibreweb_port }}/ # diff --git a/roles/calibre/defaults/main.yml b/roles/calibre/defaults/main.yml index 2881fc284..44ed043e6 100644 --- a/roles/calibre/defaults/main.yml +++ b/roles/calibre/defaults/main.yml @@ -21,20 +21,10 @@ calibre_src_url: "https://raw.githubusercontent.com/kovidgoyal/calibre/master/se calibre_deb_url: "{{ iiab_download_url }}" # http://download.iiab.io/packages # Above URL must offer both .deb files below: (for scripts/calibre-install-pinned-rpi.sh to run) -calibre_deb_pin_version: 3.31.0+dfsg-1 # for calibre-bin_3.31.0+dfsg-1_armhf.deb (747K, 2018-09-12) -calibre_bin_deb_pin_version: "{{ calibre_deb_pin_version }}" # for calibre-bin_3.31.0+dfsg-1+b1_armhf.deb (24M, 2018-09-07) -#calibre_deb_pin_version: 3.32.0+dfsg-1 # for calibre_3.32.0+dfsg-1_all.deb (25M, 2018-09-28) -##calibre_bin_deb_pin_version: "{{ calibre_deb_pin_version }}" # for calibre-bin_3.32.0+dfsg-1_armhf.deb (707K, 2018-10-08) HAD WORKED 2018-10-08 BUT NO LONGER on 2018-10-10: -## The following packages have unmet dependencies: -## calibre-bin : Depends: libpodofo0.9.5 (>= 0.9.5-7) but it is not installable -## E: Unable to correct problems, you have held broken packages. -#calibre_bin_deb_pin_version: 3.32.0+dfsg-1+b1 # for calibre-bin_3.32.0+dfsg-1+b1_armhf.deb (706K, 2018-10-08) FAILED ON 2018-10-08 (ERROR ABOVE), MYSTERIOUSLY WORKED ON 2018-10-10, FAILED ON 2018-10-12 -- THIS LATEST ERROR MIGHT RELATE TO SAMBA AND/OR THE NEW RASPBIAN 2018-10-09: -# The following packages have unmet dependencies: -# pkg-config : Depends: libdpkg-perl but it is not going to be installed -# samba : Depends: update-inetd but it is not going to be installed -# E: Unmet dependencies. Try 'apt --fix-broken install' with no packages (or specify a solution). +calibre_deb_pin_version: 3.33.1+dfsg-1 # for calibre_3.33.1+dfsg-1_all.deb (24M, 2018-10-21) +calibre_bin_deb_pin_version: "{{ calibre_deb_pin_version }}" # for calibre-bin_3.33.1+dfsg-1_armhf.deb (706K, 2018-10-23) -# USE TO TEST debs.yml (RASPBIAN APPROACH!) ON DEBIAN 9.X: (now handled by calibre_via_debs in /opt/iiab/iiab/vars/*) +# USE TO TEST debs.yml (RASPBIAN APPROACH!) ON DEBIAN 9.X: (now handled by calibre_via_debs in each /opt/iiab/iiab/vars/.yml) #calibre_debs_on_debian: True # Enable unstable .deb's, not just testing .deb's: (moved to /etc/iiab/local_vars.yml & /opt/iiab/iiab/vars/default_vars.yml) #calibre_unstable_debs: False diff --git a/roles/calibre/tasks/debs.yml b/roles/calibre/tasks/debs.yml index 6638bd29a..81fd8cf16 100644 --- a/roles/calibre/tasks/debs.yml +++ b/roles/calibre/tasks/debs.yml @@ -1,54 +1,48 @@ -# roles/calibre/tasks/main.yml requires calibre_via_debs (to be True) before calling this script. +# roles/calibre/tasks/main.yml requires calibre_via_debs (to be True) before +# calling this script. As of 2018-10-23 this is set in only 3 places: +# +# vars/raspbian-9.yml +# vars/raspbian-8.yml +# vars/debian-10.yml -# MOVED UP TO roles/calibre/tasks/main.yml -#- name: Start by installing OS's Calibre package -# package: -# name: "{{ item }}" -# state: latest -# with_items: -# - calibre -# - calibre-bin -# when: internet_available +# If you want the latest Calibre, run the appropriate script below, standalone. +# HOWEVER: it's strongly suggested you wait for apt (blessed by your OS!) to +# avoid ongoing dependency problems, as Calibre frequently demands the very +# latest/unstable dependencies. -# April/May 2018: Raspbian .deb's for the latest Calibre now appear -# (http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/) -# within about 10 days of Calibre's quasi-monthly releases -# (https://calibre-ebook.com/whats-new). - -# If you want the latest Calibre, run the appropriate below script, standalone. -# HOWEVER: it's strongly suggested you wait for apt (blessed by your OS!) +# FYI Raspbian .deb's for the latest Calibre can be downloaded from either: +# http://raspbian.raspberrypi.org/raspbian/pool/main/c/calibre/ +# http://archive.raspbian.org/raspbian/pool/main/c/calibre/ +# ...within about 10 days after Calibre's quasi-monthly releases at: +# https://calibre-ebook.com/whats-new #- name: Install packages that Raspbian .deb's had installed for Calibre 3.23 (rpi) -# #command: scripts/calibre-install-latest-rpi.sh # FAILS with Calibre 3.24+ ("calibre : Depends: python-pyqt5 (>= 5.10.1+dfsg-2) but 5.10.1+dfsg-1+rpi1 is to be installed") since June 2018. -# command: scripts/calibre-install-packages.sh # BORROWED package list from /var/log/apt/history.log (that resulted from 2018-05-22 install of Calibre 3.23 using calibre-install-latest-rpi.sh). +# command: scripts/calibre-install-packages.sh # BORROWED package list from /var/log/apt/history.log (that resulted from 2018-05-22 install of Calibre 3.23 using calibre-install-latest-rpi.sh). # when: is_rpi and internet_available #- name: Upgrade to latest Calibre using Debian's own .deb's from testing (rpi) -# command: scripts/calibre-install-latest.sh # NECESSARY since Calibre 3.24 (BEWARE installing libc6 will prevent boot in RPi Zero W, i.e. if calibre-install-packages.sh isn't run above!) +# command: scripts/calibre-install-latest.sh # WAS NEC with Calibre 3.24+ & Calibre 3.29 on 2018-08-21 (PR #1015), as all above strategies failed (only script that was not attempted: Sid-like calibre-install-unstable.sh). CLARIF: RESULTING microSD's ARE NOT BOOTABLE IN Zero W (#952) due to libc6 or similar.e.g. if calibre-install-packages.sh isn't run above? +# #command: scripts/calibre-install-latest-rpi-plus.sh # WORKED for Calibre 3.27.1 on 2018-07-22 (#948 -> PR #950) THO NOT BOOTABLE IN Zero W (#952). Similar to Calibre 3.24.x & 3.25 in June 2018, which had used calibre-install-packages.sh then Debian's own calibre-install-latest.sh # when: is_rpi and internet_available -#- name: Upgrade to latest Calibre using .deb's from testing (rpi) -# #command: scripts/calibre-install-latest-rpi-plus.sh # WORKS for Calibre 3.27.1 on 2018-07-22 (#948 -> PR #950) THO NOT BOOTABLE IN Zero W (#952). Similar to Calibre 3.24.x & 3.25 in June 2018, which had used calibre-install-packages.sh then Debian's own calibre-install-latest.sh -# #command: scripts/calibre-install-latest-rpi.sh # WORKS for Calibre 3.28 on 2018-07-26 (PR #971). Likewise for Calibre 3.26.x -# command: scripts/calibre-install-latest.sh # REQUIRED for Calibre 3.29 on 2018-08-21 (PR #1015), as all above strategies failed (only script that was not attempted: Sid-like calibre-install-unstable.sh). CLARIF: RESULTING microSD's ARE NOT BOOTABLE IN Zero W (#952) +- name: Upgrade to latest Calibre using .deb's from testing (rpi) + command: scripts/calibre-install-latest-rpi.sh # WORKED for Calibre 3.33.1 on 2018-10-23. And Calibre 3.28 on 2018-07-26 (PR #971). Likewise for Calibre 3.26.x. FAILED with Calibre 3.24+ ("calibre : Depends: python-pyqt5 (>= 5.10.1+dfsg-2) but 5.10.1+dfsg-1+rpi1 is to be installed") since June 2018. + when: is_rpi and internet_available + +#- name: Download PINNED version {{ calibre_deb_pin_version }} of calibre & calibre-bin (rpi) +# get_url: +# url: "{{ calibre_deb_url }}/{{ item }}" +# dest: "{{ downloads_dir }}/{{ item }}" +# mode: 0644 +# timeout: "{{ download_timeout }}" +# with_items: +# - calibre_{{ calibre_deb_pin_version }}_all.deb +# - calibre-bin_{{ calibre_bin_deb_pin_version }}_armhf.deb +# when: is_rpi and internet_available +# +#- name: Install/Upgrade both, to PINNED version {{ calibre_deb_pin_version }} using additional .deb's from testing (rpi) +# command: scripts/calibre-install-pinned-rpi.sh # Worked for Calibre 3.33.1 on 2018-10-23, e.g. so IIAB microSD bootable in RPi Zero W # when: is_rpi and internet_available - -- name: Download PINNED version {{ calibre_deb_pin_version }} of calibre & calibre-bin (rpi) - get_url: - url: "{{ calibre_deb_url }}/{{ item }}" - dest: "{{ downloads_dir }}/{{ item }}" - mode: 0644 - #force: no - #backup: no - timeout: "{{ download_timeout }}" - with_items: - - calibre_{{ calibre_deb_pin_version }}_all.deb - - calibre-bin_{{ calibre_bin_deb_pin_version }}_armhf.deb - when: is_rpi and internet_available - -- name: Install/Upgrade both, to PINNED version {{ calibre_deb_pin_version }} while using additional .deb's from testing (rpi) - command: scripts/calibre-install-pinned-rpi.sh # RECOMMENDED for Calibre 3.30 on 2018-08-30, so IIAB microSD will be bootable in RPi Zero W - when: is_rpi and internet_available - name: Install/Upgrade to Calibre testing .deb's - target Ubuntu 16.04 (not rpi and not ubuntu_18) command: scripts/calibre-install-latest.sh diff --git a/roles/calibre/tasks/main.yml b/roles/calibre/tasks/main.yml index 48e5ff470..86a3d5afa 100644 --- a/roles/calibre/tasks/main.yml +++ b/roles/calibre/tasks/main.yml @@ -1,17 +1,16 @@ # 1. INSTALL THE LATEST CALIBRE 3.X+ (calibre, calibredb, calibre-server etc) ON ALL OS'S -- name: Check if /usr/bin/calibre exists +- name: Does /usr/bin/calibre exist? stat: path: "/usr/bin/calibre" register: calib_executable -- name: Install Calibre via OS's package installer (IF /usr/bin/calibre MISSING) +- name: "Install OS's latest packages: calibre, calibre-bin (IF not rpi AND /usr/bin/calibre MISSING)" package: - name: "{{ item }}" + name: + - calibre + - calibre-bin state: latest - with_items: - - calibre - - calibre-bin when: internet_available and not is_rpi and (not calib_executable.stat.exists) - name: Install Calibre .debs IF calibre_via_debs (AND /usr/bin/calibre WAS MISSING) @@ -40,7 +39,7 @@ group: root mode: "{{ item.mode }}" backup: no -# register: calibre_config + #register: calibre_config with_items: - { src: 'calibre-serve.service.j2', dest: '/etc/systemd/system/calibre-serve.service', mode: '0644'} - { src: 'calibre.conf', dest: '/etc/{{ apache_config_dir }}', mode: '0644'} @@ -50,24 +49,23 @@ systemd: daemon_reload: yes when: (not calib_executable.stat.exists) -# when: calibre_config.changed + #when: calibre_config.changed -# 2. STOP CALIBRE SERVICE IF IT EXISTS (REQUIRED FOR DB ACTIVITY...AND IF not calibre_enabled) +# 2. STOP CALIBRE SERVICE (REQUIRED FOR DB ACTIVITY...AND IF not calibre_enabled) #- name: Check if Calibre systemd service exists # stat: # path: /etc/systemd/system/calibre-serve.service # register: calibre_svc -- name: Stop Calibre service -- calibre-server by Kovid Goyal -# systemd: - service: +- name: Stop service 'calibre-serve' (/usr/bin/calibre-server by Kovid Goyal) + systemd: name: calibre-serve state: stopped #enabled: no -# register: command_result # gist.github.com/tyrells/0a79681de339237cb04c -# failed_when: false # Never Fail during "systemctl stop calibre-serve" (even if service doesn't exist!) -# when: calibre_svc.stat.exists + #register: command_result # gist.github.com/tyrells/0a79681de339237cb04c + #failed_when: false # Never Fail during "systemctl stop calibre-serve" (even if service doesn't exist!) + #when: calibre_svc.stat.exists # 3. CREATE USER DATABASE @@ -88,7 +86,7 @@ # 4. CREATE CONTENT DATABASE WITH A SAMPLE BOOK (REQUIRED AS OF CALIBRE 3.x) -- name: Check if /library/calibre/metadata.db exists +- name: Does /library/calibre/metadata.db exist? stat: path: "{{ calibre_dbpath }}/metadata.db" register: calibre_db @@ -105,20 +103,20 @@ # https://github.com/iiab/iiab/tree/master/roles/calibre-web/templates/calibre-web.conf.j2 # (anyway this works great for calibre-web, allowing http://box/books # to work even better than http://box:8083 when box == 192.168.0.x !) -- name: Create calibre.conf link for UNTESTED http://box/calibre etc (debuntu) +- name: Create symlink calibre.conf from sites-enabled to sites-available, for UNTESTED http://box/calibre etc (debuntu) file: src: /etc/apache2/sites-available/calibre.conf dest: /etc/apache2/sites-enabled/calibre.conf state: link when: calibre_enabled and is_debuntu -- name: Remove calibre.conf link if disabled (debuntu) +- name: Remove symlink /etc/apache2/sites-enabled/calibre.conf (debuntu) file: dest: /etc/apache2/sites-enabled/calibre.conf state: absent when: (not calibre_enabled) and is_debuntu -- name: Enable Calibre service -- runs calibre-server by Kovid Goyal +- name: Enable & Start service 'calibre-serve' (/usr/bin/calibre-server by Kovid Goyal) service: name: calibre-serve enabled: yes @@ -127,14 +125,14 @@ #async: 900 #poll: 5 -- name: Forcing apache to reread configs - service: +- name: Reload Apache service ({{ apache_service }}) + systemd: name: "{{ apache_service }}" state: reloaded -- name: Add 'calibre' to list of services at {{ iiab_ini_file }} +- name: Add 'calibre' variable values to {{ iiab_ini_file }} ini_file: - dest: "{{ iiab_ini_file }}" + path: "{{ iiab_ini_file }}" section: calibre option: "{{ item.option }}" value: "{{ item.value }}" @@ -149,5 +147,5 @@ value: "{{ calibre_dbpath }}" - option: port value: "{{ calibre_port }}" - - option: enabled + - option: calibre_enabled value: "{{ calibre_enabled }}" diff --git a/roles/captive-portal/defaults/main.yml b/roles/captive-portal/defaults/main.yml new file mode 100644 index 000000000..fab470665 --- /dev/null +++ b/roles/captive-portal/defaults/main.yml @@ -0,0 +1 @@ +captive_portal_port: 9090 diff --git a/roles/network/files/mac.template b/roles/captive-portal/files/mac.template similarity index 94% rename from roles/network/files/mac.template rename to roles/captive-portal/files/mac.template index c430d1958..6d4bca5e3 100644 --- a/roles/network/files/mac.template +++ b/roles/captive-portal/files/mac.template @@ -48,7 +48,7 @@





- {{ btn1 }} + {{ btn1 }} diff --git a/roles/network/files/simple.template b/roles/captive-portal/files/simple.template similarity index 97% rename from roles/network/files/simple.template rename to roles/captive-portal/files/simple.template index ec140a058..a04eba488 100644 --- a/roles/network/files/simple.template +++ b/roles/captive-portal/files/simple.template @@ -69,7 +69,7 @@