In the previous post, we have seen how to generate multiple files using with_sequence and loop features.
Here, we will introduce the delay functionality in the loop feature. This will give a pause after every iteration. So, each file will be created at specific time interval. The official document on loop control can be found here. Download the .yml file directly if you don’t want to go through the discussion.
Tag: Ansible-playbook
Ansible-Playbook Example2: Loop, with_sequence
Loop and with_sequence allows the commands or the instructions to be executed iteratively. However, I find the syntax bit different from other programming language. Probably this is due to YAML structure. Anyways, lets see few examples and see how to use loop and with_sequence. You can find the official documentation on loop here and on with_sequence here. The list of examples are as follows:
Ansible-Playbook Example1: Ping remote machine
Two ways to test the connection with remote servers.
- One is to write the playbook and execute
- Other is directly passing the ping command as an argument to ansible command
Ansible: Installation and Configuration
Ansible is an open-source software provisioning, configuration management, and application deployment tool. It runs on many Unix-like systems, and can configure both Unix-like systems as well as Microsoft Windows. Before proceeding for the installation, it is necessary to get yourself comfortable with basic knowledge.
Ansible Wikipedia: https://en.wikipedia.org/wiki/Ansible_(software)
Official Documentation: https://docs.ansible.com/
Click here to proceed for quick guied on Installation and configuration