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

Allow for interactive development within the container #526

Closed
ericzolf opened this issue Aug 3, 2021 · 2 comments · Fixed by #624
Closed

Allow for interactive development within the container #526

ericzolf opened this issue Aug 3, 2021 · 2 comments · Fixed by #624
Assignees
Labels
AAP Ansible automation platform enhancement New feature or request

Comments

@ericzolf
Copy link

ericzolf commented Aug 3, 2021

ISSUE TYPE
  • Feature Idea
SUMMARY

Developing automation is very incremental so it's a lot of editing, trying, editing, trying, especially at the beginning. The current ansible-navigator approach stays a bit in the way of this approach, with the overhead of the TUI and each time starting a new container. A mode by which the developer could just be put inside the container as themself and could there edit their code and/or start ansible-playbook themselves would help a lot.

Basically, it would be the equivalent of podman run [--rm] --tty --interactive -v /home/myuser/github/pull-test/:/home/myuser/github/pull-test/ --workdir /home/myuser/github/pull-test -v /run/user/1000/keyring/:/run/user/1000/keyring/ -e SSH_AUTH_SOCK=/run/user/1000/keyring/ssh -v /home/myuser/.ssh/:/home/runner/.ssh/ --group-add=root --userns=keep-id --user="$(id -u):$(id -g)" --ipc=host -v /tmp/ansible-navigator_th4mlx94/artifacts/:/runner/artifacts/:Z -v /tmp/ansible-navigator_th4mlx94/:/runner/:Z --env-file /tmp/ansible-navigator_th4mlx94/artifacts/d8722364-68c8-4875-973e-8d1234008533/env.list --quiet --name ansible_runner_d8722364-68c8-4875-973e-8d1234008533 registry.blup/bla/ansible-automation-platform-20-ee-supported-rhel8:latest /bin/bash.

Two comments:

  1. notice the addition of --userns=keep-id --user="$(id -u):$(id -g)" to make sure that the user is themself within the container and the access right remain correct.
  2. being able to keep the container across calls i.e. without --rm would also help, for example with the ability to give a fix name to the container, as the developer could then customize it with aspects irrelevant to the automation itself (i.e. add their favourite editor) without having to create an own image.

Thinking about it, that also means that the temporary directory /tmp/ansible-navigator_th4mlx94 would be persistent, the location /tmp isn't a perfect place for this kind of approach, so it should also be moved, e.g. to a sub-directory of the current directory.

@cidrblock cidrblock added the enhancement New feature or request label Aug 16, 2021
@cidrblock cidrblock self-assigned this Aug 16, 2021
@webknjaz webknjaz added the new New issues and PRs to triaged label Sep 7, 2021
@anshulbehl
Copy link

anshulbehl commented Sep 14, 2021

Few good to have things in future with navigator would also be to have(with this feature), to be able to

  • An easy way to run setup module or ad-hoc modules like ping
  • Like ansible all -m setup or ansible all -m ping

This way its easier to take that first step to understand ansible modules without dealing with navigator in a deep dive fashion like setting up config or knowing about interactive or stdout modes.

A first easy step and then you would need to understand the module and navigator function to achieve something meaninful.

@ganeshrn ganeshrn removed the new New issues and PRs to triaged label Sep 20, 2021
@tonykay
Copy link

tonykay commented Oct 23, 2021

Perhaps not a solution but for me, I run a pause.yml (just a simple play with a pause in it) then either podman exec -it ... bash or equivalent with docker to get a shell inside the container complete with its mounts, where I can then work/debug. Perhaps ansible-navigator shell option?

@ganeshrn ganeshrn added the AAP Ansible automation platform label Nov 18, 2021
ansible-zuul bot pushed a commit that referenced this issue Dec 14, 2021
`exec` subcommand

Demo

Add exec action
Add exec subcommand
Add exec_command and exec_shell settings entries
Add support for actions that may be stdout only
Update test data as needed
Update tests to shlex split for first use of space delimited parameter
add flake8 file to set docstring format to sphinx
one black fix in utils, ergh

Fixes: #526

Reviewed-by: Rick Elrod <rick@elrod.me>
Reviewed-by: Bradley A. Thornton <bthornto@redhat.com>
Reviewed-by: Alison Hart <contact@alisonlhart.com>
Reviewed-by: Sviatoslav Sydorenko <webknjaz+github/profile@redhat.com>
Reviewed-by: Jake Jackson  <jljacks93@gmail.com>
Reviewed-by: None <None>
cidrblock added a commit to cidrblock/ansible-navigator that referenced this issue Jan 11, 2022
`exec` subcommand

Demo

Add exec action
Add exec subcommand
Add exec_command and exec_shell settings entries
Add support for actions that may be stdout only
Update test data as needed
Update tests to shlex split for first use of space delimited parameter
add flake8 file to set docstring format to sphinx
one black fix in utils, ergh

Fixes: ansible#526

Reviewed-by: Rick Elrod <rick@elrod.me>
Reviewed-by: Bradley A. Thornton <bthornto@redhat.com>
Reviewed-by: Alison Hart <contact@alisonlhart.com>
Reviewed-by: Sviatoslav Sydorenko <webknjaz+github/profile@redhat.com>
Reviewed-by: Jake Jackson  <jljacks93@gmail.com>
Reviewed-by: None <None>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AAP Ansible automation platform enhancement New feature or request
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

6 participants