Running Playbooks
Use the root README for installation and initial setup, then use the commands
below when you want to run playbooks/setup.yml directly from the repository.
Before you run a playbook
Section titled “Before you run a playbook”- Run the commands from the repository root.
- Install host dependencies first as described in the root README.
- Use
--checkfirst when you want a dry run before applying changes. - Adjust the inventory or pass extra variables on the CLI as needed for your environment.
- When using
sailwright provision, configure additional local or Git-backed role roots with Ansible Role Sources.
Run on localhost
Section titled “Run on localhost”For the wrapper-based localhost flow, use Local Provisioning.
On macOS or Linux, direct localhost commands look like this.
Dry run:
ansible-playbook playbooks/setup.yml -i inventory/localhost.yaml --checkApply:
ansible-playbook playbooks/setup.yml -i inventory/localhost.yamlRun on a remote host or in a VM
Section titled “Run on a remote host or in a VM”Dry run:
HOST="192.168.179.21"cat <<EOF > inventory/remote.ymlall: hosts: $HOST: ansible_user: adminEOFansible-playbook playbooks/setup.yml -i inventory/remote.yml -l "$HOST" --ask-pass --ask-become-pass --checkApply:
ansible-playbook playbooks/setup.yml -i inventory/remote.yml -l "$HOST" --ask-pass --ask-become-passRun on Windows
Section titled “Run on Windows”If the Windows target does not already have remote access configured, start with Windows Ansible Access.
If you want the wrapper-managed localhost flow instead of direct
ansible-playbook, use Local Provisioning.
Via WinRM
Section titled “Via WinRM”If you run ansible-playbook directly with
inventory/localhost_windows_winrm.yml, you are responsible for supplying your
own secure WinRM connection variables and credentials.
Via SSH
Section titled “Via SSH”If you run ansible-playbook directly with
inventory/localhost_windows_ssh.yml, you are responsible for supplying your
own secure SSH user, key, and shell variables. Make sure the Windows OpenSSH
server is configured with HKLM:\SOFTWARE\OpenSSH\DefaultShell set to
C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe as described in
Windows Ansible Access, or Ansible may connect
through cmd.exe instead of PowerShell.
$SailwrightPath = "C:\path\to\sailwright"C:\\cygwin64\\bin\\bash.exe -l -c "cd $SailwrightPath && ansible-playbook playbooks/setup.yml -i inventory/localhost_windows_ssh.yml -l windows_host -e ansible_user=admin -e ansible_ssh_private_key_file=/path/to/key -e ansible_shell_type=powershell -e ansible_shell_executable=powershell.exe -vvv"