Compare commits
13 Commits
9200553be6
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
| db217f4ce2 | |||
| cdfcc844e0 | |||
| 71a98b34ca | |||
| d2ee60c0fb | |||
| baab14c3fc | |||
| 5e253db9c7 | |||
| 54ec2bdbee | |||
| 91d4dabea8 | |||
| 857813d78f | |||
| 43ce6a94c0 | |||
| 1ecc1775ef | |||
| 1ed42f148c | |||
| 0b286b5496 |
@@ -2,3 +2,4 @@
|
|||||||
|
|
||||||
ansible_become_passwd: "{{ ansible_password }}"
|
ansible_become_passwd: "{{ ansible_password }}"
|
||||||
human_admin_user: max
|
human_admin_user: max
|
||||||
|
proxmox_1_host: 192.168.0.2
|
||||||
|
|||||||
+40
-28
@@ -1,29 +1,41 @@
|
|||||||
---
|
---
|
||||||
physical:
|
all:
|
||||||
hosts:
|
children:
|
||||||
localhost:
|
physical:
|
||||||
ansible_become_password: "{{ ansible_become_passwd }}"
|
proxmox_1:
|
||||||
ansible_connection: local
|
ansible_host: "{{ proxmox_1_host }}"
|
||||||
ansible_python_interpreter: "{{ ansible_playbook_python }}"
|
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||||
services_to_run:
|
services_to_run: []
|
||||||
192.168.0.6:
|
virtual:
|
||||||
ansible_become_password: "{{ ansible_become_passwd }}"
|
hosts:
|
||||||
services_to_run:
|
localhost:
|
||||||
192.168.0.8:
|
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||||
ansible_become_password: "{{ ansible_become_passwd }}"
|
ansible_connection: local
|
||||||
services_to_run:
|
ansible_python_interpreter: "{{ ansible_playbook_python }}"
|
||||||
192.168.0.12:
|
services_to_run:
|
||||||
ansible_become_password: "{{ ansible_become_passwd }}"
|
- webhook
|
||||||
services_to_run:
|
nfs-server:
|
||||||
192.168.0.16:
|
ansible_host: 192.168.0.6
|
||||||
ansible_become_password: "{{ ansible_become_passwd }}"
|
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||||
services_to_run:
|
services_to_run: []
|
||||||
192.168.0.39:
|
jellyfin:
|
||||||
ansible_become_password: "{{ ansible_become_passwd }}"
|
ansible_host: 192.168.0.8
|
||||||
services_to_run:
|
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||||
ai-host:
|
services_to_run: []
|
||||||
ansible_host: 192.168.0.50
|
frigate:
|
||||||
ansible_become_password: "{{ ansible_become_passwd }}"
|
ansible_host: 192.168.0.12
|
||||||
services_to_run:
|
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||||
- coder_ai
|
services_to_run: []
|
||||||
|
vs-code:
|
||||||
|
ansible_host: 192.168.0.16
|
||||||
|
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||||
|
services_to_run: []
|
||||||
|
gitea-server:
|
||||||
|
ansible_host: 192.168.0.39
|
||||||
|
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||||
|
services_to_run: []
|
||||||
|
ai-host:
|
||||||
|
ansible_host: 192.168.0.50
|
||||||
|
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||||
|
services_to_run:
|
||||||
|
- coder_ai
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
---
|
---
|
||||||
- name: Deploy and set up an LXC container in Proxmox
|
- name: Deploy and set up an LXC container in Proxmox
|
||||||
hosts: all
|
hosts: virtual
|
||||||
remote_user: ansible
|
remote_user: ansible
|
||||||
|
|
||||||
vars_files:
|
vars_files:
|
||||||
|
|||||||
@@ -2,6 +2,6 @@
|
|||||||
|
|
||||||
- name: Make sure required services are running
|
- name: Make sure required services are running
|
||||||
ansible.builtin.service:
|
ansible.builtin.service:
|
||||||
name: "{{ item.name }}"
|
name: "{{ item }}"
|
||||||
state: started
|
state: started
|
||||||
loop: "{{ services_to_run }}"
|
loop: "{{ services_to_run }}"
|
||||||
|
|||||||
@@ -23,8 +23,8 @@
|
|||||||
become: false
|
become: false
|
||||||
# We have to use this complicated pipeline because of Alpine and its wierd df implementation
|
# We have to use this complicated pipeline because of Alpine and its wierd df implementation
|
||||||
ansible.builtin.shell: set -o pipefail && df -h / | tail -1 | awk '{gsub(/%/, "", $5); print $5}'
|
ansible.builtin.shell: set -o pipefail && df -h / | tail -1 | awk '{gsub(/%/, "", $5); print $5}'
|
||||||
register: free_disk_space_result
|
register: common_healthcheck_space_left_result
|
||||||
failed_when: free_disk_space_result.stdout | int > 85
|
failed_when: common_healthcheck_space_left_result.stdout | int > 85
|
||||||
changed_when: false # This task does not change the system
|
changed_when: false # This task does not change the system
|
||||||
|
|
||||||
rescue:
|
rescue:
|
||||||
@@ -41,5 +41,9 @@
|
|||||||
body:
|
body:
|
||||||
- "{{ ansible_facts['hostname'] }}: Disk space is low"
|
- "{{ ansible_facts['hostname'] }}: Disk space is low"
|
||||||
delegate_to: 127.0.0.1
|
delegate_to: 127.0.0.1
|
||||||
failed_when: false
|
failed_when: false # It's OK if it fails, not critical
|
||||||
changed_when: false # This task does not change the system
|
changed_when: false # This task does not change the system
|
||||||
|
|
||||||
|
- name: Resize rootfs if it's an LXC
|
||||||
|
ansible.builtin.include_tasks: resize_lxc_rootfs.yaml
|
||||||
|
when: ansible_virtualization_type == 'lxc'
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
- name: Get container info by name
|
||||||
|
delegate_to: localhost
|
||||||
|
become: false
|
||||||
|
community.general.proxmox_vm_info:
|
||||||
|
validate_certs: false
|
||||||
|
node: proxmox-server
|
||||||
|
api_user: root@pam
|
||||||
|
api_host: 192.168.0.2
|
||||||
|
api_token_id: ansible
|
||||||
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
|
name: "{{ inventory_hostname }}"
|
||||||
|
type: lxc
|
||||||
|
register: common_healthcheck_vmid
|
||||||
|
|
||||||
|
- name: Resize LXC's rootfs
|
||||||
|
become: true
|
||||||
|
ansible.builtin.command:
|
||||||
|
cmd: pct resize {{ common_healthcheck_vmid.proxmox_vms[0].vmid }} rootfs +5G
|
||||||
|
delegate_to: 192.168.0.2
|
||||||
|
changed_when: true
|
||||||
|
vars:
|
||||||
|
ansible_become_password: "{{ ansible_become_passwd }}"
|
||||||
@@ -6,7 +6,7 @@
|
|||||||
validate_certs: false
|
validate_certs: false
|
||||||
node: proxmox-server
|
node: proxmox-server
|
||||||
api_user: root@pam
|
api_user: root@pam
|
||||||
api_host: 192.168.0.2
|
api_host: "{{ proxmox_1_host }}"
|
||||||
api_token_id: ansible
|
api_token_id: ansible
|
||||||
api_token_secret: "{{ proxmox_token_secret }}"
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
@@ -34,7 +34,7 @@
|
|||||||
validate_certs: false
|
validate_certs: false
|
||||||
node: proxmox-server
|
node: proxmox-server
|
||||||
api_user: root@pam
|
api_user: root@pam
|
||||||
api_host: 192.168.0.2
|
api_host: "{{ proxmox_1_host }}"
|
||||||
api_token_id: ansible
|
api_token_id: ansible
|
||||||
api_token_secret: "{{ proxmox_token_secret }}"
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
validate_certs: false
|
validate_certs: false
|
||||||
node: proxmox-server
|
node: proxmox-server
|
||||||
api_user: root@pam
|
api_user: root@pam
|
||||||
api_host: 192.168.0.2
|
api_host: "{{ proxmox_1_host }}"
|
||||||
api_token_id: ansible
|
api_token_id: ansible
|
||||||
api_token_secret: "{{ proxmox_token_secret }}"
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
validate_certs: false
|
validate_certs: false
|
||||||
node: proxmox-server
|
node: proxmox-server
|
||||||
api_user: root@pam
|
api_user: root@pam
|
||||||
api_host: 192.168.0.2
|
api_host: "{{ proxmox_1_host }}"
|
||||||
api_token_id: ansible
|
api_token_id: ansible
|
||||||
api_token_secret: "{{ proxmox_token_secret }}"
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
@@ -49,7 +49,7 @@
|
|||||||
validate_certs: false
|
validate_certs: false
|
||||||
node: proxmox-server
|
node: proxmox-server
|
||||||
api_user: root@pam
|
api_user: root@pam
|
||||||
api_host: 192.168.0.2
|
api_host: "{{ proxmox_1_host }}"
|
||||||
api_token_id: ansible
|
api_token_id: ansible
|
||||||
api_token_secret: "{{ proxmox_token_secret }}"
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
@@ -64,10 +64,9 @@
|
|||||||
validate_certs: false
|
validate_certs: false
|
||||||
node: proxmox-server
|
node: proxmox-server
|
||||||
api_user: root@pam
|
api_user: root@pam
|
||||||
api_host: 192.168.0.2
|
api_host: "{{ proxmox_1_host }}"
|
||||||
api_token_id: ansible
|
api_token_id: ansible
|
||||||
api_token_secret: "{{ proxmox_token_secret }}"
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
name: "{{ vm_hostname }}"
|
name: "{{ vm_hostname }}"
|
||||||
state: started
|
state: started
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
validate_certs: false
|
validate_certs: false
|
||||||
node: proxmox-server
|
node: proxmox-server
|
||||||
api_user: root@pam
|
api_user: root@pam
|
||||||
api_host: 192.168.0.2
|
api_host: "{{ proxmox_1_host }}"
|
||||||
api_token_id: ansible
|
api_token_id: ansible
|
||||||
api_token_secret: "{{ proxmox_token_secret }}"
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
validate_certs: false
|
validate_certs: false
|
||||||
node: proxmox-server
|
node: proxmox-server
|
||||||
api_user: root@pam
|
api_user: root@pam
|
||||||
api_host: 192.168.0.2
|
api_host: "{{ proxmox_1_host }}"
|
||||||
api_token_id: ansible
|
api_token_id: ansible
|
||||||
api_token_secret: "{{ proxmox_token_secret }}"
|
api_token_secret: "{{ proxmox_token_secret }}"
|
||||||
|
|
||||||
@@ -19,4 +19,3 @@
|
|||||||
timeout: 120
|
timeout: 120
|
||||||
delegate_to: localhost
|
delegate_to: localhost
|
||||||
changed_when: false
|
changed_when: false
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user