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
2018-11-03 01:28:26 +00:00
- name : Install uuid-runtime package (debuntu)
2017-12-08 06:16:51 +00:00
package :
2018-11-18 03:13:15 +00:00
name :
- uuid-runtime
- sudo
2017-12-08 06:16:51 +00:00
state : present
2017-05-27 23:10:45 +00:00
when : is_debuntu
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
2017-07-04 20:07:47 +00:00
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
2017-07-04 20:07:47 +00:00
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
2017-07-04 20:07:47 +00:00
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"
2017-07-04 20:07:47 +00:00
set_fact :
2017-12-08 06:16:51 +00:00
uuid : "{{ stored_uuid.stdout_lines[0] }}"
2017-07-04 20:07:47 +00:00
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
2019-01-15 07:59:12 +00:00
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/
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
2018-09-20 00:42:37 +00:00
- name : SSHD
include_role :
name : sshd
# has no "when: XXXXX_install" flag
tags : base, sshd
2018-09-20 07:53:26 +00:00
- name : IIAB-ADMIN
include_role :
name : iiab-admin
# has no "when: XXXXX_install" flag
tags : base, iiab-admin
2018-09-19 21:32:07 +00:00
- name : OPENVPN
include_role :
name : openvpn
when : openvpn_install
tags : openvpn
2017-05-27 18:09:50 +00:00
# for rpi, without rtc, we need time as soon as possible
2018-11-03 01:32:26 +00:00
- name : Install chrony (an NTP package) especially for RPi's lacking RTC
2017-12-08 06:16:51 +00:00
package :
2018-10-28 15:42:44 +00:00
name : chrony
2017-12-08 06:16:51 +00:00
state : present
2017-05-27 18:09:50 +00:00
tags :
- download
2017-06-04 14:19:34 +00:00
#TODO: Use regexp filter instead of hard-code ip
2018-11-03 01:28:26 +00:00
- name : Install /etc/chrony.conf from template
2017-12-08 06:16:51 +00:00
template :
src : chrony.conf.j2
2018-11-03 01:28:26 +00:00
dest : /etc/chrony.conf
backup : no
2017-05-27 18:09:50 +00:00
2018-02-13 02:03:49 +00:00
- name : Disable AppArmor -- override OS default (ubuntu)
2017-12-08 06:16:51 +00:00
service :
name : apparmor
enabled : False
state : stopped
2017-10-31 18:08:42 +00:00
when : is_ubuntu
2017-08-24 17:02:17 +00:00
ignore_errors : true
2017-06-26 22:24:26 +00:00
2018-02-13 02:03:49 +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
2018-02-13 02:03:49 +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
2017-09-25 16:17:52 +00:00
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
2018-02-13 02:03:49 +00:00
- 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
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
2017-10-28 17:46:47 +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 }}"
2017-12-08 06:16:51 +00:00
owner : root
group : root
mode : 0644