opiproject / ansible-opi-dpu

Ansible Modules for DPUs
Apache License 2.0
6 stars 8 forks source link

docker: package collection inside #45

Closed glimchb closed 7 months ago

glimchb commented 7 months ago

add to https://github.com/opiproject/ansible-opi-dpu/blob/main/Dockerfile

        ansible-galaxy collection build --output-path /opt/
        ansible-galaxy collection install /opt/*.tar.gz 

consider multi-stage build here to reduce image size... and then runtime can be:

docker run --rm -it --entrypoint ansible-playbook ghcr.io/opiproject/ansible-opi-dpu:main /opt/playbooks/firmware.yml -vvv -i "10.10.10.1," -e dpu_bmc_username='root' -e dpu_bmc_password='123456'

or

$ docker run --rm -it ghcr.io/opiproject/ansible-opi-dpu:main 10.10.10.1 --module-name include_role --args name=bmc_fw_update -vvv -i "10.10.10.1," -e dpu_bmc_username='root' -e dpu_bmc_password='123456'

instead of

docker run --rm -it --entrypoint ansible-playbook -v $(pwd):$(pwd) -w $(pwd)/roles ghcr.io/opiproject/ansible-opi-dpu:main ../playbooks/firmware.yml -vvv -i "10.10.10.1," -e dpu_bmc_username='root' -e dpu_bmc_password='123456'
glimchb commented 7 months ago

also from https://docs.ansible.com/ansible/latest/collections_guide/collections_installing.html

# Install a collection in a repository using the latest commit on the branch 'devel'
ansible-galaxy collection install git+https://github.com/organization/repo_name.git,devel

# Install a collection from a private GitHub repository
ansible-galaxy collection install git@github.com:organization/repo_name.git

# Install a collection from a local git repository
ansible-galaxy collection install git+file:///home/user/path/to/repo_name.git

so maybe just add git+file:///home/user/path/to/repo_name.git to requirements.yml ?