1
0
Fork 0
mirror of https://github.com/iiab/iiab.git synced 2025-02-13 11:42:08 +00:00
iiab/roles/1-prep/tasks/main.yml

139 lines
4.4 KiB
YAML
Raw Normal View History

2017-10-27 03:48:02 +00:00
# Preparations (Hardware Level)
2017-10-27 03:46:57 +00:00
2017-10-30 20:29:49 +00:00
- name: ...IS BEGINNING ============================================
2017-10-27 03:46:57 +00:00
command: echo
- name: dnsmasq (install now, configure LATER in 'network', after Stage 9)
include_tasks: roles/network/tasks/dnsmasq.yml
2020-05-10 18:22:58 +00:00
#when: dnsmasq_install | bool
2018-11-03 01:28:26 +00:00
- name: Install uuid-runtime package (debuntu)
2017-12-08 06:16:51 +00:00
package:
name:
- uuid-runtime
- sudo
2017-12-08 06:16:51 +00:00
state: present
when: is_debuntu | bool
2017-05-27 18:09:50 +00:00
2018-11-03 01:28:26 +00:00
- name: Does /etc/iiab/uuid file exist?
2017-12-08 06:16:51 +00:00
stat:
path: /etc/iiab/uuid
register: uuid_file
- name: If no uuid exists, create one
shell: uuidgen
register: uuid_response
when: not uuid_file.stat.exists
2018-11-03 01:28:26 +00:00
- 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
2018-11-03 01:28:26 +00:00
- name: Grab the uuid from /etc/iiab/uuid, into register stored_uuid
command: cat /etc/iiab/uuid
register: stored_uuid
2018-11-03 01:33:52 +00:00
- name: Place the uuid from register into variable/fact "uuid"
set_fact:
2017-12-08 06:16:51 +00:00
uuid: "{{ stored_uuid.stdout_lines[0] }}"
2019-01-12 21:19:07 +00:00
#- 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?
2019-01-15 07:59:12 +00:00
shell: grep -i ubermix /etc/lsb-release # Pipe to cat to avoid red errors?
2019-01-12 21:19:07 +00:00
register: grep_ubermix
failed_when: False # Universal way to hide alarmist red errors!
#ignore_errors: True
2019-01-12 21:19:07 +00:00
#check_mode: no
2019-01-11 00:59:29 +00:00
2019-01-12 21:19:07 +00:00
#- debug:
# var: grep_ubermix
2019-01-11 00:59:29 +00:00
- 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/
2020-01-13 16:11:46 +00:00
# owner: root
# group: root
# mode: '0644'
2019-01-12 21:19:07 +00:00
force: yes
when: grep_ubermix.rc == 0 # 1 if absent in file, 2 if file doesn't exist
#when: ro_dir.stat.exists
2019-01-11 00:59:29 +00:00
# 2020-03-19: for KA Lite, but moved from roles/kalite/tasks/install.yml
2020-03-19 10:42:00 +00:00
# This effectively does nothing at all on Ubuntu & Raspbian, where libgeos-*
# pkgs are not installed FWIW. But it's included to safeguard us across all
# OS's, in case others OS's like Ubermix later appear. See #1382 for details.
# Removing pkgs libgeos-3.6.2 & libgeos-c1v5 fixed the situation on Ubermix!
- name: Remove libgeos-* pkgs, avoiding KA Lite Django failure on Ubermix
shell: apt -y remove "libgeos-*"
when: grep_ubermix.rc == 0 # 1 if absent in file, 2 if file doesn't exist
2018-09-20 00:42:37 +00:00
- name: SSHD
include_role:
name: sshd
#when: sshd_install | bool # Flag might be created in future?
2018-09-20 00:42:37 +00:00
2018-09-20 07:53:26 +00:00
- name: IIAB-ADMIN
include_role:
name: iiab-admin
#when: iiab-admin_install | bool # Flag might be created in future?
2018-09-20 07:53:26 +00:00
2018-09-19 21:32:07 +00:00
- name: OPENVPN
include_role:
name: openvpn
when: openvpn_install | bool
2018-09-19 21:32:07 +00:00
2019-03-29 19:44:23 +00:00
# Debian 10 "Buster" is apparently enabling AppArmor in 2019:
# https://wiki.debian.org/AppArmor/Progress
# https://wiki.debian.org/AppArmor/HowToUse
# https://packages.debian.org/buster/apparmor
# Curiously this has NOT stopped IIAB 7.0/master from working on Debian 10
# pre-releases, during @floydianslips' March 2019 testing anyway! SEE #1387
- name: Disable AppArmor -- override OS default (ubuntu)
2020-01-13 16:11:46 +00:00
systemd:
2017-12-08 06:16:51 +00:00
name: apparmor
enabled: False
state: stopped
when: is_ubuntu | bool
ignore_errors: True
2017-06-26 22:24:26 +00:00
- name: Disable SELinux on next boot (OS's other than debuntu)
2017-12-08 06:16:51 +00:00
selinux:
state: disabled
2017-05-27 18:09:50 +00:00
register: selinux_disabled
2017-10-31 18:08:42 +00:00
when: not is_debuntu
2017-05-27 18:09:50 +00:00
- name: Disable SELinux for this session (OS's other than debuntu, if needed)
2017-05-27 18:09:50 +00:00
command: setenforce Permissive
when: not is_debuntu and selinux_disabled is defined and selinux_disabled.changed
2017-05-27 18:09:50 +00:00
## DISCOVER PLATFORMS ######
# Put conditional actions for hardware platforms here
- include_tasks: raspberry_pi.yml
2017-09-19 07:46:37 +00:00
when: first_run and rpi_model != "none"
2017-05-27 18:09:50 +00:00
2018-11-03 01:47:45 +00:00
- name: Check if the identifier for Intel's NUC6 built-in WiFi is present
2017-12-08 06:16:51 +00:00
shell: "lsusb | grep 8087:0a2b | wc | awk '{print $1}'"
2017-05-27 18:09:50 +00:00
register: usb_NUC6
ignore_errors: True
2017-05-27 18:09:50 +00:00
2018-11-03 01:31:50 +00:00
- 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
2017-12-08 06:16:51 +00:00
get_url:
url: "{{ iiab_download_url }}/iwlwifi-8000C-13.ucode"
2017-12-08 06:21:21 +00:00
dest: /lib/firmware
2017-12-08 06:16:51 +00:00
timeout: "{{ download_timeout }}"
2017-12-08 06:21:21 +00:00
when: internet_available and usb_NUC6.stdout|int > 0
2017-10-27 03:46:57 +00:00
# this script can be sourced to get IIAB location
2017-10-30 20:29:49 +00:00
- name: Recording STAGE 1 HAS COMPLETED ============================
2017-12-08 06:16:51 +00:00
template:
src: roles/1-prep/templates/iiab.env.j2
2018-10-15 09:29:33 +00:00
dest: "{{ iiab_env_file }}"