ansible-navigator icon indicating copy to clipboard operation
ansible-navigator copied to clipboard

Navigator doesn't work with the default AWX EE

Open maxamillion opened this issue 3 years ago • 3 comments

ISSUE TYPE
  • Bug Report
SUMMARY

Running Navigator with any playbook against the AWS default EE results in permission denied errors.

ansible-navigator run job1.yml -t jobtagtest2 --ee true --eei quay.io/ansible/awx-ee:latest
ANSIBLE-NAVIGATOR VERSION
ansible-navigator 2.1.0
CONFIGURATION

N/A

LOG FILE
/usr/local/lib/python3.8/site-packages/paramiko/transport.py:236: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: error in 'jsonfile' cache plugin while trying to create cache dir
/runner/artifacts/c0df7b9f-4331-4c65-bccf-6f44dc1006a8/fact_cache : b"[Errno
13] Permission denied: '/runner/artifacts'"
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/ansible/executor/task_queue_manager.py", line 450, in send_callback
    method(*new_args, **kwargs)
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 455, in v2_playbook_on_start
    with self.capture_event_data('playbook_on_start', **event_data):
  File "/usr/lib64/python3.8/contextlib.py", line 113, in __enter__
    return next(self.gen)
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 374, in capture_event_data
    event_context.dump_begin(sys.stdout)
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 239, in dump_begin
    self.cache.set(":1:ev-{}".format(begin_dict['uuid']), begin_dict)
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 111, in set
    os.mkdir(os.path.join(self.private_data_dir, 'job_events'), 0o700)
PermissionError: [Errno 13] Permission denied: '/runner/artifacts/c0df7b9f-4331-4c65-bccf-6f44dc1006a8/job_events'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/bin/ansible-playbook", line 128, in <module>
    exit_code = cli.run()
  File "/usr/local/lib/python3.8/site-packages/ansible/cli/playbook.py", line 137, in run
    results = pbex.run()
  File "/usr/local/lib/python3.8/site-packages/ansible/executor/playbook_executor.py", line 120, in run
    self._tqm.send_callback('v2_playbook_on_start', pb)
  File "/usr/local/lib/python3.8/site-packages/ansible/utils/lock.py", line 41, in inner
    return func(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ansible/executor/task_queue_manager.py", line 453, in send_callback
    display.warning(u"Failure using method (%s) in callback plugin (%s): %s" % (to_text(method_name), to_text(callback_plugin), to_text(e)))
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 256, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ansible/utils/display.py", line 409, in warning
    self.display(new_msg, color=C.COLOR_WARN, stderr=True)
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 304, in wrapper
    event_context.dump_begin(fileobj)
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 239, in dump_begin
    self.cache.set(":1:ev-{}".format(begin_dict['uuid']), begin_dict)
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 111, in set
    os.mkdir(os.path.join(self.private_data_dir, 'job_events'), 0o700)
PermissionError: [Errno 13] Permission denied: '/runner/artifacts/c0df7b9f-4331-4c65-bccf-6f44dc1006a8/job_events'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/bin/ansible-playbook", line 156, in <module>
    display.error("Unexpected Exception, this is probably a bug: %s" % to_text(e), wrap_text=False)
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 256, in wrapper
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.8/site-packages/ansible/utils/display.py", line 464, in error
    self.display(new_msg, color=C.COLOR_ERROR, stderr=True)
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 304, in wrapper
    event_context.dump_begin(fileobj)
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 239, in dump_begin
    self.cache.set(":1:ev-{}".format(begin_dict['uuid']), begin_dict)
  File "/home/runner/.ansible/plugins/callback/awx_display.py", line 111, in set
    os.mkdir(os.path.join(self.private_data_dir, 'job_events'), 0o700)
PermissionError: [Errno 13] Permission denied: '/runner/artifacts/c0df7b9f-4331-4c65-bccf-6f44dc1006a8/job_events'
STEPS TO REPRODUCE
ansible-navigator run job1.yml -t jobtagtest2 --ee true --eei quay.io/ansible/awx-ee:latest
EXPECTED RESULTS

the job to run

ACTUAL RESULTS

above permission error

maxamillion avatar Jul 28 '22 14:07 maxamillion

I am seeing similar problems. Here's output from the artifact log.

    "stdout": [
        "\u001b[1;35m[WARNING]: error in 'jsonfile' cache plugin while trying to create cache dir\u001b[0m",
        "\u001b[1;35m/runner/artifacts/b1a9b0c5-d83f-41ba-b951-c5629145c021/fact_cache : b\"[Errno\u001b[0m",
        "\u001b[1;35m13] Permission denied:\u001b[0m",
        "\u001b[1;35m'/runner/artifacts/b1a9b0c5-d83f-41ba-b951-c5629145c021'\"\u001b[0m",
        "Traceback (most recent call last):",
        "  File \"/usr/lib/python3.9/site-packages/ansible/executor/task_queue_manager.py\", line 434, in send_callback",
        "    method(*new_args, **kwargs)",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 455, in v2_playbook_on_start",
        "    with self.capture_event_data('playbook_on_start', **event_data):",
        "  File \"/usr/lib64/python3.9/contextlib.py\", line 119, in __enter__",
        "    return next(self.gen)",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 374, in capture_event_data",
        "    event_context.dump_begin(sys.stdout)",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 239, in dump_begin",
        "    self.cache.set(\":1:ev-{}\".format(begin_dict['uuid']), begin_dict)",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 111, in set",
        "    os.mkdir(os.path.join(self.private_data_dir, 'job_events'), 0o700)",
        "FileNotFoundError: [Errno 2] No such file or directory: '/runner/artifacts/b1a9b0c5-d83f-41ba-b951-c5629145c021/job_events'",
        "During handling of the above exception, another exception occurred:",
        "Traceback (most recent call last):",
        "  File \"/usr/lib/python3.9/site-packages/ansible/cli/__init__.py\", line 601, in cli_executor",
        "    exit_code = cli.run()",
        "  File \"/usr/lib/python3.9/site-packages/ansible/cli/playbook.py\", line 143, in run",
        "    results = pbex.run()",
        "  File \"/usr/lib/python3.9/site-packages/ansible/executor/playbook_executor.py\", line 120, in run",
        "    self._tqm.send_callback('v2_playbook_on_start', pb)",
        "  File \"/usr/lib/python3.9/site-packages/ansible/utils/lock.py\", line 41, in inner",
        "    return func(*args, **kwargs)",
        "  File \"/usr/lib/python3.9/site-packages/ansible/executor/task_queue_manager.py\", line 437, in send_callback",
        "    display.warning(u\"Failure using method (%s) in callback plugin (%s): %s\" % (to_text(method_name), to_text(callback_plugin), to_text(e)))",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 256, in wrapper",
        "    return f(*args, **kwargs)",
        "  File \"/usr/lib/python3.9/site-packages/ansible/utils/display.py\", line 403, in warning",
        "    self.display(new_msg, color=C.COLOR_WARN, stderr=True)",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 304, in wrapper",
        "    event_context.dump_begin(fileobj)",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 239, in dump_begin",
        "    self.cache.set(\":1:ev-{}\".format(begin_dict['uuid']), begin_dict)",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 111, in set",
        "    os.mkdir(os.path.join(self.private_data_dir, 'job_events'), 0o700)",
        "FileNotFoundError: [Errno 2] No such file or directory: '/runner/artifacts/b1a9b0c5-d83f-41ba-b951-c5629145c021/job_events'",
        "During handling of the above exception, another exception occurred:",
        "Traceback (most recent call last):",
        "  File \"/usr/bin/ansible-playbook\", line 33, in <module>",
        "    sys.exit(load_entry_point('ansible-core==2.13.0', 'console_scripts', 'ansible-playbook')())",
        "  File \"/usr/lib/python3.9/site-packages/ansible/cli/playbook.py\", line 227, in main",
        "    PlaybookCLI.cli_executor(args)",
        "  File \"/usr/lib/python3.9/site-packages/ansible/cli/__init__.py\", line 629, in cli_executor",
        "    display.error(\"Unexpected Exception, this is probably a bug: %s\" % to_text(e), wrap_text=False)",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 256, in wrapper",
        "    return f(*args, **kwargs)",
        "  File \"/usr/lib/python3.9/site-packages/ansible/utils/display.py\", line 458, in error",
        "    self.display(new_msg, color=C.COLOR_ERROR, stderr=True)",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 304, in wrapper",
        "    event_context.dump_begin(fileobj)",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 239, in dump_begin",
        "    self.cache.set(\":1:ev-{}\".format(begin_dict['uuid']), begin_dict)",
        "  File \"/home/runner/.ansible/plugins/callback/awx_display.py\", line 111, in set",
        "    os.mkdir(os.path.join(self.private_data_dir, 'job_events'), 0o700)",
        "FileNotFoundError: [Errno 2] No such file or directory: '/runner/artifacts/b1a9b0c5-d83f-41ba-b951-c5629145c021/job_events'"
    ],

kbreit avatar Aug 08 '22 20:08 kbreit

A hello world playbook works in an Ubuntu VM but macOS is giving this error.

kbreit avatar Aug 09 '22 01:08 kbreit

I submitted #1276 as I am narrowing this problem down and it may have to do with not using Docker Desktop.

kbreit avatar Aug 23 '22 18:08 kbreit

Closing as the real bug is #1276

ssbarnea avatar Oct 28 '22 07:10 ssbarnea

I can reproduce this issue on linux. I think it's because the awx-ee has USER 1000 https://github.com/ansible/awx-ee/blob/devel/Containerfile#L91

Why can't EEs be executed rootless with ansible-navigator? ansible-navigator seems to mount /runner/artifacts not allowing rootless: Showing mounts by adding the mount command to the entrypoint reveals:

tmpfs on /runner/artifacts type tmpfs (rw,noatime,inode64)

IIUC, the way /runner/artifacts is mounted prevents the user to write to it?

fridim avatar Feb 10 '23 11:02 fridim