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

Use the correct Python executable when running Packer #56

Closed
jsf9k opened this issue Nov 10, 2020 · 0 comments · Fixed by #58
Closed

Use the correct Python executable when running Packer #56

jsf9k opened this issue Nov 10, 2020 · 0 comments · Fixed by #58
Assignees
Labels
bug This issue or pull request addresses broken functionality

Comments

@jsf9k
Copy link
Member

jsf9k commented Nov 10, 2020

🐛 Bug Report

Ansible is currently using the wrong python3 executable when run via Packer. This is because there is a system Python3 executable location at /usr/bin/python3, and Ansible is using that instead of the executable located at (currently) /opt/hostedtoolcache/Python/3.9.0/x64/bin/python3. This latter executable is the one identified by which python3, but Ansible has its own method of determining which Python executable to use.

In many cases this does not matter, but in some cases (e.g. cisagov/kali-packer and cisagov/teamserver-packer) we install pip packages such as boto3 because they must be available on the Ansible host in order to pull SSM ParameterStore keys or objects stored in S3 from AWS. These packages are installed under the /opt/hostedtoolcache Python and are likely not available with the system Python.

To Reproduce

Steps to reproduce the behavior:

@jsf9k jsf9k added the bug This issue or pull request addresses broken functionality label Nov 10, 2020
@jsf9k jsf9k self-assigned this Nov 10, 2020
jsf9k added a commit that referenced this issue Nov 11, 2020
When Ansible runs it will look for /usr/bin/python3 and use it if it
finds it.  Therefore we need /usr/bin/python3 to point to the desired
python when packer runs.

This change will hose other tasks that expect to find the system
python at /usr/bin/python3, though, so we undo the change after
running packer.

Resolves #56.
@jsf9k jsf9k closed this as completed in a842abb Nov 18, 2020
@mcdonnnj mcdonnnj moved this to Done in Skeleton Maintenance Feb 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue or pull request addresses broken functionality
Projects
Development

Successfully merging a pull request may close this issue.

1 participant