Closed stintel closed 2 years ago
I see a few options:
Not sure what I prefer yet...
Setting the template for all would be a bad idea. So we should find the right one (if possible) or reject at all.
I'm getting the same issue with foreman_host.py when trying to specify "operatingsystem".
As I have multiple "CentOS" versions defined, it seems to be giving me the same error...
The full traceback is:
Traceback (most recent call last):
File "/home/mnguyen/.ansible/tmp/ansible-tmp-1567542570.99-20348233523044/AnsiballZ_foreman_host.py", line 114, in <module>
_ansiballz_main()
File "/home/mnguyen/.ansible/tmp/ansible-tmp-1567542570.99-20348233523044/AnsiballZ_foreman_host.py", line 106, in _ansiballz_main
invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)
File "/home/mnguyen/.ansible/tmp/ansible-tmp-1567542570.99-20348233523044/AnsiballZ_foreman_host.py", line 49, in invoke_module
imp.load_module('__main__', mod, module, MOD_DESC)
File "/tmp/ansible_foreman_host_payload_6TJWMs/__main__.py", line 742, in <module>
File "/tmp/ansible_foreman_host_payload_6TJWMs/__main__.py", line 735, in main
File "/tmp/ansible_foreman_host_payload_6TJWMs/__main__.py", line 406, in ensure
AttributeError: 'list' object has no attribute 'get'
fatal: [localhost]: FAILED! => {
"changed": false,
"module_stderr": "Traceback (most recent call last):\n File \"/home/mnguyen/.ansible/tmp/ansible-tmp-1567542570.99-20348233523044/AnsiballZ_foreman_host.py\", line 114, in <module>\n _ansiballz_main()\n File \"/home/mnguyen/.ansible/tmp/ansible-tmp-1567542570.99-20348233523044/AnsiballZ_foreman_host.py\", line 106, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/home/mnguyen/.ansible/tmp/ansible-tmp-1567542570.99-20348233523044/AnsiballZ_foreman_host.py\", line 49, in invoke_module\n imp.load_module('__main__', mod, module, MOD_DESC)\n File \"/tmp/ansible_foreman_host_payload_6TJWMs/__main__.py\", line 742, in <module>\n File \"/tmp/ansible_foreman_host_payload_6TJWMs/__main__.py\", line 735, in main\n File \"/tmp/ansible_foreman_host_payload_6TJWMs/__main__.py\", line 406, in ensure\nAttributeError: 'list' object has no attribute 'get'\n",
"module_stdout": "",
"msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
"rc": 1
}
Any chance of implementing the same fix in there also?
The foreman_os_default_template module doesn't seem to work.
Example playbook:
Results in this error:
This happens because I have >1 Ubuntu versions in Foreman. In this case, search_operatingsystem returns a list. Removing either of them solves the issue.
vs
Reporting it here as I'm not sure how to fix this yet. Maybe someone else has a great idea.