I want to run ansible role by iterating it through count of value that I am providing.
Say for example: Below is the Ansible role main.yml, in which I include
a yaml file to execute where this included yaml file should execute the number of times with the loop which I have.
Here is my small piece of code where I used with_sequence
module. But if you have any other suggestion to run the create_db.yml
file multiple times, please share with or how to loop through with the current code that I have.
Could someone help me on this?
---
# tasks file for create db
- hosts: localhost
become: yes
tasks:
- include: create_db.yml
with_sequence: count = 2
I am getting below error while executing the playbook
fatal: [localhost]: FAILED! => {"msg": "unrecognized arguments to with_sequence: [u'_raw_params']"}
As mentioned in the comments, the use case for running the same task file twice without any change in parameters is not clear. But the error...
... indicates that the syntax for specifying
count
is incorrect. Please note that there should be no spaces around=
, i.e.count=2
.