Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AnsibleUndefinedVariable: {{ ansible_processor_vcpus }} when running role #135

Closed
jlownie opened this issue Oct 26, 2021 · 2 comments
Closed

Comments

@jlownie
Copy link

jlownie commented Oct 26, 2021

We ran the role (v1.0.2) on a host and got this error message:

ASK [lae.netbox : Configure uWSGI NetBox application] **************************************************************************************************************************************************************************************
fatal: [xxx.sol1.net]: FAILED! => {"changed": false, "msg": "AnsibleUndefinedVariable: {{ ansible_processor_vcpus }}: 'ansible_processor_vcpus' is undefined"}

The variable ansible_processor_vcpus isn't referenced in that task but it is referenced in defaults/main.yml:
netbox_processes: "{{ ansible_processor_vcpus }}"

We changed it to this and it worked:
netbox_processes: "{{ ansible_processor_vcpus | default(4) }}"

I'm not sure why that var is undefined - from what I've read it's supposed to be set automatically somewhere. So I'm not sure if what we've done is the best solution but I'm happy to submit it in a pull request if people think it's OK.

@lae
Copy link
Owner

lae commented Oct 26, 2021

That change is fine I think, but I believe default(1) would be more appropriate here—wouldn't make too much sense to set it to 4 for example on a 1 core virtual machine/VPS.

@lae
Copy link
Owner

lae commented Oct 31, 2021

fixed in 99d3dca

@lae lae closed this as completed Oct 31, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants