Added upsnap
This commit is contained in:
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
ansible_user: root
|
||||||
|
ansible_host: 10.0.2.38
|
||||||
|
ansible_ssh_pass: "{{ proxmox_api_password }}"
|
||||||
|
vmid: 638
|
||||||
@@ -4,7 +4,7 @@ swag
|
|||||||
cloudflare-ddns
|
cloudflare-ddns
|
||||||
dahua-to-mqtt
|
dahua-to-mqtt
|
||||||
immich
|
immich
|
||||||
folding
|
# folding
|
||||||
mastodon
|
mastodon
|
||||||
tautulli
|
tautulli
|
||||||
openvpn
|
openvpn
|
||||||
@@ -19,6 +19,7 @@ nextcloud
|
|||||||
minio
|
minio
|
||||||
outline
|
outline
|
||||||
nginx-proxy-manager
|
nginx-proxy-manager
|
||||||
|
upsnap
|
||||||
|
|
||||||
[baremetal]
|
[baremetal]
|
||||||
mipha
|
mipha
|
||||||
|
|||||||
@@ -1,15 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: frigate
|
|
||||||
become: yes
|
|
||||||
roles:
|
|
||||||
- role: frigate/update
|
|
||||||
|
|
||||||
- hosts: cloudflare-ddns
|
|
||||||
become: yes
|
|
||||||
roles:
|
|
||||||
- role: cloudflare-ddns/update
|
|
||||||
|
|
||||||
- hosts: swag
|
|
||||||
become: yes
|
|
||||||
roles:
|
|
||||||
- role: swag/update
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
become: yes
|
||||||
|
roles:
|
||||||
|
- role: upsnap/provision/delete
|
||||||
|
- role: upsnap/provision/create
|
||||||
|
- role: upsnap/provision/start
|
||||||
|
vars:
|
||||||
|
vmid: 638
|
||||||
|
|
||||||
|
- hosts: mipha
|
||||||
|
become: yes
|
||||||
|
roles:
|
||||||
|
- role: upsnap/enable-ssh
|
||||||
|
vars:
|
||||||
|
vmid: 638
|
||||||
|
|
||||||
|
- hosts: upsnap
|
||||||
|
become: yes
|
||||||
|
roles:
|
||||||
|
- role: upsnap/update
|
||||||
|
- role: upsnap/install-docker
|
||||||
|
- role: upsnap/install-app
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
## Version 2023/02/05
|
||||||
|
# Ensure your DNS has a CNAME set for mealie and that mealie container is named.
|
||||||
|
|
||||||
|
server {
|
||||||
|
listen 443 ssl;
|
||||||
|
listen [::]:443 ssl;
|
||||||
|
|
||||||
|
server_name upsnap.*;
|
||||||
|
|
||||||
|
include /config/nginx/ssl.conf;
|
||||||
|
|
||||||
|
client_max_body_size 0;
|
||||||
|
|
||||||
|
# enable for ldap auth (requires ldap-location.conf in the location block)
|
||||||
|
#include /config/nginx/ldap-server.conf;
|
||||||
|
|
||||||
|
# enable for Authelia (requires authelia-location.conf in the location block)
|
||||||
|
include /config/nginx/authelia-server.conf;
|
||||||
|
|
||||||
|
# enable for Authentik (requires authentik-location.conf in the location block)
|
||||||
|
#include /config/nginx/authentik-server.conf;
|
||||||
|
|
||||||
|
location / {
|
||||||
|
# enable the next two lines for http auth
|
||||||
|
#auth_basic "Restricted";
|
||||||
|
#auth_basic_user_file /config/nginx/.htpasswd;
|
||||||
|
|
||||||
|
# enable for ldap auth (requires ldap-server.conf in the server block)
|
||||||
|
#include /config/nginx/ldap-location.conf;
|
||||||
|
|
||||||
|
# enable for Authelia (requires authelia-server.conf in the server block)
|
||||||
|
include /config/nginx/authelia-location.conf;
|
||||||
|
|
||||||
|
# enable for Authentik (requires authentik-server.conf in the server block)
|
||||||
|
#include /config/nginx/authentik-location.conf;
|
||||||
|
|
||||||
|
include /config/nginx/proxy.conf;
|
||||||
|
include /config/nginx/resolver.conf;
|
||||||
|
set $upstream_app 10.0.2.38;
|
||||||
|
set $upstream_port 8090;
|
||||||
|
set $upstream_proto http;
|
||||||
|
proxy_pass $upstream_proto://$upstream_app:$upstream_port;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
# Unable to use ansible.builtin.lineinfile, because we need to run this through the proxmox host (because SSH is not enabled duh)
|
||||||
|
|
||||||
|
- name: Pause for 10 seconds to wait for SSH server
|
||||||
|
ansible.builtin.pause:
|
||||||
|
seconds: 10
|
||||||
|
|
||||||
|
- name: Allow SSH into LXC
|
||||||
|
ansible.builtin.command: lxc-attach -n 638 -- sed -i "s/#PermitRootLogin prohibit-password/PermitRootLogin yes/g" /etc/ssh/sshd_config
|
||||||
|
|
||||||
|
- name: Restart SSH Service
|
||||||
|
ansible.builtin.command: lxc-attach -n 638 service ssh restart
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
- name: Create directory for docker-compose
|
||||||
|
ansible.builtin.file:
|
||||||
|
path: /root/docker/
|
||||||
|
state: directory
|
||||||
|
mode: "0755"
|
||||||
|
|
||||||
|
- name: Copy docker-compose file
|
||||||
|
template:
|
||||||
|
src: "docker-compose.yml"
|
||||||
|
dest: /root/docker/docker-compose.yml
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- name: Run docker-compose
|
||||||
|
ansible.builtin.shell:
|
||||||
|
args:
|
||||||
|
cmd: docker compose up -d
|
||||||
|
chdir: /root/docker/
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
upsnap:
|
||||||
|
container_name: upsnap
|
||||||
|
image: ghcr.io/seriousm4x/upsnap:4
|
||||||
|
network_mode: host
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- /data:/app/pb_data
|
||||||
|
environment:
|
||||||
|
- TZ=Europe/Lisbon # Set container timezone for cron schedules
|
||||||
|
- UPSNAP_INTERVAL=@every 2h # Sets the interval in which the devices are pinged
|
||||||
|
- UPSNAP_SCAN_RANGE=10.0.0.0/21 # Scan range is used for device discovery on local network
|
||||||
|
- UPSNAP_WEBSITE_TITLE=Lino Silva # Custom website title
|
||||||
|
# dns is used for name resolution during network scan
|
||||||
|
dns:
|
||||||
|
- 10.0.2.11
|
||||||
|
- 10.0.2.12
|
||||||
|
- 10.0.2.13
|
||||||
|
healthcheck:
|
||||||
|
test: curl -fs "http://localhost:5000/api/health" || exit 1
|
||||||
|
interval: 10s
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
---
|
||||||
|
- name: Get convenience script
|
||||||
|
uri:
|
||||||
|
url: "https://get.docker.com"
|
||||||
|
method: GET
|
||||||
|
dest: /tmp/get-docker.sh
|
||||||
|
mode: a+x
|
||||||
|
creates: /tmp/get-docker.sh
|
||||||
|
|
||||||
|
- name: Execute script
|
||||||
|
ansible.builtin.shell: /tmp/get-docker.sh
|
||||||
|
|
||||||
|
- name: Ensure group "docker" exists
|
||||||
|
ansible.builtin.group:
|
||||||
|
name: docker
|
||||||
|
state: present
|
||||||
|
|
||||||
|
- name: Add root user to docker group
|
||||||
|
ansible.builtin.user:
|
||||||
|
name: root
|
||||||
|
groups: docker
|
||||||
|
append: yes
|
||||||
|
|
||||||
|
- name: Enable docker on startup
|
||||||
|
ansible.builtin.shell: |
|
||||||
|
systemctl enable docker.service
|
||||||
|
systemctl enable containerd.service
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
---
|
||||||
|
- name: Create container
|
||||||
|
community.general.proxmox:
|
||||||
|
vmid: 638
|
||||||
|
node: mipha
|
||||||
|
api_user: root@pam
|
||||||
|
api_password: "{{ proxmox_api_password }}"
|
||||||
|
api_host: 10.0.2.2
|
||||||
|
password: "{{ lxc_password }}"
|
||||||
|
hostname: upsnap
|
||||||
|
ostemplate: "local:vztmpl/debian-12-standard_12.0-1_amd64.tar.zst"
|
||||||
|
netif: "{'net0':'name=eth0,\
|
||||||
|
gw=10.0.0.1,\
|
||||||
|
ip=10.0.2.38/21,\
|
||||||
|
hwaddr=cc:c6:cf:de:20:38,\
|
||||||
|
bridge=vmbr0'}"
|
||||||
|
cores: 1024
|
||||||
|
memory: 2048
|
||||||
|
unprivileged: no
|
||||||
|
swap: 0
|
||||||
|
searchdomain: "home"
|
||||||
|
onboot: 1
|
||||||
|
features:
|
||||||
|
- nesting=1
|
||||||
|
- keyctl=1
|
||||||
|
mounts: '{
|
||||||
|
"mp0":"local-lvm:2,mp=/data,backup=1"
|
||||||
|
}'
|
||||||
|
disk: local-lvm:10
|
||||||
|
force: yes
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
---
|
||||||
|
- name: Stop container
|
||||||
|
community.general.proxmox:
|
||||||
|
vmid: "{{ vmid }}"
|
||||||
|
api_user: root@pam
|
||||||
|
api_password: "{{ proxmox_api_password }}"
|
||||||
|
api_host: 10.0.2.2
|
||||||
|
state: stopped
|
||||||
|
ignore_errors: true
|
||||||
|
timeout: 90
|
||||||
|
|
||||||
|
- name: Remove containers
|
||||||
|
community.general.proxmox:
|
||||||
|
vmid: "{{ vmid }}"
|
||||||
|
api_user: root@pam
|
||||||
|
api_password: "{{ proxmox_api_password }}"
|
||||||
|
api_host: 10.0.2.2
|
||||||
|
state: absent
|
||||||
|
ignore_errors: true
|
||||||
|
timeout: 90
|
||||||
|
|
||||||
|
- name: Remove .ssh/known_hosts lines
|
||||||
|
ansible.builtin.lineinfile:
|
||||||
|
path: /Users/lino.silva/.ssh/known_hosts
|
||||||
|
state: absent
|
||||||
|
regexp: "^10.0.2.38"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
- name: Start deployments
|
||||||
|
community.general.proxmox:
|
||||||
|
vmid: "{{ vmid }}"
|
||||||
|
api_user: root@pam
|
||||||
|
api_password: "{{ proxmox_api_password }}"
|
||||||
|
api_host: 10.0.2.2
|
||||||
|
state: started
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
- name: Update all packages to their latest version
|
||||||
|
become: true
|
||||||
|
ansible.builtin.apt:
|
||||||
|
update_cache: yes
|
||||||
|
upgrade: full
|
||||||
Reference in New Issue
Block a user