{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5308","repository_url":"https://api.github.com/repos/ansible/ansible-modules-core","labels_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5308/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5308/comments","events_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5308/events","html_url":"https://github.com/ansible/ansible-modules-core/issues/5308","id":183863591,"number":5308,"title":"ios_config - binascii.Error: Incorrect padding","user":{"login":"AnsiNoob","id":19764900,"avatar_url":"https://avatars.githubusercontent.com/u/19764900?v=3","gravatar_id":"","url":"https://api.github.com/users/AnsiNoob","html_url":"https://github.com/AnsiNoob","followers_url":"https://api.github.com/users/AnsiNoob/followers","following_url":"https://api.github.com/users/AnsiNoob/following{/other_user}","gists_url":"https://api.github.com/users/AnsiNoob/gists{/gist_id}","starred_url":"https://api.github.com/users/AnsiNoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnsiNoob/subscriptions","organizations_url":"https://api.github.com/users/AnsiNoob/orgs","repos_url":"https://api.github.com/users/AnsiNoob/repos","events_url":"https://api.github.com/users/AnsiNoob/events{/privacy}","received_events_url":"https://api.github.com/users/AnsiNoob/received_events","type":"User","site_admin":false},"labels":[{"id":437720380,"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/affects_2.2","name":"affects_2.2","color":"5319e7","default":false},{"id":132571937,"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/bug_report","name":"bug_report","color":"fbca04","default":false},{"id":275173408,"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/networking","name":"networking","color":"c7def8","default":false},{"id":414073372,"url":"https://api.github.com/repos/ansible/ansible-modules-core/labels/waiting_on_maintainer","name":"waiting_on_maintainer","color":"d93f0b","default":false}],"state":"open","locked":false,"assignee":{"login":"Qalthos","id":649648,"avatar_url":"https://avatars.githubusercontent.com/u/649648?v=3","gravatar_id":"","url":"https://api.github.com/users/Qalthos","html_url":"https://github.com/Qalthos","followers_url":"https://api.github.com/users/Qalthos/followers","following_url":"https://api.github.com/users/Qalthos/following{/other_user}","gists_url":"https://api.github.com/users/Qalthos/gists{/gist_id}","starred_url":"https://api.github.com/users/Qalthos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Qalthos/subscriptions","organizations_url":"https://api.github.com/users/Qalthos/orgs","repos_url":"https://api.github.com/users/Qalthos/repos","events_url":"https://api.github.com/users/Qalthos/events{/privacy}","received_events_url":"https://api.github.com/users/Qalthos/received_events","type":"User","site_admin":false},"assignees":[{"login":"Qalthos","id":649648,"avatar_url":"https://avatars.githubusercontent.com/u/649648?v=3","gravatar_id":"","url":"https://api.github.com/users/Qalthos","html_url":"https://github.com/Qalthos","followers_url":"https://api.github.com/users/Qalthos/followers","following_url":"https://api.github.com/users/Qalthos/following{/other_user}","gists_url":"https://api.github.com/users/Qalthos/gists{/gist_id}","starred_url":"https://api.github.com/users/Qalthos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Qalthos/subscriptions","organizations_url":"https://api.github.com/users/Qalthos/orgs","repos_url":"https://api.github.com/users/Qalthos/repos","events_url":"https://api.github.com/users/Qalthos/events{/privacy}","received_events_url":"https://api.github.com/users/Qalthos/received_events","type":"User","site_admin":false}],"milestone":null,"comments":12,"created_at":"2016-10-19T04:33:17Z","updated_at":"2016-11-08T18:46:25Z","closed_at":null,"body":"<!--- Verify first that your issue/request is not already reported in GitHub -->\n##### ISSUE TYPE\n\n<!--- Pick one below and delete the rest: -->\n- Bug Report\n##### COMPONENT NAME\n\n<!--- Name of the plugin/module/task -->\n\nios_config\n##### ANSIBLE VERSION\n\n<!--- Paste verbatim output from “ansible --version” between quotes below -->\n\n```\nansible 2.2.0 (devel 17c0f52c96) last updated 2016/09/28 16:38:32 (GMT +000)\n  lib/ansible/modules/core: (detached HEAD 0f505378c3) last updated 2016/09/23 13:51:09 (GMT +000)\n  lib/ansible/modules/extras: (detached HEAD 1ade801f65) last updated 2016/09/23 13:51:25 (GMT +000)\n  config file = {path_clipped}/ansible.cfg\n  configured module search path = ['{path_clipped}/ansible/library']\n```\n\nNote - I know that I'm using month old version of Ansible but I can confirm that I have had this issue a month back itself. So, unless this issue was fixed in last one month, I guess updating might not help.\n##### CONFIGURATION\n\nMention any settings you have changed/added/removed in ansible.cfg\n(or using the ANSIBLE_\\* environment variables).\n\n```\n[defaults]\nlog_path={log_file_path}\nhost_key_checking = False\n```\n##### OS / ENVIRONMENT\n\nRunning from RHEL 6.8 with remote devices on Cisco IOS.\n##### SUMMARY\n\n<!--- Explain the problem briefly -->\n\nWhen the ios_config module is used to take backup of running config of remote device to local server from which Ansible playbook is running then few devices give incorrect padding error while rest work fine. The same incorrect padding error goes away when same playbook is triggered again.\n\nI Googled around and found this to be problem with known_hosts file so I added host_key_checking false in ansible.cfg but still the issue persists. I can tell you that even after added host_key_checking false I see known_hosts file getting updated when playbook is executed on new devices.\n\nNote - I have seen cases where a playbook when run for XYZ device may be success. 2nd executing of same playbook on same device then resulted in incorrect padding error which means that even though known_hosts was updated during first successful run still during second run something triggered the padding error. This kind of proves that issue is not because of known_hosts file.\n\nLastly, I only see this issue when I run my playbook for multiple devices. This is when few fail with incorrect padding error and rest succeed. 2nd trigger marks the failed devices as success as well.\n##### STEPS TO REPRODUCE\n\n<!---\nFor bugs, show exactly how to reproduce the problem.\nFor new features, show how the feature would be used.\n-->\n\nProblem reproduction has been explained in detailed above. One execution of below playbook may result in incorrect padding error for few out of many devices while next executing marks those devices success.\n\n<!--- Paste example playbooks or commands between quotes below -->\n\n```\nBelow role is called from site.yml\n---\n- name: Backing up running config\n  ios_config:\n    timeout: 60\n    backup: yes\n    authorize: yes\n    provider: \"{{ <provider name> }}\"\n\n```\n\n<!--- You can also paste gist.github.com links for larger files -->\n##### EXPECTED RESULTS\n\n<!--- What did you expect to happen when running the steps above? -->\n\nHere is the success output of the same playbook for a device XYZ (name changed):\n\n```\n{date/ID/PID and other detailed removed} |  ok: [XYZ] => {\n    \"backup_path\": \"{path clipped}\",\n    \"changed\": false,\n    \"invocation\": {\n        \"module_args\": {\n            \"after\": null,\n            \"auth_pass\": null,\n            \"authorize\": true,\n            \"backup\": true,\n            \"before\": null,\n            \"config\": null,\n            \"defaults\": false,\n            \"force\": false,\n            \"host\": \"XYZ\",\n            \"lines\": null,\n            \"match\": \"line\",\n            \"parents\": null,\n            \"password\": \"VALUE_SPECIFIED_IN_NO_LOG_PARAMETER\",\n            \"port\": null,\n            \"provider\": {\n                \"authorize\": true,\n                \"host\": \"XYZ\",\n                \"password\": \"VALUE_SPECIFIED_IN_NO_LOG_PARAMETER\",\n                \"transport\": \"{name clipped}\",\n                \"username\": \"{name clipped}\"\n            },\n            \"replace\": \"line\",\n            \"save\": false,\n            \"src\": null,\n            \"ssh_keyfile\": null,\n            \"timeout\": 60,\n            \"transport\": \"{name clipped}\",\n            \"use_ssl\": true,\n            \"username\": \"{name clipped}\",\n            \"validate_certs\": true\n        }\n    },\n    \"warnings\": []\n}\n```\n##### ACTUAL RESULTS\n\n<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->\n\nHere is output with -vvvvv\n\n<!--- Paste verbatim command output between quotes below -->\n\n```\n{details like pid etc clipped} |  An exception occurred during task execution. The full traceback is:\nTraceback (most recent call last):\n  File \"/tmp/ansible_5EnQ71/ansible_module_ios_config.py\", line 363, in <module>\n    main()\n  File \"/tmp/ansible_5EnQ71/ansible_module_ios_config.py\", line 350, in main\n    result['__backup__'] = module.config.get_config()\n  File \"/tmp/ansible_5EnQ71/ansible_modlib.zip/ansible/module_utils/network.py\", line 125, in config\n  File \"/tmp/ansible_5EnQ71/ansible_modlib.zip/ansible/module_utils/network.py\", line 147, in connect\n  File \"/tmp/ansible_5EnQ71/ansible_modlib.zip/ansible/module_utils/ios.py\", line 180, in connect\n  File \"/tmp/ansible_5EnQ71/ansible_modlib.zip/ansible/module_utils/shell.py\", line 228, in connect\n  File \"/tmp/ansible_5EnQ71/ansible_modlib.zip/ansible/module_utils/shell.py\", line 82, in open\n  File \"{path clipped}ansible/lib/paramiko/client.py\", line 173, in load_host_keys\n    self._host_keys.load(filename)\n  File \"{path clipped}ansible/lib/paramiko/hostkeys.py\", line 155, in load\n    e = HostKeyEntry.from_line(line)\n  File \"{path clipped}/ansible/lib/paramiko/hostkeys.py\", line 67, in from_line\n    key = RSAKey(data=base64.decodestring(key))\n  File \"/usr/lib64/python2.6/base64.py\", line 321, in decodestring\n    return binascii.a2b_base64(s)\nbinascii.Error: Incorrect padding\n\n{details like pid user etc clipped} |  fatal: [XYZ]: FAILED! => {\n    \"changed\": false,\n    \"failed\": true,\n    \"invocation\": {\n        \"module_args\": {\n            \"authorize\": true,\n            \"backup\": true,\n            \"provider\": {\n                \"authorize\": true,\n                \"host\": \"XYZ\",\n                \"password\": \" \",\n                \"transport\": \"{details clipped}\",\n                \"username\": \"{details clipped}\"\n            },\n            \"timeout\": 60\n        },\n        \"module_name\": \"ios_config\"\n    },\n    \"module_stderr\": \"Traceback (most recent call last):\\n  File \\\"/tmp/ansible_5EnQ71/ansible_module_ios_config.py\\\", line 363, in <module>\\n    main()\\n  File \\\"/tmp/ansible_5EnQ71/ansible_module_ios_config.py\\\", line 350, in main\\n    result['__backup__'] = module.config.get_config()\\n  File \\\"/tmp/ansible_5EnQ71/ansible_modlib.zip/ansible/module_utils/network.py\\\", line 125, in config\\n  File \\\"/tmp/ansible_5EnQ71/ansible_modlib.zip/ansible/module_utils/network.py\\\", line 147, in connect\\n  File \\\"/tmp/ansible_5EnQ71/ansible_modlib.zip/ansible/module_utils/ios.py\\\", line 180, in connect\\n  File \\\"/tmp/ansible_5EnQ71/ansible_modlib.zip/ansible/module_utils/shell.py\\\", line 228, in connect\\n  File \\\"/tmp/ansible_5EnQ71/ansible_modlib.zip/ansible/module_utils/shell.py\\\", line 82, in open\\n  File \\\"{details clipped}ansible/lib/paramiko/client.py\\\", line 173, in load_host_keys\\n    self._host_keys.load(filename)\\n  File \\\"{details clipped}ansible/lib/paramiko/hostkeys.py\\\", line 155, in load\\n    e = HostKeyEntry.from_line(line)\\n  File \\\"{details clipped}/ansible/lib/paramiko/hostkeys.py\\\", line 67, in from_line\\n    key = RSAKey(data=base64.decodestring(key))\\n  File \\\"/usr/lib64/python2.6/base64.py\\\", line 321, in decodestring\\n    return binascii.a2b_base64(s)\\nbinascii.Error: Incorrect padding\\n\",\n    \"module_stdout\": \"\",\n    \"msg\": \"MODULE FAILURE\"\n}\n\n```\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/comments/259223332","html_url":"https://github.com/ansible/ansible-modules-core/issues/5308#issuecomment-259223332","issue_url":"https://api.github.com/repos/ansible/ansible-modules-core/issues/5308","id":259223332,"user":{"login":"AnsiNoob","id":19764900,"avatar_url":"https://avatars.githubusercontent.com/u/19764900?v=3","gravatar_id":"","url":"https://api.github.com/users/AnsiNoob","html_url":"https://github.com/AnsiNoob","followers_url":"https://api.github.com/users/AnsiNoob/followers","following_url":"https://api.github.com/users/AnsiNoob/following{/other_user}","gists_url":"https://api.github.com/users/AnsiNoob/gists{/gist_id}","starred_url":"https://api.github.com/users/AnsiNoob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/AnsiNoob/subscriptions","organizations_url":"https://api.github.com/users/AnsiNoob/orgs","repos_url":"https://api.github.com/users/AnsiNoob/repos","events_url":"https://api.github.com/users/AnsiNoob/events{/privacy}","received_events_url":"https://api.github.com/users/AnsiNoob/received_events","type":"User","site_admin":false},"created_at":"2016-11-08T18:46:25Z","updated_at":"2016-11-08T18:46:25Z","body":"I'm planning to test the change in few days. I'll let everyone know if it goes in fine. "}}
{"actor":{"display_login":"AnsiNoob"}}