Skip to content
A collection of one-off type Ansible playbooks and roles to make repetitive tasks easier
Branch: develop
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
playbooks
roles
README.md
ansible.cfg

README.md

ansible-toolbox

Collection of roles/playbooks to make day to day operations with multiple systems easier.

Playbooks

run_cmd.yml

Executes the contents of the command variable, and captures output per host into the logs/ directory.

Examples:

Run ls -al on all hosts in the metacpan inventory file.

ansible-playbook \
  -i inventories/samples \
  --extra-vars "command='ls -al'" \
  --ask-sudo-pass --become \
  playbooks/run_cmd.yml

Look for a cron entry that contains the phrase GMC.

ansible-playbook \
  -i inventories/samples \
  --extra-vars "command='grep -R GMC /etc/cron.d'" \
  --ask-sudo-pass --become \
  playbooks/run_cmd.yml
ansible-playbook \
  -i inventories/samples \
  --extra-vars "command='grep -R GMC /var/spool/cron'" \
  --ask-sudo-pass --become \
  playbooks/run_cmd.yml

Issue curl command on each server to test localhost response

ansible-playbook \
  -i inventories/samples \
  --extra-vars "command='curl -XGET \"http://localhost:5000/v1/search/web?q=Mojo&collapsed=blah\"'" \
  playbooks/run_cmd.yml

ssh_client.yml

Deploy ssh keys

ansible-playbook \
  --ssh-common-args="-o PreferredAuthentications=password -o PubkeyAuthentication=no" \
  --ask-pass \
  -i inventories/samples \
  -u new_project_user \
  playbooks/setup_ssh_keys.yml

The above play relies on the inventories/samples/group_vars/all.yml to contain the following variables:

---

ansible_user: new_project_user
ssh_username: new_project_user
ssh_key: new_project_key

distribute_file

A simple playbook to replicate files or directories from the local system to all hosts. This module uses rsync to replicate the file to the remote hosts.

ansible-playbook \
  -i inventories/samples \
  --extra-vars "src_file=$PWD/README.md" \
  --extra-vars "dest_file=tmp/README.md" \
  playbooks/distribute_file.yml
You can’t perform that action at this time.