Closed nicholasrodriguez closed 5 years ago
Files identified in the description:
If these files are inaccurate, please update the component name
section of the description or use the !component
bot command.
cc @Akasurde @dav1x @warthog9 click here for bot help
Hi @nicholasrodriguez,
Thank you for the issue, just so you are aware we have a dedicated Working Group for vmware. You can find other people interested in this in #ansible-vmware on Freenode IRC For more information about communities, meetings and agendas see https://github.com/ansible/community
@nicholasrodriguez Thanks for reporting this issue. Could you please try this https://github.com/ansible/ansible/pull/41343 and let me know if it works for you ? Thanks.
Using this version
I'm getting a failure with a really odd result as I'm not even making any changes to Vpx.Vpxa.config.log.level
*
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: KeyError: 'Vpx.Vpxa.config.log.level'
fatal: [<VCENTER SERVER>]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/tmp/ansible_767s6b/ansible_module_vmware_host_config_manager.py\", line 197, in <module>\n main()\n File \"/tmp/ansible_767s6b/ansible_module_vmware_host_config_manager.py\", line 193, in main\n vmware_host_config.set_host_configuration_facts()\n File \"/tmp/ansible_767s6b/ansible_module_vmware_host_config_manager.py\", line 129, in set_host_configuration_facts\n host_facts[s_option.key].update(\nKeyError: 'Vpx.Vpxa.config.log.level'\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 1}
@nicholasrodriguez Could you please do following -
Thanks,
Hi @Akasurde I got the same error as before except the error line is now 132. Output from facts is below, I've had to obfuscate some values
For readability add file to - https://github.com/Akasurde/ansible-reproducers/blob/master/44561/user_console.txt
Strange, I am able to run whole playbook given in reproducer
changed: [localhost] => {
"changed": true,
"invocation": {
"module_args": {
"cluster_name": null,
"esxi_hostname": "xx.xx.xx.xx",
"hostname": "xx.xx.xx.xx",
"options": {
"DCUI.Access": "root",
"Mem.ShareForceSalting": 2,
"Security.AccountLockFailures": 3,
"Security.AccountUnlockTime": 900,
"Security.PasswordQualityControl": "retry=3 min=disabled,disabled,disabled,14,14",
"UserVars.DcuiTimeOut": 1200,
"UserVars.ESXiShellInteractiveTimeOut": 1800,
"UserVars.ESXiShellTimeOut": 1800,
"Vpx.Vpxa.config.log.level": "info"
},
"password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
"port": 443,
"username": "administrator@vsphere.local",
"validate_certs": false
}
}
}
This is ESXi 6.5
I'll rebuild a server with 6.5 and will test
I've tried the fix against a 6.5 host and got the same result.
As the play is also using a 6.7 vCenter I replaced the reference to vCenter with the direct connection details of the esxi host so that the play is targetting the host directly as below and it works against a 6.5;
I'm going to rebuild the host back to ESXi 6.7 and will try again but it looks to be vCenter 6.7 possibly causing the issue.
task
- name: 'Set ESXi advanced options'
connection: 'local'
vmware_host_config_manager:
hostname: '{{ ansible_host }}'
username: '{{ esxi_root_account }}'
password: '{{ esxi_password }}'
cluster_name: '{{ cluster_name }}'
validate_certs: '{{ validate_certs }}'
options:
'{{ esxi_advanced_options }}'
I've rebuilt three ESXi6.7 servers and have run several tests.
Just to be clear, so I'm not using the module incorrectly, was the intention for it to be run against either a cluster in vCenter or directly against a ESXi host?
I don't have scope to downgrade my vCenter to 6.5 to test this variation but for now I'll use the fixed module but will target hosts directly rather than via a cluster in vCenter. This only involves a slight change to my playbook.
Thanks again for all the contributions to these modules.
@nicholasrodriguez I don't have access to 6.7 so won't be able to test this. So, to summarise, if you use direct ESXi host it will work but if you use cluster it won't work. Right? I will keep this open till I get access to 6.7.
Hi @Akasurde , correct. Let me know if there are any further detailed tests I could run that might help.
cc @ckotte click here for bot help
I just hit this on ansible v2.7.6.
This error occurs when going thru vcenter 6.7, because the list of settings from vmware_host_config_facts
doesn't include Vpx.Vpxa.config.log.level
.
I just hit this on ansible v2.7.6.
This error occurs when going thru vcenter 6.7, because the list of settings from
vmware_host_config_facts
doesn't includeVpx.Vpxa.config.log.level
.
Same here, I hope this will get fixed soon
I think the problem is here:
option_manager = host.configManager.advancedOption
host_facts = {}
for option in option_manager.QueryOptions():
host_facts[option.key] = dict(value=option.value)
for s_option in option_manager.supportedOption:
host_facts[s_option.key].update(
option_type=s_option.optionType,
)
option_manager.supportedOption
returns Vpx.Vpxa.config.log.level
but option_manager.QueryOptions()
doesn't. The effect is that the code tries to update host_fachts['Vpx.Vpxa.config.log.level'] which doesn't exist.
We have this problem with newly installed ESXi 6.7U1 hosts but not with those we upgraded from 6.5. I think this is because this setting existed there and was inherited from the 6.7 hosts when upgraded.
btw: Can anyone please add the affects_2.7 label?
cc @lparkes click here for bot help
@ivgivanov @nicholasrodriguez @dandunckelman Could you please check if this PR works for you ? I don't have 6.7 setup so can't test but code wise lgtm.
@mariolenz Thanks for debugging and sending PR.
cc @Tomorrow9 click here for bot help
@Akasurde @mariolenz
It did not work. Here's what I did:
Updated requirements.txt
with this:
-e git://github.com/mariolenz/ansible.git@devel#egg=ansible
Installed the module:
pip install -r requirements.txt
Created this playbook:
I then ran ansible-playbook
and got this error:
File \"/root/.ansible/tmp/ansible-tmp-1550859701.04-44669256113758/AnsiballZ_vmware_host_config_manager.py\", line 113, in
vmware_host_config_facts
: https://gist.github.com/dandunckelman/8f23665bff96f0b411da33962456cd80Are you sure you're testing my code?
File \"/tmp/ansible_vmware_host_config_manager_payload_iqoNvS/__main__.py\", line 136, in set_host_configuration_facts KeyError: 'Vpx.Vpxa.config.log.level'
In my commit, line 136 looks like this:
if option.key in host_facts:
I don't see how this can trigger a KeyError. It looks like you're still using the old code where line 136 looks like this:
host_facts[s_option.key].update(
@mariolenz blarg. I'm guessing when I ran pip install
, it didn't really overwrite what I had.
Retrying completely fresh. I'll update ASAP.
@mariolenz it worked as expected!
I retested, and this time I confirmed that I had the right code (checking that line 136). Did what it was supposed to do.
SUMMARY
When configuring multiple advanced options that are preceeded with UserVars. I get the following error
fatal: []: FAILED! => {"changed": false, "msg": "Failed to update option/s as one or more OptionValue contains an invalid value: A specified parameter was not correct: "}
If I change 1 UserVar at a time per play then the module works, examples below in a Test Actions section below
ISSUE TYPE
COMPONENT NAME
vmware_host_config_manager
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
Source Ansible environment CentOS 7 Target vCenter 6.7 Target ESXi hosts 6.7
STEPS TO REPRODUCE
EXPECTED RESULTS
All the options in esxi_advanced_options are set
ACTUAL RESULTS
TEST ACTIONS
The various combinations will work below
These additional combinations fail