added better wireless managment

This commit is contained in:
2023-11-08 21:41:47 +01:00
parent 769a16dae6
commit 6846a17243
7 changed files with 45 additions and 19 deletions

View File

@@ -1,15 +1,21 @@
- name: Basic setup tasks for Raspberry Pi
- name: Deployment of software + requirements
hosts: all
user: remy
become: true
tasks:
- name: Add local ssh key
ansible.posix.authorized_key:
user: "{{ ansible_user }}"
state: present
# copy file present on the controller to the remote host
key: "{{ lookup('file', '~/.ssh/default.pub') }}"
# DONE BY RPI IMAGER
# - name: Add local ssh key
# ansible.posix.authorized_key:
# user: "{{ ansible_user }}"
# state: present
# # copy file present on the controller to the remote host
# key: "{{ lookup('file', '~/.ssh/default.pub') }}"
- name: Include network variables
ansible.builtin.include_vars:
file: wifi_networks.yml
name: wifi_external
- name: apt update all packages
apt:
@@ -52,10 +58,20 @@
delay: 5
timeout: 300
- name: Add wifi networks from template
template:
src: templates/wpa_supplicant.conf.j2
dest: /etc/wpa_supplicant/wpa_supplicant.conf
owner: root
group: root
mode: 0600
# - name: Add wifi networks from template
# template:
# src: templates/wpa_supplicant.conf.j2
# dest: /etc/wpa_supplicant/wpa_supplicant.conf
# owner: root
# group: root
# mode: 0600
- 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 }}"

View File

@@ -3,9 +3,8 @@ Description=Show new photo onto the eink display
[Service]
Type=oneshot
User={{ ansible_user }}
WorkingDirectory={{ code_dest }}
ExecStart=python main.py