I want it to loop because, assuming i'm creating 1000 instances, it will be inconvenient to do it one by one. So I wish to know how to insert variables which specific the number to create or assign as port.
Thanks On Thu, Oct 1, 2015 at 3:47 PM, DEBORAH AKUOKO < [email protected]> wrote: > This was awesome David, > > It worked perfectly. Thanks. > But one thing, I want to assign port and shutdown port to each of these 3 > directories. > > manually, i do it in ubuntu with > sudo tomcat-instance1-create -p 8081 -c 8006 timo > sudo tomcat-instance2-create -p 8082 -c 8007 pumba > > where -p specifies the running port of the instance and -c is the shutdown > port > > How do I get this to work in ansible ? > > Thanks. > > On Thu, Oct 1, 2015 at 3:12 PM, David Karban <[email protected]> wrote: > >> Hi Deborah, >> >> use with_items: >> >> - name: Creating multiple tomcat instance >> file: dest=/var/lib/tomcat-instance{{ item }} state=directory >> with_items: >> - 1 >> - 2 >> - 3 >> >> Or, maybe better way with_sequence: >> - name: Creating multiple tomcat instance >> file: dest=/var/lib/tomcat-instance{{ item }} state=directory >> with_sequence: start=1 end=3 >> >> More about loops: http://docs.ansible.com/ansible/playbooks_loops.html >> >> >> David Karban >> Linux server specialist/Specialista na správu linuxových serverů >> www.karban.eu >> >> 2015-10-01 17:05 GMT+02:00 DEBORAH AKUOKO <[email protected] >> >: >> >>> I am trying to create multiple directories with different names e.g >>> tomacat-1, tomcat-2 etc.. >>> But i want to do this in the form of a loop. Kindly help me with the >>> yaml syntax. >>> >>> this is what i tried >>> >>> - name: Creating multiple tomcat instance >>> file: dest=/var/lib/tomcat-instance{1..3} state=directory >>> >>> But instead of creating three directories, it creates only one with name >>> "tomcat-instance{1..3}" >>> Also i would like each of these folders to have a unique port id and >>> shutdown port e.g -p 8000 -c 8006 >>> >>> -- >>> 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 post to this group, send email to [email protected]. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/c56b427d-167c-4853-91dd-1bbbb1a5cc48%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-project/c56b427d-167c-4853-91dd-1bbbb1a5cc48%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> For more options, visit https://groups.google.com/d/optout. >>> >> >> -- >> You received this message because you are subscribed to a topic in the >> Google Groups "Ansible Project" group. >> To unsubscribe from this topic, visit >> https://groups.google.com/d/topic/ansible-project/cp5p6rbYkEo/unsubscribe >> . >> To unsubscribe from this group and all its topics, send an email to >> [email protected]. >> To post to this group, send email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/CAOBFM95Z-84v%3Dz4zLRgCS2N9iuPW%2B2%3Dt8LXkotGuWazuTJ-2ig%40mail.gmail.com >> <https://groups.google.com/d/msgid/ansible-project/CAOBFM95Z-84v%3Dz4zLRgCS2N9iuPW%2B2%3Dt8LXkotGuWazuTJ-2ig%40mail.gmail.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CA%2Bu%2B6umzZaHJHHjT5vEnnOGw%2BX12eo80WL5-xJ5j%3DpnGCwVO2A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
