*  - name: loop over beofulf nodes
    include_tasks: create-a-node.yml
    loop: "{{ range(0, 1000) | list }}"
    vars:
      nodename: "{{ 'beofulfnode%03d' | format(item) }}"*

​
On Saturday, December 11, 2021 at 3:23:08 AM UTC-5 [email protected] wrote:

> Apparently the recommendation these days is to use the range filter:
>
>
> https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html#with-sequence
>
>
> On Fri, 10 Dec 2021 at 22:55, Todd Lewis <[email protected]> wrote:
>
>> It's something close to this, but "create-a-node.yml" isn't a playbook in 
>> this case, but rather just a task file.
>>
>> - name: loop over beofulf nodes
>>   include_tasks: create-a-node.yml
>>   with_sequence: start=000 end=999
>>   vars:
>>     nodename: "beofulfnode{{ item }}"
>>
>> On Friday, December 10, 2021 at 4:05:31 PM UTC-5 [email protected] 
>> wrote:
>>
>>> I know I can do this from a shell script. I wonder if I can do this in 
>>> pure Ansible. 
>>> I was thinking about clusters recently. I know I can use the VM module 
>>> to spin up a VM. 
>>> If I wanted 1,000 nodes, how would I loop inside Ansible for the nodes? 
>>> Using the shell I would do something like (not tested): 
>>>
>>> for i in `seq 000 999` 
>>> do 
>>> ansible-playbook -e nodename=“beofulfnode$i” create-a-node.yml 
>>> done 
>>>
>>> How to do this looping in pure Ansible? 
>>>
>>> Mike
>>
>> -- 
>>
> 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/dedab6d9-0b77-4313-949e-7e495f32e086n%40googlegroups.com
>>  
>> <https://groups.google.com/d/msgid/ansible-project/dedab6d9-0b77-4313-949e-7e495f32e086n%40googlegroups.com?utm_medium=email&utm_source=footer>
>> .
>>
> -- 
> Sent from a mobile device - please excuse the brevity, spelling and 
> punctuation.
>

-- 
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/2578137e-ba7a-481a-82f2-67e5f694b293n%40googlegroups.com.

Reply via email to