Skip to content

Commit

Permalink
feat: configure pve1 (#1235)
Browse files Browse the repository at this point in the history
  • Loading branch information
ferrarimarco authored Mar 30, 2024
1 parent 82f8c47 commit 3880bb8
Show file tree
Hide file tree
Showing 9 changed files with 71 additions and 16 deletions.
1 change: 1 addition & 0 deletions config/ansible/inventory/group_vars/all/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
ansible_python_interpreter: auto_silent
# Automatically accept new host keys for hosts in the inventory
ansible_ssh_common_args: "-o StrictHostKeyChecking=accept-new"
ansible_user: root
cam_3_rtps_password: "{{ vault_cam_3_rtps_password }}"
cam_3_rtps_username: "{{ vault_cam_3_rtps_username }}"
frigate_http_endpoint_fqdn: "raspberrypi2.{{ edge_environment_root_fqdn }}"
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
---
is_proxmox_node: true
...
9 changes: 9 additions & 0 deletions config/ansible/inventory/hosts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ all:
home_lab:
children:
home_lab_raspberry_pis: null
home_lab_proxmox_nodes: null
home_lab_raspberry_pis:
hosts:
raspberrypi.edge.lab.ferrari.how: null
raspberrypi2.edge.lab.ferrari.how: null
raspberrypi3.edge.lab.ferrari.how: null
home_lab_proxmox_nodes:
hosts:
pve1.edge.lab.ferrari.how:
network_interfaces:
- mac_address: "7c:83:34:be:3f:23"
interface_name: enp1s0
- mac_address: "7c:83:34:be:3f:24"
interface_name: enp2s0
...
3 changes: 3 additions & 0 deletions config/ansible/playbooks/main.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
---
- name: Import the boot bare metal playbook
ansible.builtin.import_playbook: boot-bare-metal.yaml

- name: Import the bootstrap playbook
ansible.builtin.import_playbook: bootstrap.yaml

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@
tags:
- always

- name: Register facts
ansible.builtin.import_tasks:
file: register-bootstrap-facts.yaml
tags:
- always
- name: Setup Proxmox
ansible.builtin.include_tasks:
file: setup-Proxmox.yaml
when:
- is_proxmox_node

- name: Setup OS
ansible.builtin.include_tasks:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,14 @@
Ansible hostname: {{ ansible_hostname }}
Ansible kernel: {{ ansible_kernel }}
Ansible OS family: {{ ansible_os_family }}
Ansible user: {{ ansible_user }}
Inventory hostname: {{ inventory_hostname }}
Inventory hostname short: {{ inventory_hostname_short }}
- name: Print gathered facts - {{ inventory_hostname }}
ansible.builtin.debug:
msg: |
Facts for {{ inventory_hostname }}:
{{ hostvars[inventory_hostname] | to_nice_json }}
verbosity: 1
...

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
- name: Disable PVE enterprise repositories
ansible.builtin.deb822_repository:
name: "{{ item.name }}"
uris: "{{ item.uris }}"
suites: "{{ ansible_distribution_release }}"
components: enterprise
state: absent
types: deb
become: true
with_items:
- name: pve-enterprise
uris: https://enterprise.proxmox.com/debian/pve
- name: ceph
uris: https://enterprise.proxmox.com/debian/ceph-quincy

- name: Remove enterprise APT repository files
ansible.builtin.file:
path: "{{ item }}"
state: absent
become: true
with_items:
- /etc/apt/sources.list.d/ceph.list
- /etc/apt/sources.list.d/pve-enterprise.list

- name: Enable PVE no-subscription repositories
ansible.builtin.deb822_repository:
name: "{{ item.name }}"
uris: "{{ item.uris }}"
suites: "{{ ansible_distribution_release }}"
components: "{{ item.components }}"
signed_by: https://enterprise.proxmox.com/debian/proxmox-release-bookworm.gpg
types: deb
become: true
with_items:
- name: pve-no-subscription
uris: http://download.proxmox.com/debian/pve
components: pve-no-subscription
- name: ceph
uris: http://download.proxmox.com/debian/ceph-reef
components: no-subscription
...
3 changes: 0 additions & 3 deletions scripts/run-ansible.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,6 @@ echo "ANSIBLE_VAULT_FULL_ID: ${ANSIBLE_VAULT_FULL_ID}"

if [ -n "${1:-}" ]; then
COMMAND_TO_RUN="${COMMAND_TO_RUN} ${1}"
elif [ "${ANSIBLE_GATHER_FACTS_INVENTORY:-"false"}" = "true" ]; then
ANSIBLE_COMMAND_GATHER_FACTS_INVENTORY="ansible -m ansible.builtin.setup --inventory ${ANSIBLE_INVENTORY_PATH} all"
COMMAND_TO_RUN="${COMMAND_TO_RUN} ${ANSIBLE_COMMAND_GATHER_FACTS_INVENTORY}"
elif [ "${ANSIBLE_EDIT_VAULT_FILE:-"false"}" = "true" ]; then
ANSIBLE_VAULT_FILE_PATH="${ANSIBLE_VAULT_FILE_PATH:-"${ANSIBLE_DIRECTORY_INSIDE_CONTAINER_MOUNT_PATH}/inventory/group_vars/all/vault.yaml"}"
ANSIBLE_COMMAND_EDIT_VAULT_FILE="ansible-vault edit --vault-id ${ANSIBLE_VAULT_FULL_ID} ${ANSIBLE_VAULT_FILE_PATH}"
Expand Down

0 comments on commit 3880bb8

Please sign in to comment.