well other option (i used only once) is run the shell command with gnu parallel . its pretty amazing! but i pretty stiff learning curve. maybe you could , give it a chance.
best regards! El mar., 1 sept. 2020 a las 4:19, Guannan Sun (<ecnu...@gmail.com>) escribió: > Thank you for your response. > I've tried to add 'strategy: free' in my playbook, however it seems not > work as my expectation. I think it may because there is only single host in > my scenario, while 'strategy: free' works well in scenario of multi hosts > and multi tasks. > We're now trying to run multi jobs at the same time on AWX. One jobs call > the role 'create_site' and loop for 5 configuration files, so that 20 jobs > will cover 100 configuration files. It seems work in my scenario. > Thank you anyway, and good-looking signiture :) > > 在2020年9月1日星期二 UTC+8 上午4:10:14<mar...@etcheverri.com> 写道: > >> Hi ! maybe something like this : >> >> https://medium.com/developer-space/parallel-playbook-execution-in-ansible-30799ccda4e0 >> >> El lun., 31 ago. 2020 a las 6:57, Guannan Sun (<ecn...@gmail.com>) >> escribió: >> >>> Thank you for your response. >>> Well, in my condition, I using 'create_site' role to create a site in a >>> netbox. It will create a site with name, region, and some other fields, >>> associate some devices and vlans with the site. >>> You may just treat 'create_site' as a role execute some tasks in serial. >>> >>> 在2020年8月31日星期一 UTC+8 下午5:45:56<brae...@gmail.com> 写道: >>> >>>> On 8/31/20 11:38 AM, Guannan Sun wrote: >>>> > Dear Tech Team, >>>> > >>>> > I'm Guannan from China. I'm new to Ansible and looking for some >>>> technical help. >>>> > Actually I'm looking for a method to execute one role in parallel >>>> with loops of different configuration files. For >>>> > example, I want to create 100 sites using role "create_site" with 100 >>>> different configuration files. I simply write a >>>> > playbook like this: >>>> > >>>> > - hosts: localhost >>>> > gather_facts: no >>>> > tasks: >>>> > - name: register files >>>> > shell: "find /tmp/site_files -name '*.yml' | sort" >>>> > register: file_names >>>> > >>>> > - include_role: >>>> > name: create_site >>>> > vars_from: "{{ item }}" >>>> > with_items: "{{ file_names.stdout_lines }}" >>>> > >>>> > This will create 100 sites in serial. If create one site take 2 >>>> minutes, then the whole playbook will take over 200 >>>> > minutes. I found 'async' option when execute tasks, however it seems >>>> only used for async jobs on different hosts. Do you >>>> > guys have experience or methods on how to execute one role with >>>> different configuration files in parallel? Please send >>>> > me E-mails. >>>> > Much thanks for your help! >>>> >>>> What is the "create_site" role actually doing? >>>> >>>> Regards >>>> Racke >>>> >>>> > >>>> > -- >>>> > 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 >>>> > ansible-proje...@googlegroups.com <mailto: >>>> ansible-proje...@googlegroups.com>. >>>> > To view this discussion on the web visit >>>> > >>>> https://groups.google.com/d/msgid/ansible-project/7d012eec-95de-48c3-8b8a-d32928170eacn%40googlegroups.com >>>> > < >>>> https://groups.google.com/d/msgid/ansible-project/7d012eec-95de-48c3-8b8a-d32928170eacn%40googlegroups.com?utm_medium=email&utm_source=footer>. >>>> >>>> >>>> >>>> -- >>>> Ecommerce and Linux consulting + Perl and web application programming. >>>> Debian and Sympa administration. Provisioning with Ansible. >>>> >>>> -- >>> 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 ansible-proje...@googlegroups.com. >>> To view this discussion on the web visit >>> https://groups.google.com/d/msgid/ansible-project/4a67d662-278a-4070-9091-18778ae53befn%40googlegroups.com >>> <https://groups.google.com/d/msgid/ansible-project/4a67d662-278a-4070-9091-18778ae53befn%40googlegroups.com?utm_medium=email&utm_source=footer> >>> . >>> >> >> >> -- >> >> ::: (\(\ >> *: (=' :') :* >> ... (,('')('').... >> mar...@etcheverri.com >> Consultoria de sistemas >> >> >> >> -- > 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 ansible-project+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/a46ee218-282b-46ca-9de3-b7715fa24df2n%40googlegroups.com > <https://groups.google.com/d/msgid/ansible-project/a46ee218-282b-46ca-9de3-b7715fa24df2n%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- ::: (\(\ *: (=' :') :* ... (,('')('').... mar...@etcheverri.com Consultoria de sistemas -- 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 ansible-project+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAK5ZirxP-cif-ewXH3UB6tWCDE81VqWM1fmk28U2U9piFia7iw%40mail.gmail.com.