ansible / ansible-runner

A tool and python library that helps when interfacing with Ansible directly or as part of another system whether that be through a container image interface, as a standalone tool, or as a Python module that can be imported. The goal is to provide a stable and consistent interface abstraction to Ansible.
Other
969 stars 357 forks source link

'Rapid development' causes regular Connection Errors for `junipernetworks.junos.junos_facts` (netconf connection) #1335

Closed ryeleo closed 2 months ago

ryeleo commented 10 months ago

I'm working on my ansible-runner workflow. I got Ansible Execution Environments working, and am doing rapid local development on my workstation.

  1. Begin running a playbook
  2. Cancel it with "Ctrl+C"

I expect to always be able to do this workflow rapidly.

Instead, I observe the following error:

ansible.module_utils.connection.ConnectionError: Unable to decode JSON from response set_options. See the debug log for more information.

Command

ansible-runner run . --container-image docker.io/ntsjenkins/junos-ansible-ansible-execution-env:latest --process-isolation --process-isolation-executable docker  -p site.yml --limit example --debug

Intermittent Error:

starting debug logging
file path is /home/rleonar7/dev/junos_ansible/ansible/env/settings
cache miss, attempting to load file from disk: /home/rleonar7/dev/junos_ansible/ansible/env/settings
specified path does not exist /home/rleonar7/dev/junos_ansible/ansible/env/settings
Not loading settings
file path is /home/rleonar7/dev/junos_ansible/ansible/env/passwords
cache miss, attempting to load file from disk: /home/rleonar7/dev/junos_ansible/ansible/env/passwords
file path is /home/rleonar7/dev/junos_ansible/ansible/env/envvars
cache miss, attempting to load file from disk: /home/rleonar7/dev/junos_ansible/ansible/env/envvars
specified path does not exist /home/rleonar7/dev/junos_ansible/ansible/env/envvars
Not loading environment vars
file path is /home/rleonar7/dev/junos_ansible/ansible/env/ssh_key
cache miss, attempting to load file from disk: /home/rleonar7/dev/junos_ansible/ansible/env/ssh_key
env:
 ANSIBLE_CACHE_PLUGIN: jsonfile
 ANSIBLE_CACHE_PLUGIN_CONNECTION: /runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/fact_cache
 ANSIBLE_CALLBACK_PLUGINS: /runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/callback
 ANSIBLE_HOST_KEY_CHECKING: False
 ANSIBLE_RETRY_FILES_ENABLED: False
 ANSIBLE_STDOUT_CALLBACK: awx_display
 AWX_ISOLATED_DATA_DIR: /runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab
file path is /home/rleonar7/dev/junos_ansible/ansible/args
cache miss, attempting to load file from disk: /home/rleonar7/dev/junos_ansible/ansible/args
specified path does not exist /home/rleonar7/dev/junos_ansible/ansible/args
file path is /home/rleonar7/dev/junos_ansible/ansible/env/cmdline
cache miss, attempting to load file from disk: /home/rleonar7/dev/junos_ansible/ansible/env/cmdline
ssh-agent agrs added
sandbox disabled
containerization enabled
env:
 ANSIBLE_CACHE_PLUGIN: jsonfile
 ANSIBLE_CACHE_PLUGIN_CONNECTION: /runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/fact_cache
 ANSIBLE_CALLBACK_PLUGINS: /runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/callback
 ANSIBLE_HOST_KEY_CHECKING: False
 ANSIBLE_RETRY_FILES_ENABLED: False
 ANSIBLE_STDOUT_CALLBACK: awx_display
 AWX_ISOLATED_DATA_DIR: /runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab
 RUNNER_OMIT_EVENTS: False
 RUNNER_ONLY_FAILED_EVENTS: False
command: docker run --rm --tty --interactive --workdir /runner/project -v /home/rleonar7/dev/junos_ansible/ansible/:/runner/:Z --env-file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/env.list --user=1000 --name ansible_runner_ff3b8a7d-6657-464b-8de4-f40a51b09aab docker.io/ntsjenkins/junos-ansible-ansible-execution-env:latest ssh-agent sh -c trap 'rm -f /runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/ssh_key_data' EXIT && ssh-add /runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/ssh_key_data && rm -f /runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/ssh_key_data && ansible-playbook --ask-vault-pass --diff --check -vvvv -i /runner/inventory/hosts --limit example site.yml
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/0a9910d4-8901-4b64-9cf8-d10542439009-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/0a9910d4-8901-4b64-9cf8-d10542439009-partial.json'
Identity added: /runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/ssh_key_data (/runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/ssh_key_data)
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/7438bc35-60c0-4ad0-9769-3e4c7e6623e4-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/7438bc35-60c0-4ad0-9769-3e4c7e6623e4-partial.json'
ansible-playbook [core 2.16.1]
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/d0fee3a9-b996-4d11-9b6f-8baffe48f42a-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/d0fee3a9-b996-4d11-9b6f-8baffe48f42a-partial.json'
  config file = /runner/project/ansible.cfg
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/89a32d26-5ad9-40e1-b355-107cfdb2a3db-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/89a32d26-5ad9-40e1-b355-107cfdb2a3db-partial.json'
  configured module search path = ['/runner/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/78875b8a-40fd-459f-bae9-072428ced454-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/78875b8a-40fd-459f-bae9-072428ced454-partial.json'
  ansible python module location = /usr/local/lib/python3.12/site-packages/ansible
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/380f6285-f7f7-41ad-bf3e-95ec403d6456-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/380f6285-f7f7-41ad-bf3e-95ec403d6456-partial.json'
  ansible collection location = /runner/.ansible/collections:/usr/share/ansible/collections
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/147803b7-5e6d-4718-ac09-c86d224205b4-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/147803b7-5e6d-4718-ac09-c86d224205b4-partial.json'
  executable location = /usr/local/bin/ansible-playbook
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/3fb65b48-e14b-4931-8468-df5090f560da-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/3fb65b48-e14b-4931-8468-df5090f560da-partial.json'
  python version = 3.12.1 (main, Dec 18 2023, 00:00:00) [GCC 13.2.1 20231205 (Red Hat 13.2.1-6)] (/usr/bin/python3)
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/82e096fc-d974-4ced-b4c4-0c6773615609-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/82e096fc-d974-4ced-b4c4-0c6773615609-partial.json'
  jinja version = 3.1.2
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/629970f3-c36d-4d3a-89d3-aa0f8477f4c8-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/629970f3-c36d-4d3a-89d3-aa0f8477f4c8-partial.json'
  libyaml = True
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/0f2c8a79-28b4-434e-a6fd-c35dc808100c-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/0f2c8a79-28b4-434e-a6fd-c35dc808100c-partial.json'
Using /runner/project/ansible.cfg as config file
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/8dd1c6a0-7a06-4271-94ec-7ed25a25c314-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/8dd1c6a0-7a06-4271-94ec-7ed25a25c314-partial.json'
Vault password: 
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/3ed2aa9b-fabd-4d6a-a037-df8d713c2be2-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/3ed2aa9b-fabd-4d6a-a037-df8d713c2be2-partial.json'
setting up inventory plugins
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/695cf8d2-ba64-4454-a279-4c4740385fc5-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/695cf8d2-ba64-4454-a279-4c4740385fc5-partial.json'
Loading collection ansible.builtin from 
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/55c6c9f3-a981-41ee-8250-45c5d970aa27-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/55c6c9f3-a981-41ee-8250-45c5d970aa27-partial.json'
host_list declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/4ac23165-1d35-4510-8d52-aa3023d258ff-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/4ac23165-1d35-4510-8d52-aa3023d258ff-partial.json'
script declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/57b6d0a7-fe1c-479d-95ff-4f1ebd48dcac-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/57b6d0a7-fe1c-479d-95ff-4f1ebd48dcac-partial.json'
auto declined parsing /runner/inventory/hosts as it did not pass its verify_file() method
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/395ca213-13f3-43c2-9140-6c7c847bcbfc-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/395ca213-13f3-43c2-9140-6c7c847bcbfc-partial.json'
Parsed /runner/inventory/hosts inventory source with ini plugin
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/fce39c3e-f484-4730-b49a-91611783f271-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/fce39c3e-f484-4730-b49a-91611783f271-partial.json'
Loading collection uoregon.nts from /runner/project/collections/ansible_collections/uoregon/nts
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/b56efa5a-01f4-41e0-9f20-e5c1e76706fa-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/b56efa5a-01f4-41e0-9f20-e5c1e76706fa-partial.json'
Loading collection junipernetworks.junos from /usr/share/ansible/collections/ansible_collections/junipernetworks/junos
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/3205379d-94f3-4f6d-9f80-4b49a808be20-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/3205379d-94f3-4f6d-9f80-4b49a808be20-partial.json'
redirecting (type: action) junipernetworks.junos.junos_facts to junipernetworks.junos.junos
Failed to open ansible stdout callback plugin partial data file /home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/c5620b6e-f784-41a0-9c2c-6910393c60c3-partial.json with error [Errno 2] No such file or directory: '/home/rleonar7/dev/junos_ansible/ansible/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/job_events/c5620b6e-f784-41a0-9c2c-6910393c60c3-partial.json'
Loading callback plugin default of type stdout, v2.0 from /usr/local/lib/python3.12/site-packages/ansible/plugins/callback/default.py
Loading callback plugin awx_display of type stdout, v2.0 from /runner/artifacts/ff3b8a7d-6657-464b-8de4-f40a51b09aab/callback/awx_display.py
Skipping callback 'awx_display', as we already have a stdout callback.
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: site.yml *************************************************************
Positional arguments: site.yml
verbosity: 4
connection: ssh
become_method: sudo
tags: ('all',)
check: True
diff: True
inventory: ('/runner/inventory/hosts',)
subset: example
ask_vault_pass: True
forks: 8
1 plays in site.yml

PLAY [Deploy Juniper Config] ***************************************************
Trying secret <ansible.parsing.vault.PromptVaultSecret object at 0x7f16862cf8c0> for vault_id=default
redirecting (type: action) junipernetworks.junos.junos_facts to junipernetworks.junos.junos
Loading collection ansible.netcommon from /usr/share/ansible/collections/ansible_collections/ansible/netcommon

TASK [uoregon.nts.juniper : TESTING junipernetworks.junos.junos_facts (to debug ansible-runner on NTS Jenkins)] ***
task path: /runner/project/collections/ansible_collections/uoregon/nts/roles/juniper/tasks/main.yml:3
redirecting (type: connection) ansible.builtin.netconf to ansible.netcommon.netconf
Loading collection ansible.utils from /usr/share/ansible/collections/ansible_collections/ansible/utils
redirecting (type: netconf) ansible.builtin.junos to junipernetworks.junos.junos
redirecting (type: action) junipernetworks.junos.junos_facts to junipernetworks.junos.junos
redirecting (type: action) junipernetworks.junos.junos_facts to junipernetworks.junos.junos
<example> attempting to start connection
<example> using connection plugin ansible.netcommon.netconf
Found ansible-connection at path /usr/local/bin/ansible-connection
fatal: [example]: FAILED! => {
    "msg": "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 207, in send\n    sf.connect(self.socket_path)\nConnectionRefusedError: [Errno 111] Connection refused\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/local/lib/python3.12/site-packages/ansible/cli/scripts/ansible_connection_cli_stub.py\", line 315, in main\n    conn.set_options(direct=options)\n  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 194, in __rpc__\n    response = self._exec_jsonrpc(name, *args, **kwargs)\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 155, in _exec_jsonrpc\n    out = self.send(data)\n          ^^^^^^^^^^^^^^^\n  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 214, in send\n    raise ConnectionError(\nansible.module_utils.connection.ConnectionError: unable to connect to socket /runner/.ansible/pc/e819cef964. See the socket path issue category in Network Debug and Troubleshooting Guide\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/local/bin/ansible-connection\", line 8, in <module>\n    sys.exit(main())\n             ^^^^^^\n  File \"/usr/local/lib/python3.12/site-packages/ansible/cli/scripts/ansible_connection_cli_stub.py\", line 318, in main\n    raise ConnectionError('Unable to decode JSON from response set_options. See the debug log for more information.')\nansible.module_utils.connection.ConnectionError: Unable to decode JSON from response set_options. See the debug log for more information.\n"
}

PLAY RECAP *********************************************************************
example: ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0 
ryeleo commented 10 months ago

On my Jenkins Agents (CICD servers), this has not been an issue. It really seems the issue is related to my "mashing ctrl+c to cancel a build and instead rapidly start a new one"

ryeleo commented 3 months ago

Today, I'm noticing this issue issue consistently, even though I did not use "ctrl+c" consistently.

Between yesterday and early this morning, I was able to use ansible-runner for some 20-40 playbook runs without issue. But now, I am consistently seeing a ConnectionError.

One time, restarting docker desktop seemed to fix the issue. However, ever since then, I am again running into this issue.

Command I am running:

ansible-runner run . --container-image docker.io/ntsjenkins/junos-ansible-ansible-execution-env:0.2.0 --process-isolation --process-isolation-executable docker -p test.yml

The traceback I am seeing this morning:

Traceback (most recent call last):
  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 206, in send
    sf.connect(self.socket_path)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File \"/usr/local/lib/python3.12/site-packages/ansible/cli/scripts/ansible_connection_cli_stub.py\", line 312, in main
    conn.set_options(direct=options)
  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 193, in __rpc__
    response = self._exec_jsonrpc(name, *args, **kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 154, in _exec_jsonrpc
    out = self.send(data)
          ^^^^^^^^^^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 213, in send
    raise ConnectionError(
ansible.module_utils.connection.ConnectionError: unable to connect to socket /runner/.ansible/pc/c0da244ec8. See the socket path issue category in Network Debug and Troubleshooting Guide

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File \"/usr/local/bin/ansible-connection\", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File \"/usr/local/lib/python3.12/site-packages/ansible/cli/scripts/ansible_connection_cli_stub.py\", line 315, in main
    raise ConnectionError('Unable to decode JSON from response set_options. See the debug log for more information.')
ansible.module_utils.connection.ConnectionError: Unable to decode JSON from response set_options. See the debug log for more information.

The full output from using ansible-runner (which contains the traceback):

$ ansible-runner run . --container-image docker.io/ntsjenkins/junos-ansible-ansible-execution-env:0.2.0 --process-isolation --process-isolation-executable docker -p test.yml --limit uop-ccenter-cfr1.net.uoregon.edu
Identity added: /runner/artifacts/2673c2f9-ad8b-4932-9db6-14cca5654fda/ssh_key_data (/runner/artifacts/2673c2f9-ad8b-4932-9db6-14cca5654fda/ssh_key_data)
Vault password: 

PLAY [uop_cfrs] ****************************************************************

TASK [Deploy configuration] ****************************************************
fatal: [uop-ccenter-cfr1.net.uoregon.edu]: FAILED! => {"msg": "Traceback (most recent call last):\n  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 206, in send\n    sf.connect(self.socket_path)\nConnectionRefusedError: [Errno 111] Connection refused\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/local/lib/python3.12/site-packages/ansible/cli/scripts/ansible_connection_cli_stub.py\", line 312, in main\n    conn.set_options(direct=options)\n  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 193, in __rpc__\n    response = self._exec_jsonrpc(name, *args, **kwargs)\n               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^\n  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 154, in _exec_jsonrpc\n    out = self.send(data)\n          ^^^^^^^^^^^^^^^\n  File \"/usr/local/lib/python3.12/site-packages/ansible/module_utils/connection.py\", line 213, in send\n    raise ConnectionError(\nansible.module_utils.connection.ConnectionError: unable to connect to socket /runner/.ansible/pc/c0da244ec8. See the socket path issue category in Network Debug and Troubleshooting Guide\n\nDuring handling of the above exception, another exception occurred:\n\nTraceback (most recent call last):\n  File \"/usr/local/bin/ansible-connection\", line 8, in <module>\n    sys.exit(main())\n             ^^^^^^\n  File \"/usr/local/lib/python3.12/site-packages/ansible/cli/scripts/ansible_connection_cli_stub.py\", line 315, in main\n    raise ConnectionError('Unable to decode JSON from response set_options. See the debug log for more information.')\nansible.module_utils.connection.ConnectionError: Unable to decode JSON from response set_options. See the debug log for more information.\n"}

My plan is to switch back to using ansible without using ansible-runner on my local development machine. Hopefully our build agents using ansible-runner continue to never run into this issue!

Shrews commented 3 months ago

So, to be honest, I'm not 100% sure what you are expecting or asking of runner here. If you are expecting to not see tracebacks or errors during your rapid development utilizing Ctrl+C to kill the process, I don't think that is reasonable. Abnormal termination could cause errors at multiple points in the process. Throw in multiple layers of execution utilizing runner and docker and ansible and network connections plugins, you are bound to experience errors in the process. Switching to bypassing ansible-runner and just using ansible itself might eliminate some of those layers, but certainly won't guarantee you won't see any errors.

All that being said, I'm not seeing any particular bug or issue here.

ryeleo commented 2 months ago

Fair point! Thanks for taking a look, @Shrews! 🙏

I was surprised when the issue came back up a couple of weeks ago without using "ctrl+c".

I do definitely wonder if I am the only user facing this issue. I am thinking:

We are planning on switching from Jenkins to GitHub Enterprise Server soon -- if I do start seeing this issue on our GitHub Runners, I will definitely report back here!

For more info about my environment, I am using:

  • Windows 10 Version (10.0.19042 Build 19042)
  • Docker Desktop 4.3.2 (72729) (is currently the newest version available.)
    • You are using the WSL 2 backend
    • Kubernetes Enabled using v1.22.4
Shrews commented 2 months ago

The traceback you saw without using Ctrl+C seems to indicate a network plugin issue. Perhaps something with connectivity to your inventory hosts. That should not be runner related, and there's nothing I could help with there since that is at a level below runner (ansible level, most likely, or maybe docker).

Given the above, I'm going to close this issue. If you can link an issue directly to runner in the future, feel free to open a new issue with sufficient details to reproduce any errant behavior.