feat: Use ansible_password variable for LXC password and SSH pass, include vars.yml, and enable Proxmox LXC updates.

This commit is contained in:
2026-01-04 11:23:19 +01:00
parent 2ff405c96e
commit 03dedfda68
2 changed files with 7 additions and 3 deletions

View File

@@ -1,4 +1,6 @@
# Copy this into secrets.yml and replate with a real values ### Copy this into secrets.yml and replate with a real values ###
# Password used for Ansible to connect to LXC as root (if not using SSH keys)
ansible_password: 'REPLACE_WITH_ROOT_PASSWORD' ansible_password: 'REPLACE_WITH_ROOT_PASSWORD'
# Zabbix proxy parameters for connecting to Zabbix server # Zabbix proxy parameters for connecting to Zabbix server
zabbix_server_address: 'x.x.x.x' zabbix_server_address: 'x.x.x.x'

View File

@@ -4,6 +4,7 @@
gather_facts: no gather_facts: no
vars_files: vars_files:
- "../secrets.yml" - "../secrets.yml"
- "../vars.yml"
vars_prompt: vars_prompt:
- name: container_name - name: container_name
prompt: "Enter the new container name (e.g., my-service)" prompt: "Enter the new container name (e.g., my-service)"
@@ -26,12 +27,13 @@
api_user: "{{ proxmox_api_user }}" api_user: "{{ proxmox_api_user }}"
api_token_id: "{{ proxmox_api_token_id }}" api_token_id: "{{ proxmox_api_token_id }}"
api_token_secret: "{{ proxmox_api_token_secret }}" api_token_secret: "{{ proxmox_api_token_secret }}"
update: yes
node: "{{ proxmox_node }}" node: "{{ proxmox_node }}"
storage: "{{ proxmox_storage }}" storage: "{{ proxmox_storage }}"
ostemplate: '{{ proxmox_storage }}:vztmpl/ubuntu-24.04-standard_24.04-2_amd64.tar.zst' ostemplate: '{{ proxmox_storage }}:vztmpl/ubuntu-24.04-standard_24.04-2_amd64.tar.zst'
vmid: "{{ container_id }}" vmid: "{{ container_id }}"
hostname: "{{ container_name }}" hostname: "{{ container_name }}"
password: "TempPassword123!" # Temporary password, will be disabled by lxc_setup password: "{{ ansible_password }}"
netif: netif:
net0: "name=eth0,gw=10.0.0.1,ip={{ container_ip_cidr }},bridge=vmbr0" net0: "name=eth0,gw=10.0.0.1,ip={{ container_ip_cidr }},bridge=vmbr0"
cores: 2 cores: 2
@@ -66,7 +68,7 @@
groups: new groups: new
ansible_host: "{{ container_ip_cidr | split('/') | first }}" ansible_host: "{{ container_ip_cidr | split('/') | first }}"
ansible_user: root ansible_user: root
ansible_ssh_pass: "TempPassword123!" ansible_ssh_pass: "{{ ansible_password }}"
# We need to ignore host key checking for the fresh container to avoid interactive prompt # We need to ignore host key checking for the fresh container to avoid interactive prompt
ansible_ssh_common_args: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null' ansible_ssh_common_args: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'