Closed Mohitsharma44 closed 1 year ago
It's restricted to executing on the first node in pve_group
because, if I recall correctly, configuring storage is a cluster-wide operation and not doing so introduces race conditions.
I believe what you want to do is set nodes
in the pve_storages
variable to that particular node. In other words:
group_vars/all.yml
:
pve_group: hypervisors
pve_cluster_clustername: phoenixDC
pve_manage_ssh: true
pve_cluster_enabled: true
pve_manage_hosts_enabled: true
pve_storages:
- name: 4tbdata-vmdata
type: dir
path: /vmdata
maxfiles: 60 # Max number of backup files per VM
content: ["images", "iso", "backup", "snippets", "vztmpl"]
nodes: ["pve03"]
Does that work for you?
Yep.. that works. RTFM! And yeah, you're right, configuring storage is a cluster-wide operation.
Thanks alot!
Hey team,
Thanks for the fantastic ansible role. I have a use case where I want to create
pve_storage
s of typedir
at differentpath
for each node in a cluster.The following layout may explain what Im trying to do better.
inventory/ hypervisors.ini
group_vars/ all.yml:
host_vars/ pve03/all.yml:
Now the playbook run shows the
Configure Proxmox Storage
task gets skipped.Sample output:
It seems like this line of code: https://github.com/lae/ansible-role-proxmox/blob/e2c6015c002aeb27dbe3ea700c75ef6cd6a87a67/tasks/main.yml#L290 restricts any storage operation only to the first node in the pve_group. I'm trying to understand the reason behind it.
I believe the
when
condition could instead be:(I'm not sure how this would affect other storage types though..)