Open davibaldin opened 3 years ago
@davibaldin:
There is no issue in the playbook or switch/dellemc.os10 collections side.
The Issue is with the option which we have given in the ansible-playbook command.
In multiple ways we can issue the ansible-playbook command with multiple options.
I have tried with multiple options and its working fine.
To make it work we have to follow few steps:
In the current configuration, the reason for failure is: ansible-playbook -i "172.16.0.100," dell-os10-backup-config.yml -u admin -k -vvv
when we issue -i option - we have to provide name of the inventory file Ex: -i inventory.yaml
If we want to configure on particular host/node, we have to use --limit or -l option ( not -i) when we are using --limit or -l option, please make sure that ip addresses defined in the /etc/ansible/hosts
For example: cat /etc/ansible/hosts 172.16.0.100 ansible_ssh_user=xxxxx ansible_ssh_pass=xxxx ansible_network_os=dellemc.os10.os10 ansible connection=network_cli
Same error message reproduced with "-i " option:
root@Ubuntu20-vm-038-037:~/os10-ansible# ansible-playbook -i "100.104.40.188," os10_show-version-Issue_95.yaml -u admin -k -vvv ansible-playbook [core 2.12.0] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible-playbook python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0] jinja version = 2.10.1 libyaml = True No config file found; using defaults SSH password: Parsed 100.104.40.188, inventory source with host_list plugin redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10 Skipping callback 'default', as we already have a stdout callback. Skipping callback 'minimal', as we already have a stdout callback. Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: os10_show-version-Issue_95.yaml *** 1 plays in os10_show-version-Issue_95.yaml
PLAY [Dell Switch OS10 Backup configuration] **** META: ran handlers redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10 [WARNING]: Collection ansible.netcommon does not support Ansible version 2.12.0
TASK [run show version on remote devices] *** task path: /root/os10-ansible/os10_show-version-Issue_95.yaml:6 redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10 redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10 The full traceback is: Traceback (most recent call last): File "/usr/local/lib/python3.8/dist-packages/ansible/executor/task_executor.py", line 158, in run res = self._execute() File "/usr/local/lib/python3.8/dist-packages/ansible/executor/task_executor.py", line 589, in _execute result = self._handler.run(task_vars=variables) File "/root/.ansible/collections/ansible_collections/dellemc/os10/plugins/action/os10.py", line 86, in run conn = Connection(socket_path) File "/usr/local/lib/python3.8/dist-packages/ansible/module_utils/connection.py", line 124, in init raise AssertionError('socket_path must be a value') AssertionError: socket_path must be a value fatal: [100.104.40.188]: FAILED! => { "msg": "Unexpected failure during module execution.", "stdout": "" }
PLAY RECAP ** 100.104.40.188 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
root@Ubuntu20-vm-038-037:~/os10-ansible#
Working scenario with "--limit or -l option"
root@Ubuntu20-vm-038-037:~/os10-ansible# ansible-playbook -l "100.104.40.188," os10_show-version-Issue_95.yaml -u admin -k -vvv ansible-playbook [core 2.12.0] config file = None configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] ansible python module location = /usr/local/lib/python3.8/dist-packages/ansible ansible collection location = /root/.ansible/collections:/usr/share/ansible/collections executable location = /usr/local/bin/ansible-playbook python version = 3.8.10 (default, Nov 26 2021, 20:14:08) [GCC 9.3.0] jinja version = 2.10.1 libyaml = True No config file found; using defaults SSH password: host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method auto declined parsing /etc/ansible/hosts as it did not pass its verify_file() method Parsed /etc/ansible/hosts inventory source with ini plugin redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10 Skipping callback 'default', as we already have a stdout callback. Skipping callback 'minimal', as we already have a stdout callback. Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: os10_show-version-Issue_95.yaml *** 1 plays in os10_show-version-Issue_95.yaml
PLAY [Dell Switch OS10 Backup configuration] **** META: ran handlers redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10 [WARNING]: Collection ansible.netcommon does not support Ansible version 2.12.0
TASK [run show version on remote devices] ***
task path: /root/os10-ansible/os10_show-version-Issue_95.yaml:6
redirecting (type: connection) ansible.builtin.network_cli to ansible.netcommon.network_cli
redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10
redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10
<100.104.40.188> ESTABLISH LOCAL CONNECTION FOR USER: root
<100.104.40.188> EXEC /bin/sh -c '( umask 77 && mkdir -p "echo /root/.ansible/tmp/ansible-local-9788cyqk3iut
"&& mkdir "echo /root/.ansible/tmp/ansible-local-9788cyqk3iut/ansible-tmp-1640610231.7725859-9795-167683172107117
" && echo ansible-tmp-1640610231.7725859-9795-167683172107117="echo /root/.ansible/tmp/ansible-local-9788cyqk3iut/ansible-tmp-1640610231.7725859-9795-167683172107117
" ) && sleep 0'
Using module file /root/.ansible/collections/ansible_collections/dellemc/os10/plugins/modules/os10_command.py
<100.104.40.188> PUT /root/.ansible/tmp/ansible-local-9788cyqk3iut/tmpkvr0rgdw TO /root/.ansible/tmp/ansible-local-9788cyqk3iut/ansible-tmp-1640610231.7725859-9795-167683172107117/AnsiballZ_os10_command.py
<100.104.40.188> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-local-9788cyqk3iut/ansible-tmp-1640610231.7725859-9795-167683172107117/ /root/.ansible/tmp/ansible-local-9788cyqk3iut/ansible-tmp-1640610231.7725859-9795-167683172107117/AnsiballZ_os10_command.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c '/usr/bin/python3 /root/.ansible/tmp/ansible-local-9788cyqk3iut/ansible-tmp-1640610231.7725859-9795-167683172107117/AnsiballZ_os10_command.py && sleep 0'
<100.104.40.188> EXEC /bin/sh -c 'rm -f -r /root/.ansible/tmp/ansible-local-9788cyqk3iut/ansible-tmp-1640610231.7725859-9795-167683172107117/ > /dev/null 2>&1 && sleep 0'
ok: [100.104.40.188] => {
"changed": false,
"invocation": {
"module_args": {
"commands": [
"show version"
],
"interval": 1,
"match": "all",
"provider": null,
"retries": 10,
"wait_for": null
}
},
"stdout": [
"Dell EMC Networking OS10 Enterprise\nCopyright (c) 1999-2021 by Dell Inc. All Rights Reserved.\nOS Version: 10.5.2.7\nBuild Version: 10.5.2.7.374\nBuild Time: 2021-07-28T04:48:16+0000\nSystem Type: S5248F-VM\nArchitecture: x86_64\nUp Time: 04:06:18"
],
"stdout_lines": [
[
"Dell EMC Networking OS10 Enterprise",
"Copyright (c) 1999-2021 by Dell Inc. All Rights Reserved.",
"OS Version: 10.5.2.7",
"Build Version: 10.5.2.7.374",
"Build Time: 2021-07-28T04:48:16+0000",
"System Type: S5248F-VM",
"Architecture: x86_64",
"Up Time: 04:06:18"
]
]
}
META: ran handlers
META: ran handlers
PLAY RECAP ** 100.104.40.188 : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
root@Ubuntu20-vm-038-037:~/os10-ansible#
@davibaldin, by any chance have you tried with provided steps/command : "--limit or -l option" if its working, shall we close this issue?
@davibaldin, have you tried with provided command : "--limit or -l option" Shall we close this issue, if it's working ?
I am waiting for your confirmation. @davibaldin, Shall we close this issue?
I'm facing the same problems on the latest os10 collection
$ ansible-playbook test.yml -vvv -l lon1sw1
ansible-playbook [core 2.13.7]
config file = /Users/weakcamel/git/internal-networking/ansible.cfg
configured module search path = ['/Users/weakcamel/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /Users/weakcamel/git/internal-networking/.venv/lib/python3.9/site-packages/ansible
ansible collection location = /Users/weakcamel/git/internal-networking/galaxy-collections
executable location = /Users/weakcamel/git/internal-networking/.venv/bin/ansible-playbook
python version = 3.9.16 (main, Dec 7 2022, 10:16:11) [Clang 14.0.0 (clang-1400.0.29.202)]
jinja version = 3.1.2
libyaml = True
Using /Users/weakcamel/git/internal-networking/ansible.cfg as config file
script declined parsing /Users/weakcamel/git/internal-networking/inventory/networking.yml as it did not pass its verify_file() method
Parsed /Users/weakcamel/git/internal-networking/inventory/networking.yml inventory source with yaml plugin
redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10
redirecting (type: callback) ansible.builtin.yaml to community.general.yaml
redirecting (type: callback) ansible.builtin.yaml to community.general.yaml
Skipping callback 'default', as we already have a stdout callback.
Skipping callback 'minimal', as we already have a stdout callback.
Skipping callback 'oneline', as we already have a stdout callback.
PLAYBOOK: test.yml *****************************************************************************************************************************************************************************************
1 plays in test.yml
PLAY [Dell Switch OS10 Backup configuration] ***************************************************************************************************************************************************************
META: ran handlers
redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10
TASK [run show version on remote devices] ******************************************************************************************************************************************************************
task path: /Users/weakcamel/git/internal-networking/test.yml:6
redirecting (type: lookup) ansible.builtin.hashi_vault to community.hashi_vault.hashi_vault
redirecting (type: lookup) ansible.builtin.hashi_vault to community.hashi_vault.hashi_vault
redirecting (type: lookup) ansible.builtin.hashi_vault to community.hashi_vault.hashi_vault
redirecting (type: lookup) ansible.builtin.hashi_vault to community.hashi_vault.hashi_vault
redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10
redirecting (type: action) dellemc.os10.os10_command to dellemc.os10.os10
The full traceback is:
Traceback (most recent call last):
File "/Users/weakcamel/git/internal-networking/.venv/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 158, in run
res = self._execute()
File "/Users/weakcamel/git/internal-networking/.venv/lib/python3.9/site-packages/ansible/executor/task_executor.py", line 647, in _execute
result = self._handler.run(task_vars=vars_copy)
File "/Users/weakcamel/git/internal-networking/galaxy-collections/ansible_collections/dellemc/os10/plugins/action/os10.py", line 87, in run
conn = Connection(socket_path)
File "/Users/weakcamel/git/internal-networking/.venv/lib/python3.9/site-packages/ansible/module_utils/connection.py", line 124, in __init__
raise AssertionError('socket_path must be a value')
AssertionError: socket_path must be a value
fatal: [lon1sw1]: FAILED! =>
msg: Unexpected failure during module execution.
stdout: ''
PLAY RECAP *************************************************************************************************************************************************************************************************
lon1sw1 : ok=0 changed=0 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
For the record, this happens when Ansible connection plugin wasn't configured properly; adding it solved the problem:
$ cat inventory/group_vars/networking.yml
---
ansible_connection: ansible.netcommon.network_cli
ansible_network_os: dellemc.os10.os10
Hi @weakcamel, thank you for the update. Shall we close this issue?
SUMMARY
A very simple playbook cannot contact device. Workstation is working file for other playbooks.
ISSUE TYPE
ANSIBLE VERSION
COLLECTION VERSION
CONFIGURATION
OS / ENVIRONMENT
MacOS BugSur M1
STEPS TO REPRODUCE
ansible-playbook -i "172.16.0.100," dell-os10-backup-config.yml -u admin -k -vvv
EXPECTED RESULTS
Success.
ACTUAL RESULTS
Playbook error