diff --git a/roles/1-prep/tasks/main.yml b/roles/1-prep/tasks/main.yml index 37df72fcf..c46bfe997 100644 --- a/roles/1-prep/tasks/main.yml +++ b/roles/1-prep/tasks/main.yml @@ -3,7 +3,7 @@ - name: ...IS BEGINNING ============================================ command: echo -- name: Get the uuidgen program +- name: Install uuidgen program (debuntu) package: name: uuid-runtime state: present @@ -54,7 +54,7 @@ dest: /etc/chrony.conf src: chrony.conf.j2 -- name: Disable AppArmor -- on by default in Ubuntu +- name: Disable AppArmor -- override OS default (ubuntu) service: name: apparmor enabled: False @@ -62,19 +62,19 @@ when: is_ubuntu ignore_errors: true -- name: Disable SELinux on next boot +- name: Disable SELinux on next boot (OS's other than debuntu) selinux: state: disabled register: selinux_disabled when: not is_debuntu -- name: Disable SELinux for this session (if needed) +- name: Disable SELinux for this session (OS's other than debuntu, if needed) command: setenforce Permissive when: not is_debuntu and selinux_disabled is defined and selinux_disabled.changed ## DISCOVER PLATFORMS ###### # Put conditional actions for hardware platforms here -- include_tasks: raspberry_pi_2.yml +- 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 diff --git a/roles/1-prep/tasks/raspberry_pi.yml b/roles/1-prep/tasks/raspberry_pi.yml new file mode 100644 index 000000000..ccaafff24 --- /dev/null +++ b/roles/1-prep/tasks/raspberry_pi.yml @@ -0,0 +1,62 @@ +# Setup specific to the Raspberry Pi + +- 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 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 + lineinfile: + dest: /boot/config.txt + line: "dtoverlay=i2c-rtc,{{ rtc_id }}=on" + state: present + register: rpiconfig + when: 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: Pre-install packages + package: + name: "{{ item }}" + state: latest + with_items: + - ntp + +- name: Increase the swap file size, as kalite pip download fails (debuntu) + lineinfile: + 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 + when: is_debuntu + +- name: Add RPi rootfs resizing service + template: + src: "{{ item.src }}" + dest: "{{ item.dest }}" + owner: root + group: root + mode: "{{ item.mode }}" + with_items: + - { 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: iiab-rpi-root-resize + enabled: yes diff --git a/roles/1-prep/tasks/raspberry_pi_2.yml b/roles/1-prep/tasks/raspberry_pi_2.yml deleted file mode 100644 index f93f734ee..000000000 --- a/roles/1-prep/tasks/raspberry_pi_2.yml +++ /dev/null @@ -1,57 +0,0 @@ -# Setup specific to the Raspberry Pi -# -- 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 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 - lineinfile: dest=/boot/config.txt - line="dtoverlay=i2c-rtc,{{ rtc_id }}=on" - state=present - register: rpiconfig - when: 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: Pre-install packages - package: name={{ item }} - state=latest - with_items: - - ntp - -- name: Increase the swap file size (kalite pip download fails) - lineinfile: regexp="^CONF_SWAPSIZE" - line=CONF_SWAPSIZE=500 - dest=/etc/dphys-swapfile - when: is_debuntu - -- name: Restart the swap service - command: /etc/init.d/dphys-swapfile restart - when: is_debuntu - -- name: Add RPi rootfs resizing service - template: src={{ item.src }} - dest={{ item.dest }} - owner=root - group=root - mode={{ item.mode }} - with_items: - - { 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=iiab-rpi-root-resize - enabled=yes