Ansible Introduction Training
git clone https://github.com/michael-salo/ansible-training.git
Let’s install VirtualBox first.
Get latest stable version from https://www.virtualbox.org/wiki/Downloads
Follow the instructions here: Vagrant installation
vagrant up
vagrant destroy -f
eval "$(ssh-agent -s)"
ssh-add ~/.vagrant.d/insecure_private_key
ansible -m ping all
function create_role() {
if [ $# != 1 ] ; then
echo "Usage: ${FUNCNAME[0]} <directory_name>"
return 1
fi
mkdir -p $1/{tasks,handlers,templates,files,vars,meta,default}
echo "---" | tee -a $1/{handlers,meta,tasks,vars,default}/main.yml
}
ansible-galaxy init roles/<role_name>
- Extend nginx role to be listened on IP of DB host, but no static variable, use dynamic one from facts.
- Create mysql role for installing and configuring MYSQL on Ubuntu box.
- Create a new php-fpm role or convert an existing playbook that you've already written into role.
- Create a new role to configure sshd service via template on CentOS and Ubuntu.