Created
August 1, 2023 13:27
-
-
Save tabrez/bf48acd20525a0d86168d9b769addf31 to your computer and use it in GitHub Desktop.
Bash script that allows picking what roles to install on a machine using ansible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Define an array of roles | |
roles=( | |
"ansible", | |
"copy-private-ssh-key", | |
"copy-public-ssh-key", | |
"password-less-sudo", | |
"ssh-config", | |
"config-local", | |
"utils", | |
"neovim", | |
"astrovim", | |
"docker", | |
"multipass", | |
"setup-root", | |
"jupyterlab" | |
# "ssh-server", | |
# "packer", | |
# "terraform", | |
# "vscode-extensions", | |
# "megacmd", | |
# "nfs-fstab" | |
# "smb-fstab" | |
) | |
# Build the tags string by joining the roles with a comma | |
tags=$(IFS=,; echo "${roles[*]}") | |
# Run the ansible-playbook command with the specified tags | |
ansible-playbook -i hosts playbook.yml --tags "$tags" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment