BCDevOps / nrdk

Natural Resource Ministries Developer/Deployment Kit
3 stars 4 forks source link

Ansible Prep #90

Closed DerekRoberts closed 3 years ago

DerekRoberts commented 3 years ago

Reapply Ansible for nrdk:

https://github.com/BCDevOps/nrdk/blob/master/src/commands/tool/ansible-playbook.ts npx @bcgov/tool:ansible-playbook ...

Entitlement: https://access.redhat.com/solutions/1443553

Red Hat Universal Base Images (UBI). Better than entitlement? https://developers.redhat.com/blog/2020/03/24/red-hat-universal-base-images-for-docker-users#red_hat_enterprise_linux_and_docker

Breakdown:

Create test folder on local machine:

docker run --rm -v "$(pwd):/source" -w "/source"  -it quay.io/ansible/toolset bash -c "ansible-playbook -i hosts testFolder.yml"

UPDATE - from another repo: Option 1 Start the container with mounting the root directory directly in an expected collections path:

docker run --rm -v "/var/run/docker.sock:/var/run/docker.sock" -v "${PWD}:/usr/share/ansible/collections/ansible_collections/bcgov/nr" -w "/usr/share/ansible/collections/ansible_collections/bcgov/nr" -it quay.io/ansible/toolset bash

Option 2 we can start with mounting the root directory anywhere, and adding a symlink to the mounted path

docker run --rm -v "/var/run/docker.sock:/var/run/docker.sock" -v "${PWD}:/source" -w "/source"  -it quay.io/ansible/toolset bash
# after the container started, and you have a shell prompt:
mkdir -p /usr/share/ansible/collections/ansible_collections/bcgovln -s /source /usr/share/ansible/collections/ansible_collections/bcgov/nr

UPDATE: Task treated as training. Closing without merge.