Ansible
Run Tasks With a Specific Tag
ansible-playbook -i inventory -vv site.yml --tags files
Generate Password for PostgresSQL Task
# shell
env PW=`pwgen -ynN 1 20` sh -c 'printf "%s\tmd5%s\n" "$PW" `echo -n "$PW" | md5`'
Set Inventory Variable for all Hosts
Set the python interpreter to use on all nodes:
[all:vars]
ansible_python_interpreter=/usr/bin/python2.7
Create new Role Skeleton
# shell
mkdir -p roles/some_role_name/{tasks,files,handlers,templates,meta}
Reboot Ansible Managed Servers
ansible all -i inventory -a "/sbin/reboot" -u root
host.example.com | FAILED => SSH Error: data could not be sent to the remote host. Make sure this host can be reached over ssh
The error can be ignored and is due to the server going down and becoming inaccessible.
Last modified: 06 December 2015