You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
124 lines
3.4 KiB
124 lines
3.4 KiB
---
|
|
- name: Ensure img directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ item }}"
|
|
state: directory
|
|
with_items:
|
|
- "~/bin"
|
|
- "~/img"
|
|
- name: Copy image directory
|
|
ansible.builtin.copy:
|
|
src: "img"
|
|
dest: "~/img"
|
|
- name: Copy screensaver script
|
|
ansible.builtin.copy:
|
|
src: screensaver.sh
|
|
dest: "~/bin/screensaver.sh"
|
|
mode: '0755'
|
|
|
|
# BCM & Fan PWM drivers
|
|
- name: Clone pibox-os repository
|
|
ansible.builtin.git:
|
|
repo: https://github.com/kubesail/pibox-os.git
|
|
dest: /usr/src/pibox-os
|
|
clone: true
|
|
force: true
|
|
update: true
|
|
register: piboxos_repo_updated
|
|
become: true
|
|
become_method: sudo
|
|
- name: Extract bcm2835-1.68.tar.gz
|
|
ansible.builtin.unarchive:
|
|
creates: /usr/src/pibox-os/pwm-fan/bcm2835-1.68/
|
|
dest: /usr/src/pibox-os/pwm-fan/
|
|
remote_src: true
|
|
src: /usr/src/pibox-os/pwm-fan/bcm2835-1.68.tar.gz
|
|
when: piboxos_repo_updated.changed
|
|
become: true
|
|
become_method: sudo
|
|
- name: Configure build env for bcm2835-1.68 fan pwm driver
|
|
ansible.builtin.command:
|
|
chdir: /usr/src/pibox-os/pwm-fan/bcm2835-1.68/
|
|
cmd: bash ./configure
|
|
when: piboxos_repo_updated.changed
|
|
become: true
|
|
become_method: sudo
|
|
- name: Build bcm2835-1.68 driver
|
|
ansible.builtin.command:
|
|
chdir: /usr/src/pibox-os/pwm-fan/bcm2835-1.68/
|
|
cmd: make
|
|
when: piboxos_repo_updated.changed
|
|
become: true
|
|
become_method: sudo
|
|
- name: Install bcm2835-1.68 driver
|
|
ansible.builtin.command:
|
|
chdir: /usr/src/pibox-os/pwm-fan/bcm2835-1.68/
|
|
cmd: make install
|
|
when: piboxos_repo_updated.changed
|
|
become: true
|
|
become_method: sudo
|
|
- name: Build pwm fan driver
|
|
ansible.builtin.command:
|
|
chdir: /usr/src/pibox-os/pwm-fan/
|
|
cmd: make
|
|
when: piboxos_repo_updated.changed
|
|
become: true
|
|
become_method: sudo
|
|
- name: Install pwm fan driver
|
|
ansible.builtin.command:
|
|
chdir: /usr/src/pibox-os/pwm-fan/
|
|
cmd: make install
|
|
when: piboxos_repo_updated.changed
|
|
become: true
|
|
become_method: sudo
|
|
|
|
# Pibox framebuffer binary & service
|
|
- name: Create kubesail directory in /opt
|
|
ansible.builtin.file:
|
|
path: /opt/kubesail
|
|
state: directory
|
|
become: true
|
|
become_method: sudo
|
|
- name: Download pibox-framebuffer binary
|
|
ansible.builtin.get_url:
|
|
dest: /opt/kubesail/pibox-framebuffer
|
|
mode: '755'
|
|
url: https://github.com/kubesail/pibox-framebuffer/releases/download/v22/pibox-framebuffer
|
|
become: true
|
|
become_method: sudo
|
|
- name: Download and install pibox-framebuffer service
|
|
ansible.builtin.get_url:
|
|
dest: /etc/systemd/system/pibox-framebuffer.service
|
|
url: https://raw.githubusercontent.com/kubesail/pibox-framebuffer/main/pibox-framebuffer.service
|
|
register: pibox_framebuffer_downloaded
|
|
become: true
|
|
become_method: sudo
|
|
- name: Reload systemctl daemon if necessary
|
|
ansible.builtin.command:
|
|
cmd: systemctl daemon-reload
|
|
when: pibox_framebuffer_downloaded.changed
|
|
become: true
|
|
become_method: sudo
|
|
- name: Enable SPI via /boot/config.txt edit
|
|
ansible.builtin.lineinfile:
|
|
path: /boot/firmware/config.txt
|
|
line: "dtparam=spi=on"
|
|
insertafter: "#dtparam=spi=on"
|
|
state: present
|
|
register: boot_config_updated
|
|
become: true
|
|
become_method: sudo
|
|
- name: Start pibox-framebuffer service if no boot config made
|
|
ansible.builtin.service:
|
|
name: pibox-framebuffer
|
|
enabled: true
|
|
state: started
|
|
become: true
|
|
become_method: sudo
|
|
- name: Reboot if SPI updated
|
|
ansible.builtin.reboot:
|
|
post_reboot_delay: 10
|
|
when: boot_config_updated.changed
|
|
become: true
|
|
become_method: sudo
|