AnsibleUndefinedVariable: ''ansible.utils.unsafe_proxy.AnsibleUnsafeText object'' has no attribute ''total_mb'''
OS on each node Ubuntu 22.04 lts
I'm installing slurm on a cluster made of login node and 3 comp. nodes (node 1,node2 and node4). I have the following error during slurm installation
ansible-playbook -l slurm-cluster playbooks/slurm-cluster.yml
when this part is executed:
Install Slurm
- include: slurm-cluster/slurm.yml
try manually running the memory fact gathering script to see if it produces unexpected output:
bash roles/facts/files/memory.fact
These are the outcomes:
login -> { "total_mb": 60799 } node1 -> { "total_mb": 60768 } node2 -> { "total_mb": 244559 } node4-> { "total_mb": 244559 }
Moreover in hostvars for each node memory : total_mb varibale is defined.
does it work if you comment out the memory variable in your hostvars file?
I tried using a custom slurm.conf where memory is defined for each node and without using hostvars. The error is still present
Im wondering if the memory fact is coming back as a json string such that the dictionary parsing isn't working?
I could be wrong but I remember running into Ansible type coercion unexpectedly leading to UnsafeText for something else.
For the repo I ran grep -R "memory.total_mb" . and got back ./roles/slurm/templates/etc/slurm/slurm.conf: RealMemory={{ memory.total_mb|int }}{{ " " -}}
Im wondering in your slurm.conf after line 135 (the {% set memory = hostvars[node_name]["ansible_local"]["memory"] -%} line) if you added specific casting {% set mem = memory if memory is mapping else (memory | from_json) %} it would work?
Actually memory is defined manually for each node
In that case if you just want to work around it, you could comment out the lines in slurm.conf that reference memory.total_mb. I haven't been able to reproduce this issue, so you could also try removing any customization you've done and see if that helps.
This issue is stale because it has been open for 60 days with no activity. Please update the issue or it will be closed in 7 days.