parallelism in ansible
- Ansible forks: This represents the number of hosts in which ansible will parallely execute the playbook
- The default number of forks are 5, This value can be changed while executing ansible command or in the configuration file.
- Refer Here for the setting number of forks
- If you want to run the whole playbook in batches use serial Refer Here
Order of execution
Tags in Ansible
ansible-playbook -i hosts tags.yaml --tags pre
ansible-playbook -i hosts tags.yaml --tags pre,main
ansible-playbook -i hosts tags.yaml --skip-tags pre
ansible-playbook -i hosts tags.yaml --skip-tags pre,verbose
- dynamic inventory is where you can still use
-i to pass this script to ansible playbook.
- Ansible will execute this script (i.e. this file needs to have executable permissions). Script can be in any language. ansible will call this script and read the json response and dynamically use the ipaddress/hostnames from the script.
- Now to get ansible inventories dynamically we have plugins for every cloud.
Ansible for Windows
- Refer Here
- ansible_connection variable will have a default value of ssh, while connecting to windows machines we have two options
Winrm setup on Windows Server
- Install mysql and postgres using ansible roles
- Install mongo db on ubuntu
- Install ha proxy
- Install java on windows server
- Install nop commerce Refer Here
- convert this script Refer Here into ansible playbook