Skip to content

Instantly share code, notes, and snippets.

@swasher
Last active April 10, 2016 09:08
Show Gist options
  • Save swasher/0e7069f18f0f4f4a05a47c63aa3a10d4 to your computer and use it in GitHub Desktop.
Save swasher/0e7069f18f0f4f4a05a47c63aa3a10d4 to your computer and use it in GitHub Desktop.
Script for apply ansible role
#!/usr/bin/env bash
# install pip
curl -s https://bootstrap.pypa.io/get-pip.py | sudo python -
# add path for install ansible in user mode (otherwise it can't start because not it PATH)
echo "export PATH=$PATH:$HOME/.local/bin" >> .bashrc
export PATH=$PATH:$HOME/.local/bin
# install ansible
pip install ansible --user
# download role to /home/user/
ansible-galaxy install -p $HOME swasher.dotfiles
# provide vault password
echo 'password' > swasher.dotfiles/vault_password
# create playbook
echo "---" > dotfiles.yml
echo "- hosts: localhost" >> dotfiles.yml
echo " roles:" >> dotfiles.yml
echo " - swasher.dotfiles" >> dotfiles.yml
# start playbook
ansible-playbook dotfiles.yml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment