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

Issues when already running in a container

Open max06 opened this issue 3 years ago • 2 comments

ISSUE TYPE
  • Bug Report(s)
SUMMARY

This is about multiple bugs, all related to already being inside a container when calling ansible-navigator.

A VSCode DevContainer definition is used - ansible is installed via pip3 in a debian/python 3.10 environment as user.

  • collections installed via ansible-galaxy to their default location ~/.ansible/collections/ansible_collections/, in use by ansible without additional configuration are not found by ansible-navigator: ERROR 'ansible_navigator.actions.collections._parse' Unable to extract collection json from stdout in logfile.

  • ansible-navigator should fallback to a local EE if it's detecting being inside a container, or if there's no container engine present.

  • config returns nothing, not even a log message.

  • inventory is missing some ansible groups. Didn't dig deeper into it yet.

  • run: It really should have autocomplete options, or list playbooks from the current directory. The interactive output while running is also jumping all over the place, maybe trying to use \t for its columns.

ANSIBLE-NAVIGATOR VERSION
 $  ansible-navigator --version                                                                                                                                                                                                                         
ansible-navigator 2.1.0
CONFIGURATION
LOG FILE
DEBUG 'ansible_navigator.main' EE support disabled: using 'ansible --version' for 'ansible.cfg'
DEBUG 'ansible_navigator.main' ansible --version stdout: 
'ansible [core 2.11.10] 
  config file = /workspaces/project/ansible/ansible.cfg
  configured module search path = ['/home/vscode/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /home/vscode/.local/lib/python3.10/site-packages/ansible
  ansible collection location = /home/vscode/.ansible/collections:/usr/share/ansible/collections
  executable location = /home/vscode/.local/bin/ansible
  python version = 3.10.4 (main, Apr  7 2022, 03:15:56) [GCC 10.2.1 20210110]
  jinja version = 3.1.1
  libyaml = False
'
STEPS TO REPRODUCE
EXPECTED RESULTS
ACTUAL RESULTS
ADDITIONAL INFORMATION

I'm sorry for not following your format - I don't have the time (or patience) to open 5 separate issues, and all of these require the same environment for testing. Happy to test things or get additional information if requested though.

max06 avatar May 19 '22 13:05 max06

Hey @max06, thanks for this one.

Quick question, was ansible-navigator installed in the VSCode DevContainer or were you trying to use the dev container as an execution environment?

I'll break this up into smaller issues in the near future so they can be addressed individually.

cidrblock avatar May 23 '22 13:05 cidrblock

Hello @cidrblock !

Actually, it's both. We're using the devcontainer locally for development and running ansible-playbook, without any more layers. No execution environments, no virtualenvs or other separation. Same image (or dockerfile) is in use in our ci pipelines for some selected playbooks. You could say, the devcontainer is the execution environment.

Let's see if I added more confusion here.

Edit: After solving the knot in my brain - everything is inside the container, nothing outside.

max06 avatar May 23 '22 14:05 max06

Is this still an issue? I’m going to explore devcontainers with ansible-navigator. Does docker-in-docker or docker-from-docker fix this?

ryanmerolle avatar May 23 '23 02:05 ryanmerolle

I believe I hit the same issue. I tried running ansible-navigator in a GitHub action and got the "the input device is not a TTY" error message.

vvarga007 avatar Oct 23 '23 18:10 vvarga007

Navigator is a TUI, so it does expect a TTY.

ssbarnea avatar Feb 12 '24 19:02 ssbarnea

a) This has nothing to do with TTY. b) I'm no longer using ansible - explaining why would violate the code of conduct.

All the best!

max06 avatar Feb 12 '24 20:02 max06

@max06 If it doesn't help with navigator, maybe it will with another project of yours. I've been doing some early testing with container in container leveraging some of what the podman team has done for their testing. It's here for now because it's early days. https://github.com/cidrblock/container_in_container

Hope you might find is useful.

t/c Brad

cidrblock avatar Feb 13 '24 02:02 cidrblock