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

Implement stdout callback and its logic as a collection #482

Closed
wants to merge 4 commits into from

Conversation

AlanCoding
Copy link
Member

No description provided.

if 'AD_HOC_COMMAND_ID' in self.env:
self.env['ANSIBLE_STDOUT_CALLBACK'] = 'minimal'
self.env['ANSIBLE_STDOUT_CALLBACK'] = 'runner.wrapper.minimal'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it runner.wrapper.minimal here and ansible.runner.minimal above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A goof.

I had meant to change everything to runner.wrapper because being in the ansible namespace carries with it a number of connotations which I do not wish to imply here.

python_path = self.env.get('PYTHONPATH', os.getenv('PYTHONPATH', ''))
if python_path and not python_path.endswith(':'):
python_path += ':'
self.env['ANSIBLE_CALLBACK_PLUGINS'] = ':'.join(filter(None,(self.env.get('ANSIBLE_CALLBACK_PLUGINS'), callback_dir)))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@AlanCoding AlanCoding force-pushed the collection_importing branch 2 times, most recently from 0a49392 to 351d76b Compare August 21, 2020 15:45
@AlanCoding AlanCoding force-pushed the collection_importing branch 4 times, most recently from 03e1880 to eff4de3 Compare September 4, 2020 02:18
if not self.containerized:
collection_dir = self.env.get('AWX_LIB_DIRECTORY', os.getenv('AWX_LIB_DIRECTORY'))
if collection_dir is None:
collection_dir = os.path.join(os.path.split(os.path.abspath(__file__))[0], "lib")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now shares some of the elements of #512

RUN dnf install -y python3-pip rsync openssh-clients sshpass glibc-langpack-en git \
https://github.com/krallin/tini/releases/download/v0.19.0/tini_0.19.0-amd64.rpm && \
rm -rf /var/cache/dnf

RUN dnf install -y gcc python3-devel
RUN pip3 install bindep https://github.com/ansible/ansible/archive/devel.tar.gz \
https://github.com/ansible/ansible-runner/archive/devel.tar.gz
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@matburt I've updated this to work in the containerized world, and it's passing some cursory integration tests I've ran locally (requires building image, so CI isn't equipped to test that).

This line shows the outright removal of the ansible-runner install. This is replaced by an ADD layer above that adds the collection directory with the callback, plus adding psutil directly.

The bigger picture is that we can package and vendor the collection separately. So ultimately, this could be handled in ansible-builder so that instead of enumerating requirements of the base image, we can just say that the manifest of collections needs to include the runner collection in order to be usable by runner.


export ANSIBLE_STDOUT_CALLBACK=awx_display
fi

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@shanemcd this entrypoint stuff exists in order to ascertain the location of the ansible-runner install and put them in the env vars needed for Ansible. This proposal makes that unnecessary by putting the collection in a location expected by Ansible, which is /usr/share/ansible/collections, which is the same as ansible-builder.

It's not just ANSIBLE_CALLBACK_PLUGINS, it's also PYTHONPATH that has historically been set and used this location. However, I think that may been erroneous because the system path change was done in the callback python code.

Move files to collection structure

Hooked up collection path

Remove stuff from tests

Cleanup collection transition work, remove extra module

fix ad hoc commands

Set python path
@AlanCoding
Copy link
Member Author

Replaced by #957

@AlanCoding AlanCoding closed this Jan 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants