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

Bundle ansible in the container #324

Merged
merged 2 commits into from
Mar 14, 2023
Merged

Bundle ansible in the container #324

merged 2 commits into from
Mar 14, 2023

Conversation

jacobsalmela
Copy link
Collaborator

@jacobsalmela jacobsalmela commented Mar 13, 2023

Summary and Scope

  • Adds ansible to the container by way of a new stage in the Dockerfile.

  • Enables buildkit for capable machines to speed builds

  • Reduces overall image size by disabling caching

  • visually separates each stage in the Dockerfile for easier editing

  • I have added new tests to cover the new code

  • If adding a new file, I have updated pyinstaller.py

  • I have added entries in CHANGELOG.md for the changes in this PR

Issues and Related PRs

Testing

Built the prod container and ran an ansible play:

% ./canuctl -r -p 
canu ~/mounted$ ansible-playbook -i /opt/venv/bin/canu-inventory canu/inventory/plays/aruba-aoscx.yml -e config_folder=$PWD/netbak/ --limit sw-leaf-bmc-001

PLAY [aruba] ****************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************************************************************************************************
ok: [sw-leaf-bmc-001]

TASK [get running config as json] *******************************************************************************************************************************************************************************************************
changed: [sw-leaf-bmc-001]

TASK [login to api] *********************************************************************************************************************************************************************************************************************
ok: [sw-leaf-bmc-001]
...
...

and in the dev container:

~/mounted # ansible-playbook -i /opt/venv/bin/canu-inventory canu/inventory/plays/aruba-aoscx.yml -e config_folder=$PWD/netbak/ --limit sw-leaf-bmc-001

PLAY [aruba] ****************************************************************************************************************************************************************************************************************************

TASK [Gathering Facts] ******************************************************************************************************************************************************************************************************************
ok: [sw-leaf-bmc-001]

TASK [get running config as json] *******************************************************************************************************************************************************************************************************
changed: [sw-leaf-bmc-001]

TASK [login to api] *********************************************************************************************************************************************************************************************************************
ok: [sw-leaf-bmc-001]

TASK [upload new config in dryrun mode] *************************************************************************************************************************************************************************************************
ok: [sw-leaf-bmc-001]

TASK [check dry run status] *************************************************************************************************************************************************************************************************************
FAILED - RETRYING: [sw-leaf-bmc-001]: check dry run status (125 retries left).
ok: [sw-leaf-bmc-001]
...
...

@jacobsalmela jacobsalmela self-assigned this Mar 13, 2023
@jacobsalmela jacobsalmela marked this pull request as ready for review March 13, 2023 20:26
@jacobsalmela jacobsalmela requested a review from a team as a code owner March 13, 2023 20:26
closes CASMNET-2077

add ansible to container for running plays

Signed-off-by: Jacob Salmela <jacob.salmela@hpe.com>
Signed-off-by: Jacob Salmela <jacob.salmela@hpe.com>
@sonarcloud
Copy link

sonarcloud bot commented Mar 14, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@lukebates123 lukebates123 merged commit 865f9fb into main Mar 14, 2023
@lukebates123 lukebates123 deleted the add-ansible branch March 14, 2023 21:41
lukebates123 pushed a commit that referenced this pull request Apr 8, 2024
* closes #253
closes CASMNET-2077

add ansible to container for running plays

Signed-off-by: Jacob Salmela <jacob.salmela@hpe.com>

* add new stages to makefile and also enable BUILDKIT

Signed-off-by: Jacob Salmela <jacob.salmela@hpe.com>

---------

Signed-off-by: Jacob Salmela <jacob.salmela@hpe.com>
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.

Update canu-inventory to work seamlessly from a container
3 participants