This commit is contained in:
jaydee 2025-01-30 23:46:06 +01:00
parent 3808a8bb3f
commit 592d4a7db0
4 changed files with 124 additions and 0 deletions

16
playbooks/00_sync_rpi5.yml Executable file
View File

@ -0,0 +1,16 @@
- hosts: rpi5.home.lan
name: Sync rpi5
become: true
tasks:
- name: Apt exclude linux-dtb-current-meson64
ansible.builtin.shell: "docker ps|awk '{print $NF}'"
register: containers
- debug:
msg: "{{ containers.stdout_lines }}"
- name: Stop containers
ansible.builtin.shell: "docker stop {{ item }}"
register: containers
when: item != "NAMES" and item != "watchtower-watchtower-1"
with_items: "{{ containers.stdout_lines }}"
- name: Apt exclude linux-dtb-current-meson64
ansible.builtin.shell: "/myapps/venv/bin/python3 /myapps/omv_backup.py -r all"

View File

@ -0,0 +1,5 @@
- name: restart_docker
ansible.builtin.service:
name: docker.service
state: restarted
become: true

57
roles/sendmail/tasks/main.yml Executable file
View File

@ -0,0 +1,57 @@
- block:
- name: Install docker
ansible.builtin.apt:
name:
- ca-certificates
- curl
- telnet
- net-tools
- python3-pip
- python3-dev
state: present
update_cache: true
- name: Get keys for raspotify
ansible.builtin.shell:
install -m 0755 -d /etc/apt/keyrings
- name: Get keys for raspotify
ansible.builtin.shell:
curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc
- name: Get keys for raspotify
ansible.builtin.shell:
chmod a+r /etc/apt/keyrings/docker.asc
- name: Get keys for raspotify
ansible.builtin.shell: echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
- name: Install docker
ansible.builtin.apt:
name:
- docker-ce
- docker-ce-cli
- containerd.io
- docker-buildx-plugin
- docker-compose-plugin
update_cache: true
- name: Create a directory docker.service.d
ansible.builtin.file:
path: /etc/systemd/system/docker.service.d/
state: directory
mode: '0755'
- name: Creating a file with content
copy:
dest: "/etc/systemd/system/docker.service.d/override.conf"
content: |
[Service]
ExecStart=
ExecStart=/usr/bin/dockerd -H fd:// --containerd=/run/containerd/containerd.sock -H tcp://0.0.0.0:2375
notify: restart_docker
- name: Just force systemd to reread configs
ansible.builtin.systemd:
daemon_reload: true
become: true

View File

@ -0,0 +1,46 @@
- block:
- name: Install vnc packages
ansible.builtin.apt:
name:
- tigervnc-standalone-server
- tigervnc-common
update_cache: yes
- name: Create a directory if it does not exist
ansible.builtin.file:
path: /home/jd/.vnc/
state: directory
mode: '0755'
owner: jd
group: jd
- name: Creating a file with content
copy:
dest: "/home/jd/.vnc/config"
content: |
session=mate
geometry=1200x721
localhost
alwaysshared
mode: '0755'
owner: jd
group: jd
- name: Reconfigure vnc
ansible.builtin.lineinfile:
path: /etc/tigervnc/vncserver-config-defaults
regexp: "^$localhost =.* "
line: '$localhost = "no";'
- name: Reconfigure vnc1
ansible.builtin.lineinfile:
path: /etc/tigervnc/vncserver.users
#regexp: "^:1=.*"
line: ':1=jd'
- name: Reconfigure zabbix agent Server
ansible.builtin.lineinfile:
path: "/etc/tigervnc/vncserver.users"
regexp: "^:1=jd"
line: ":1=jd"
become: "{{ false if inventory_hostname == 'nas.home.lan' else true }}"