Openunix.eu


Ansible

This is a very frequently used automation tool. Here are simple hints for usage.

An example of command line usage:

 
    
ansible -m ping all                                        -- will check all known hosts and collect details
ansible-playbook inst-software.yml -t firefox              --will run install-software playbook using the tag "firefox" to install it
ansible-playbook inst-rsync -l webserver1                  --will run install-rsync playbook only on host webserver1
ansible-plabyook inst-apache --extra-vars '{"version":"2.4"}' -- will use manually added version variable

Here is a typical ansible tree explained

.
├── ansible.cfg              <- here is a config for ansible
├── copy-ansible-files.yml    <- a typical playbook
├── files                     <- a storage for storing files
│   └── newfile
├── hosts                      <- here are the hosts defined
├── host_vars
│   └── all.yml               <- here are the variables 
├── vault.yml                 <- here are encoded passwords
├── install_rsync.yml         <- a typical playbook
├── rm_users .yml             <- another playbook
└── roles                     <- here are various roles, mainly for installing apps
    └── apache
        └── tasks
            └── main.yml
 

Powered by NetBSD. Running on a toaster.