Improved setup and deploy

This commit is contained in:
2023-12-20 16:00:01 +01:00
parent 58d318faee
commit d3a641e1f8
9 changed files with 118 additions and 61 deletions

View File

@@ -8,11 +8,13 @@
repo_dest: /home/remy/eink
code_dest: /home/remy/eink/src
service_target_dir: /etc/systemd/system/
# adapt to taste
own_image_percent: 90
recipient: "???"
tasks:
- name: Load program variables
ansible.builtin.include_vars:
file: ../program_variables.yml
name: program_variables
- name: Pull the latest version of the code
git:
repo: https://git.kluster.moll.re/remoll/rpi-eink-picture-frame
@@ -32,11 +34,6 @@
args:
chdir: "{{ repo_dest }}"
- name: Copy keys python file
copy:
src: ../src/keys.py
dest: "{{ code_dest }}/keys.py"
- name: Copy unit files
template:
src: ./templates/{{ item }}.j2
@@ -55,4 +52,4 @@
loop:
- eink-show.service
- eink-show.timer
become: true
become: true

View File

@@ -4,19 +4,20 @@
become: true
tasks:
# 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: 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
@@ -57,13 +58,3 @@
wait_for_connection:
delay: 5
timeout: 300
- 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

@@ -6,9 +6,11 @@ Type=oneshot
User={{ ansible_user }}
WorkingDirectory={{ code_dest }}
ExecStart=python main.py
Environment="OWN_IMAGE_PERCENT={{ own_image_percent }}"#
Environment="RECIPIENT={{ recipient }}"
Environment="OWN_IMAGE_PERCENT={{ program_variables.OWN_IMAGE_PERCENT }}"
Environment="RECIPIENT={{ program_variables.RECIPIENT }}"
Environment="IMMICH_API_URL={{ program_variables.IMMICH_API_URL }}"
Environment="IMMICH_API_KEY={{ program_variables.IMMICH_API_KEY }}"
Environment="IMMICH_ALBUM_ID={{ program_variables.IMMICH_ALBUM_ID }}"
[Install]