Some document to help you start with ansible
Navigate to your workspace folder, then run:
devops-toolkit-cli init demo_ansible01
devops-toolkit-cli run demo_ansible01
# You now in the container terminal. Execute the ansible command normally
ansible --version
It will mount the workspace code to container and you then can execute desired scripts inside the devops-toolkit
container.
To use the existing container instead of creating one, use docker exec
command instead of docker run
docker exec -it my_devops_toolkit /bin/bash
For instructions on common run modes, visit DevOps Toolkit Common Run Mode.
docker run --rm --network host -v ~/.dtc:/dtc -it tungbq/devops-toolkit:latest
# You now in the container terminal
ansible-playbook samples/ansible/check_os.yml
docker run --rm --network host -v ~/.dtc:/dtc -it tungbq/devops-toolkit:latest
# You now in the container terminal
# Now run your cloned script
# Clone code
mkdir ansible_workspace; cd ansible_workspace
git clone https://github.com/ansible/ansible-examples.git
cd ansible-examples
ansible-playbook <YOUR_PLAYBOOK_CMD>
Clone the code to the host then mount to container
# Given that we have code somewhere in you machine
docker run --rm -v "$(pwd)":/root/ansible_workspace --network host -v ~/.dtc:/dtc -it tungbq/devops-toolkit:latest
# Run the ansible code as usual
Clone the code to the host then mount code and .ssh
folder to container
# Given that we have code somewhere in you machine
docker run --rm -v ~/.ssh:/root/.ssh -v "$(pwd)":/root/ansible_workspace --network host -v ~/.dtc:/dtc -it tungbq/devops-toolkit:latest
# Run the ansible code as usual
- For any issues, check this reference