Hi all,
I have a nice LXC role in Ansible to create new containers:
So far, so good. This works perfect.
But now I want to change something. Like... double the memory, or changing the network from dhcp to static... anything
If I change the parameters of the proxmox role in my yaml file, then Ansible does not compare it to the existing container. So nothing happens.
My workaround is to completely destroy the container first, and then rerun the playbook.
This is not what I expect. I expect Ansible to bring the container to the desired state.
Has anyone found a good solution for this?
I have a nice LXC role in Ansible to create new containers:
YAML:
- name: include password
include_vars:
file: vars/proxmox_root_password.yml
- name: create container
proxmox:
vmid: "{{ lxc_vmid }}"
node: "{{ inventory_hostname }}"
api_user: root@pam
api_password: "{{ proxmox_root_password }}"
api_host: "{{ inventory_hostname }}"
hostname: "{{ lxc_hostname }}"
ostemplate: "{{ lxc_template }}"
storage: local-lvm
pool: "{{ lxc_pool }}"
password: "{{ proxmox_root_password }}"
cores: "{{ lxc_cores }}"
memory: "{{ lxc_memory }}"
swap: "{{ lxc_swap }}"
disk: "{{ lxc_disk_gb }}"
netif: '{"net0":"name=eth0,{{ lxc_network }},bridge=vmbr0"}'
features:
- "nesting={{ lxc_nesting }}"
state: present
register: lxc_output
- name: read vmid
set_fact:
vmid: "{{ lxc_output.msg | regex_search('\\b\\d{1,}\\b') }}"
- name: make sure container is started
proxmox:
vmid: "{{ vmid }}"
api_user: root@pam
api_password: "{{ proxmox_root_password }}"
api_host: "{{ inventory_hostname }}"
state: started
So far, so good. This works perfect.
But now I want to change something. Like... double the memory, or changing the network from dhcp to static... anything
If I change the parameters of the proxmox role in my yaml file, then Ansible does not compare it to the existing container. So nothing happens.
My workaround is to completely destroy the container first, and then rerun the playbook.
This is not what I expect. I expect Ansible to bring the container to the desired state.
Has anyone found a good solution for this?