Compare commits
37 Commits
c372a781e5
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 8a0c432db6 | |||
| 5a9bd17e13 | |||
| 617ec624cb | |||
| 8d8b40f2e6 | |||
| 21109f160e | |||
| cd077517a0 | |||
| d3a8cc66ad | |||
| b12b1fa924 | |||
| 7919919d23 | |||
| f590fc777f | |||
| 742fc0d421 | |||
| 44104a9a57 | |||
| 1609167399 | |||
| 24861aaa70 | |||
| ab9059374e | |||
| 8c285e2682 | |||
| dd546bc033 | |||
| 8391a77535 | |||
| 2a091a6f21 | |||
| 11e1b9b89f | |||
| 8c239b0dc9 | |||
| 6ba8ee4d79 | |||
| b6a9e5912f | |||
| a3c6d0c0d6 | |||
| 88f8edcd0d | |||
| d904f10434 | |||
| d54ef85c48 | |||
| a2cc1eafb6 | |||
| 3b68e15bb9 | |||
| 71e8d19574 | |||
| 8ba2e93e77 | |||
| a3d9c54ba0 | |||
| 95e8475baf | |||
| 96fd1e13b2 | |||
| 71edcd698c | |||
| d2c632616a | |||
| 47b9b71cd1 |
3
.gitignore
vendored
3
.gitignore
vendored
@@ -1,3 +1,2 @@
|
||||
.vscode/
|
||||
Ansible/secrets.yml
|
||||
Ansible/inventory/hosts.ini
|
||||
Ansible/secrets.yml
|
||||
@@ -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
|
||||
```
|
||||
|
||||
@@ -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'
|
||||
@@ -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
|
||||
34
Ansible/inventory/hosts.ini
Normal file
34
Ansible/inventory/hosts.ini
Normal 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
|
||||
@@ -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
|
||||
|
||||
@@ -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"
|
||||
@@ -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 |
11
Docker/semaphore-ui/.env.example
Normal file
11
Docker/semaphore-ui/.env.example
Normal 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)
|
||||
17
Docker/semaphore-ui/docker-compose.yml
Normal file
17
Docker/semaphore-ui/docker-compose.yml
Normal 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:
|
||||
9
Docker/semaphore-ui/docker-run.sh
Normal file
9
Docker/semaphore-ui/docker-run.sh
Normal 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
|
||||
Reference in New Issue
Block a user