You can define a data structure, a dict for example containing number of shards per server an individual shard settings etc. Then just use with_sequence to iterate from 1 to length of the aforementioned shards list.
On Wed, Oct 20, 2021, 08:02 Hareesh Vn <[email protected]> wrote: > Hi Team > > Below is problem description on which i need help. > > I am adding single mongo db shards by running below shell command -- this > is working fine to install on one server > - name: "Creating the database" > command: "sh /tmp/add_shard.sh {{item}} {{mongo_user}} > {{mongo_password}}" > register: mongo_db_shard_add > ignore_errors: true > with_items: "{{P_NODE}}" > when: ansible_default_ipv4_address ==== "{{item}}" > > here my Question : > > Now i want to run add mutiple shards on multiple servers (example: add 3 > shards on each servers). So how to change above code? > > Basically , i want to run below command repeatedly in loop for "n' number > of time where n=number of shards to be added. > Also i should pass 'n' as input while running playbook > > command: "sh /tmp/add_shard.sh {{item}} > {{mongo_user}} {{mongo_password}} {{n}}" > where "n" is number of shards to be created" > > > Thanks > Hareesh > > > > > -- > You received this message because you are subscribed to the Google Groups > "Ansible Project" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/3a17346e-7abf-4cca-aa3a-a60445d2e380n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/3a17346e-7abf-4cca-aa3a-a60445d2e380n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAFtje5MrE-G8oMAX990D-PahqBqxxDwMKdkuFuFNFovxQrY9Mg%40mail.gmail.com.
