37 Commits

Author SHA1 Message Date
8a0c432db6 FIX: Fixing broken rebase :D 2025-08-25 17:55:19 +02:00
5a9bd17e13 ADD: Semaphore UI initial commit 2025-08-25 17:52:41 +02:00
617ec624cb ADD: Semaphore UI initial commit 2025-08-25 17:51:00 +02:00
8d8b40f2e6 FIX: Fixed problems with .env file. Added separate ansible host 2025-08-24 23:21:41 +02:00
21109f160e FIX: Fixed incorrect .env file and updated inventory to have a separate Ansible host 2025-08-24 23:09:32 +02:00
cd077517a0 ADD: Script to run via docker on Ansible host 2025-08-24 22:14:48 +02:00
d3a8cc66ad ADD: Script to run via docker on Ansible host 2025-08-24 22:12:53 +02:00
b12b1fa924 Merge branch 'test' 2025-08-24 21:55:10 +02:00
7919919d23 CHANGE: Bind mounts were replaced with the named volumes 2025-08-24 21:53:15 +02:00
f590fc777f CHANGE: Removed volumes 2025-08-24 21:27:24 +02:00
742fc0d421 Merge branch 'test' of gitea-repo:mbuz/homelab into test 2025-08-24 21:09:23 +02:00
44104a9a57 ADD: Semaphore UI initial commit 2025-08-24 21:08:16 +02:00
1609167399 CHANGE: removed not needed image from the Docker/immich directory 2025-08-24 21:05:16 +02:00
24861aaa70 ADD: Semaphore UI initial commit 2025-08-24 21:04:24 +02:00
ab9059374e ADD: Semaphore UI initial commit 2025-08-24 21:03:19 +02:00
8c285e2682 ADD: Semaphore UI initial commit 2025-08-24 21:02:44 +02:00
dd546bc033 CHANGE: Replaced an example file with the official one 2025-08-24 20:42:41 +02:00
8391a77535 change: added more secrects (some of which are used in playbooks) to the example file 2025-08-24 19:56:39 +02:00
2a091a6f21 change: removed not needed image from the Docker/immich directory 2025-08-24 19:19:26 +02:00
11e1b9b89f fix: remover non-interactive environment to testh without it 2025-08-24 18:32:41 +02:00
8c239b0dc9 Fixed sub group (forgot to adjust it) 2025-08-24 18:21:10 +02:00
6ba8ee4d79 redefined groupping to separate ubuntu hosts from proxmox 2025-08-24 18:20:16 +02:00
b6a9e5912f Changes in inventory 2025-08-24 18:14:45 +02:00
a3c6d0c0d6 forgot to add oracle into ubuntu sub group 2025-08-24 18:05:47 +02:00
88f8edcd0d changes in the inventory structure 2025-08-24 18:05:14 +02:00
d904f10434 Changed addressed to be able to run playbooks on the control node 2025-08-24 17:59:02 +02:00
d54ef85c48 Key file adjustmen 2025-08-24 17:57:29 +02:00
a2cc1eafb6 Adjusted inventory file with the real IP addresses. I do not see the reason to skip local IPs. 2025-08-24 17:54:46 +02:00
3b68e15bb9 non-interactive apt run 2025-08-24 17:08:48 +02:00
71e8d19574 Autoremove added 2025-08-24 16:54:24 +02:00
8ba2e93e77 Adjusted apt update to provide a feedback if upgrade is needed and wait one hour for cache update. Added localhost entity into the hosts.ini 2025-08-24 16:28:36 +02:00
a3d9c54ba0 Adjusted README 2025-08-24 16:00:49 +02:00
95e8475baf Added "Managed by Ansible" comment 2025-08-24 15:49:33 +02:00
96fd1e13b2 Fixed another typo in the host name 2025-08-24 15:45:46 +02:00
71edcd698c Added agent2 installation 2025-08-24 15:44:51 +02:00
d2c632616a Changes in the connection configuration 2025-08-24 15:29:37 +02:00
47b9b71cd1 Fixed a typo in the host name during the status check 2025-08-24 15:24:20 +02:00
12 changed files with 164 additions and 65 deletions

3
.gitignore vendored
View File

@@ -1,3 +1,2 @@
.vscode/
Ansible/secrets.yml
Ansible/inventory/hosts.ini
Ansible/secrets.yml

View File

@@ -4,11 +4,11 @@ This Ansible setup is designed to automate the configuration and maintenance of
## Directory Structure
- `inventory/`: Contains the inventory files that define the hosts and groups of hosts managed by Ansible. The `hosts.ini` file should be updated with your server details, and `example_hosts.ini` serves as a template.
- `group_vars/`: This directory can be used to store variables that apply to specific groups of hosts defined in the inventory.
- `*.yml` files: These are the Ansible playbooks that define the automation tasks.
- `secrets.yml`: This file is intended to store sensitive data like passwords and API keys. It is recommended to encrypt this file using Ansible Vault. An `example_secrets.yml` is provided as a template.
- `vars.yml`: This file can be used to store non-sensitive variables that are used across multiple playbooks.
- `inventory/`: Contains the inventory files that define the hosts and groups of hosts managed by Ansible.
- `playbooks/`: Contains the Ansible playbooks for various automation tasks.
- `secrets.yml`: This file is intended to store sensitive data like passwords and API keys. It is recommended to encrypt this file using Ansible Vault.
- `example_secrets.yml`: An example secrets file.
- `vars.yml`: This file can be used to store non-sensitive variables that are used across multiple playbooks.
## Getting Started
@@ -17,5 +17,5 @@ This Ansible setup is designed to automate the configuration and maintenance of
3. **Secrets:** Create a `secrets.yml` file based on the `example_secrets.yml` template and encrypt it using Ansible Vault for security.
4. **Run a Playbook:** You can run a playbook using the `ansible-playbook` command. For example:
```bash
ansible-playbook -i inventory/hosts.ini apt_upgrade.yml
```
ansible-playbook -i inventory/hosts.ini playbooks/apt_upgrade.yml
```

View File

@@ -1,2 +1,7 @@
# Copy this into secrets.yml and replate with a real values
ansible_password: 'REPLACE_WITH_ROOT_PASSWORD'
ansible_password: 'REPLACE_WITH_ROOT_PASSWORD'
# Zabbix proxy parameters for connecting to Zabbix server
zabbix_server_address: 'x.x.x.x'
zabbix_psk_identity: '<zabbix_psk_identity'
zabbix_proxy_hostname: '<zabbix_proxy_hostname>' # if needed, in the actual playbook it is set to the hostname of the target
zabbix_proxy_psk: 'REPLACE_WITH_ZABBIX_PSK'

View File

@@ -1,30 +0,0 @@
[all:vars]
ansible_user = mbuz
ansible_ssh_private_key_file = /home/mbuz/.ssh/id_rsa
[proxmox]
proxmox-host ansible_host=x.x.x.x
[docker]
docker-apps ansible_host=x.x.x.x
docker-cloud ansible_host=x.x.x.x
#[truenas]
#truenas ansible_host=x.x.x.x
[raspberry_pi]
raspberry-pi ansible_host=x.x.x.x
[lxc]
ansible ansible_host=x.x.x.x
zabbix-proxy ansible_host=x.x.x.x
pi-hole ansible_host=x.x.x.x
[proxmox_backup]
proxmox-backup ansible_host=x.x.x.x
# This is a group of groups. It includes all hosts in the 'docker' and 'raspberry_pi' groups.
[ubuntu:children]
docker
raspberry_pi
lxc

View File

@@ -0,0 +1,34 @@
[all:vars]
ansible_user = mbuz
ansible_ssh_private_key_file = /home/mbuz/.ssh/id_ed25519
[proxmox]
proxmox_host ansible_host=10.0.0.1
[ubuntu_servers]
raspberry-pi ansible_host=10.0.0.5
oracle-arm ansible_host=130.61.76.209 ansible_user=ubuntu
[docker]
docker-apps ansible_host=10.0.0.101
docker-cloud ansible_host=10.0.0.102
[filestorage]
truenas ansible_host=10.0.0.200
[lxc]
gitea ansible_host=10.0.0.108
zabbix-proxy ansible_host=10.0.0.110
pi-hole ansible_host=10.0.0.104
ansible ansible_host=10.0.0.111
#localhost ansible_connection=local # for testing playbooks on the control node
[pbs]
proxmox-backup ansible_host=10.0.0.201
# This is a group of groups. It includes all Ubuntu based systems.
[ubuntu:children]
docker
ubuntu_servers
lxc

View File

@@ -1,14 +1,29 @@
- name: Upgrade packages
---
- name: Upgrade all apt packages
hosts: ubuntu
become: true
become: yes
tasks:
- name: Update cache
ansible.builtin.apt:
update_cache: true
register: cache_updated
- name: Update apt cache
ansible.builtin.apt:
update_cache: yes
cache_valid_time: 3600
- name: Upgrade packages if something is changed
ansible.builtin.apt:
upgrade: "yes"
when: cache_updated.changed
- name: Upgrade all apt packages
ansible.builtin.apt:
upgrade: dist
# environment:
# DEBIAN_FRONTEND: noninteractive
- name: Autoremove unused packages
ansible.builtin.apt:
autoremove: yes
- name: Check if a reboot is required
ansible.builtin.stat:
path: /var/run/reboot-required
register: reboot_required_file
- name: Display reboot message
ansible.builtin.debug:
msg: "A reboot is required to apply the latest updates."
when: reboot_required_file.stat.exists

View File

@@ -1,5 +1,5 @@
---
- name: Install and Configure Zabbix Proxy
- name: Install and Configure Zabbix Proxy and Agent
hosts: zabbix-proxy # Assuming you have a group for zabbix proxy in your inventory
become: yes
vars_files:
@@ -14,9 +14,11 @@
ansible.builtin.apt:
deb: /tmp/zabbix-release.deb
- name: Install Zabbix proxy
- name: Install Zabbix proxy and agent
ansible.builtin.apt:
name: zabbix-proxy-sqlite3
name:
- zabbix-proxy-sqlite3
- zabbix-agent2
state: present
update_cache: yes
@@ -24,6 +26,8 @@
ansible.builtin.copy:
dest: /etc/zabbix/zabbix_proxy.d/custom.conf
content: |
## Managed by Ansible - do not edit manually ##
## Changes will be overwritten ##
DBName=/tmp/zabbix_proxy
StartPollers=2
StartPreprocessors=1
@@ -40,9 +44,11 @@
ansible.builtin.copy:
dest: /etc/zabbix/zabbix_proxy.d/connection.conf
content: |
## Managed by Ansible - do not edit manually ##
## Changes will be overwritten ##
Server={{ zabbix_server_address }}:10051
Hostname={{ ansible_facts.hostname }}
TLSPSKFile="/etc/zabbix/{{ ansible_facts.hostname }}.psk"
TLSPSKFile=/etc/zabbix/{{ ansible_facts.hostname }}.psk
TLSPSKIdentity={{ zabbix_psk_identity }}
notify: restart zabbix-proxy
@@ -55,18 +61,43 @@
mode: '0600'
notify: restart zabbix-proxy
- name: Create Zabbix agent custom configuration file
ansible.builtin.copy:
dest: /etc/zabbix/zabbix_agent2.d/custom.conf
content: |
## Managed by Ansible - do not edit manually ##
## Changes will be overwritten ##
Hostname={{ ansible_facts.hostname }}
Server={{ hostvars['zabbix-proxy']['ansible_host'] }},{{ hostvars['raspberry-pi']['ansible_host'] }}
ServerActive={{ hostvars['zabbix-proxy']['ansible_host'] }};{{ hostvars['raspberry-pi']['ansible_host'] }}
notify: restart zabbix-agent2
- name: Create Zabbix agent user parameters file
ansible.builtin.copy:
dest: /etc/zabbix/zabbix_agent2.d/userparams.conf
content: |
## Managed by Ansible - do not edit manually ##
## Changes will be overwritten ##
AllowKey=system.run[*]
notify: restart zabbix-agent2
handlers:
- name: restart zabbix-proxy
ansible.builtin.service:
name: zabbix-proxy
state: restarted
enabled: yes
- name: restart zabbix-agent2
ansible.builtin.service:
name: zabbix-agent2
state: restarted
enabled: yes
- name: Verify Zabbix Proxy Service
hosts: zabbix_proxy
- name: Verify Zabbix Services
hosts: zabbix-proxy
become: yes
tasks:
- name: Check if Zabbix proxy service is running
- name: Check if Zabbix services are running
ansible.builtin.service_facts:
- name: Assert that Zabbix proxy is running
@@ -75,3 +106,10 @@
- "ansible_facts.services['zabbix-proxy.service'].state == 'running'"
fail_msg: "Zabbix proxy is not running"
success_msg: "Zabbix proxy is running"
- name: Assert that Zabbix agent is running
ansible.builtin.assert:
that:
- "ansible_facts.services['zabbix-agent2.service'].state == 'running'"
fail_msg: "Zabbix agent 2 is not running"
success_msg: "Zabbix agent 2 is running"

View File

@@ -1,21 +1,22 @@
# You can find documentation for all the supported env variables at https://immich.app/docs/install/environment-variables
# The location where your uploaded files are stored
UPLOAD_LOCATION=${UPLOAD_LOCATION}
# The location where your database files are stored
DB_DATA_LOCATION=${DB_DATA_LOCATION}
UPLOAD_LOCATION=./library
# The location where your database files are stored. Network shares are not supported for the database
DB_DATA_LOCATION=./postgres
# To set a timezone, uncomment the next line and change Etc/UTC to a TZ identifier from this list: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones#List
# TZ=Etc/UTC
# The Immich version to use. You can pin this to a specific version like "v1.71.0"
IMMICH_VERSION=${IMMICH_VERSION:-release}
IMMICH_VERSION=release
# Connection secret for postgres. You should change it to a random password
# Please use only the characters `A-Za-z0-9`, without special characters or spaces
DB_PASSWORD=${DB_PASSWORD}
DB_PASSWORD=postgres
# The values below this line do not need to be changed
###################################################################################
DB_USERNAME=${DB_USERNAME}
DB_DATABASE_NAME=${DB_DATABASE_NAME}
DB_USERNAME=postgres
DB_DATABASE_NAME=immich

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

View File

@@ -0,0 +1,11 @@
<<<<<<< HEAD
SEMAPHORE_ADMIN=admin
SEMAPHORE_ADMIN_PASSWORD=changeme
SEMAPHORE_ADMIN_NAME=Admin
SEMAPHORE_ADMIN_EMAIL=admin@example.com
=======
ADMIN_USER=admin
ADMIN_PASS=changeme
ADMIN_NAME=Admin
ADMIN_EMAIL=admin@example.com
>>>>>>> ab90593 (ADD: Semaphore UI initial commit)

View File

@@ -0,0 +1,17 @@
services:
semaphore:
ports:
- 3030:3000
image: semaphoreui/semaphore:v2.16.18
environment:
SEMAPHORE_DB_DIALECT: sqlite
SEMAPHORE_ADMIN: ${ADMIN_USER}
SEMAPHORE_ADMIN_PASSWORD: ${ADMIN_PASS}
SEMAPHORE_ADMIN_NAME: ${ADMIN_NAME}
SEMAPHORE_ADMIN_EMAIL: ${ADMIN_EMAIL}
volumes:
- semaphore-data:/var/lib/semaphore
- semaphore-config:/etc/semaphore
volumes:
semaphore-data:
semaphore-config:

View File

@@ -0,0 +1,9 @@
docker run -d \
--restart unless-stopped \
--name semaphore \
-p 3030:3000 \
--env-file .env \
-e SEMAPHORE_DB_DIALECT=sqlite \
-v semaphore-data:/var/lib/semaphore \
-v semaphore-config:/etc/semaphore \
semaphoreui/semaphore:latest