This repository holds materials for my Bolt tutorial on various platforms

View on GitHub

Running commands

We can run against hosts without them being in the inventory.yaml

bolt command run "whoami" --targets ssh:// -u ansible -p ansible --no-host-key-check

We can use a jolly-joker called all

bolt command run "whoami" --targets all

We create these two scripts, and test.ps1.


echo "This is running",$0,$1
write-host "$psversiontable"
write-output "This is cooool!"

We execute the bash script with arguments this way.

bolt run script "first argument" --targets linux

We execute the powershell script this way.

bolt script run test.ps1  --targets windows

In order to upload files we need to make sure we provide the filename aswell. We also need to make sure the user has the appropriate acces level to drop the files.

bolt file upload ./ /home/ansible/test/ --targets linux

For windows the path is a bit tricky.

bolt file upload ./ C:\\temp\\ --targets windows