Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Doesn't see a playbook when running with docker. With podman works well. #1545

Closed
Andersson007 opened this issue May 30, 2023 · 3 comments
Closed
Assignees
Labels
bug Researched, reproducible, committed to fix waiting on author Additional information is needed form the author of the issue

Comments

@Andersson007
Copy link
Contributor

ISSUE TYPE
  • Bug Report
SUMMARY

Doesn't see a playbook when running with docker. With podman works well.
It throws the error ERROR! the playbook: /root/test_localhost.yml could not be found

ANSIBLE-NAVIGATOR VERSION
3.3.1
CONFIGURATION

Fresh installation, no custom settings

LOG FILE

The only entry is:

2023-05-09T12:19:58.027513+00:00 CRITICAL 'ansible_navigator.actions.run_playbook._handle_message' Unhandled message from runner queue, discarded: {'event': 'verbose', 'uuid': '99d812d0-3517-4c66-a0d4-060d5e6d2bcd', 'counter': 1, 'stdout': '\x1b[0;31mERROR! the playbook: /root/test_localhost.yml could not be found\x1b[0m', 'start_line': 0, 'end_line': 1, 'runner_ident': '0ddf5377-903e-4681-9c1b-c70a8d060547', 'created': '2023-05-09T12:19:58.026932'}
STEPS TO REPRODUCE
  1. Install docker
  2. build the image with ansible-builder
  3. create a playbook in your home dir
  4. run the following from your home dir
[root@fedora03 ~]# ansible-navigator run /root/test_localhost.yml --execution-environment-image postgresql_ee --mode stdout --pull-policy missing
ERROR! the playbook: /root/test_localhost.yml could not be found
Please review the log for errors.
[root@fedora03 ~]# 
[root@fedora03 ~]# 
[root@fedora03 ~]# cat test_localhost.yml 
---
- hosts: localhost
  become: yes
  gather_facts: yes
  tasks:
  - name: Print facts
    ansible.builtin.debug:
      msg: '{{ ansible_facts }}'

If I uninstall docker, install podman, rebuild the image with the same build command and definition, and run the same command, everything works as expected

[root@fedora03 ~]# ansible-navigator run /root/test_localhost.yml --execution-environment-image postgresql_ee --mode stdout --pull-policy missing
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that
the implicit localhost does not match 'all'

PLAY [localhost] ***************************************************************

TASK [Gathering Facts] *********************************************************
ok: [localhost]

TASK [Print facts] *************************************************************
ok: [localhost] => {
    "msg": {
        "ansible_local": {},
        "apparmor": {
            "status": "disabled"
        },
        "architecture": "x86_64",
...
EXPECTED RESULTS

No errors. Works well as with podman.

ACTUAL RESULTS
ERROR! the playbook: /root/test_localhost.yml could not be found
@Andersson007 Andersson007 added bug Researched, reproducible, committed to fix new New issues and PRs to triaged labels May 30, 2023
@shatakshiiii shatakshiiii removed the new New issues and PRs to triaged label May 31, 2023
@shatakshiiii shatakshiiii self-assigned this Jun 5, 2023
@cidrblock
Copy link
Collaborator

I suspect this is beacuse the user in the container when using docker is 1000, and does not have access to the /root directory where the playbook is being mounted.

We can check this using the exec command:

(venv) m910x ➜  ansible-navigator git:(main) ✗ ansible-navigator exec --ce docker --eei test-ee --pp never 

dr-xr-x---   1 root root   8 Jun  8 13:30 root

Does this work in any directory other than /root ?

If you have to mount the playbook into /root, you might have to be the root user in the container to access it:

(venv) m910x ➜  ansible-navigator git:(main) ✗ ansible-navigator exec --ce docker --eei test-ee --pp never --co="--user=root" 
[root@8226ac2388a9 ansible-navigator]# touch /root/foo.txt
[root@8226ac2388a9 ansible-navigator]# 

Keep us posted on you findings!

@cidrblock cidrblock added the waiting on author Additional information is needed form the author of the issue label Jun 14, 2023
@Andersson007
Copy link
Contributor Author

@cidrblock i'll try the solution next week (probably on Tuesday), thanks a lot

@Andersson007
Copy link
Contributor Author

Yep, it works in another directory.
Our getting-started guide doesn't suggest using root and, moreover, we've recently changed it to use a project dir, i.e. not to use a home dir, so should be fine then
I don't think we should add any clarifications about this (i'd say) corner case,
closing, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Researched, reproducible, committed to fix waiting on author Additional information is needed form the author of the issue
Projects
None yet
Development

No branches or pull requests

3 participants