61 lines
1.4 KiB
YAML
61 lines
1.4 KiB
YAML
- name: Deployment of software + requirements
|
|
hosts: all
|
|
user: remy
|
|
become: true
|
|
|
|
tasks:
|
|
- name: Include network variables
|
|
ansible.builtin.include_vars:
|
|
file: wifi_networks.yml
|
|
name: wifi_external
|
|
|
|
- name: Use raspi-config to set WIFI country
|
|
shell: |
|
|
raspi-config nonint do_wifi_country CH
|
|
|
|
- name: Use raspi-config to set WIFI SSID and password
|
|
shell: |
|
|
raspi-config nonint do_wifi_ssid_passphrase "{{ item.ssid }}" "{{ item.password }}"
|
|
loop: "{{ wifi_external.networks }}"
|
|
|
|
- name: apt update all packages
|
|
apt:
|
|
update_cache: yes
|
|
upgrade: yes
|
|
|
|
- name: Install required packages
|
|
apt:
|
|
name:
|
|
- git
|
|
- python3-pip
|
|
- python3-dev
|
|
- python3-setuptools
|
|
- python3-rpi.gpio
|
|
- python3-spidev
|
|
state: present
|
|
|
|
- name: Pip install pipenv
|
|
pip:
|
|
name: pipenv
|
|
state: present
|
|
|
|
- name: Enable SPI and I2C interfaces
|
|
lineinfile:
|
|
path: /boot/config.txt
|
|
regexp: "^#?(dtparam=i2c_arm|dtparam=spi)"
|
|
line: "{{ item }}"
|
|
state: present
|
|
with_items:
|
|
- "dtparam=i2c_arm=on"
|
|
- "dtparam=spi=on"
|
|
|
|
- name: Reboot the Raspberry Pi
|
|
reboot:
|
|
connect_timeout: 20
|
|
reboot_timeout: 300
|
|
|
|
- name: Wait for the Raspberry Pi to reboot
|
|
wait_for_connection:
|
|
delay: 5
|
|
timeout: 300
|