Clever indeed. Nice work. Walter -- Walter Rowe, Division Chief Infrastructure Services, OISM Mobile: 202.355.4123
On Jan 27, 2023, at 10:31 AM, javed khan Siddque <[email protected]> wrote: it create only next number , which doesn't exist the powerful line is :- when: not (res.changed | d(false)) On Friday, January 27, 2023 at 8:55:49 PM UTC+5:30 [email protected] wrote: Clever. Does it create 99 local directories, or just the next number that doesn't exist? Walter -- Walter Rowe, Division Chief Infrastructure Services, OISM Mobile: 202.355.4123<tel:(202)%20355-4123> On Jan 27, 2023, at 10:23 AM, javed khan Siddque <[email protected]> wrote: I tried 2-3 combination , but nothing worked , So i thought of asking here , Since my issue fix from here only. Then i found the solution by small research on jinja and dict register output - name: "Register a Variable and Search to perform Operation" hosts: localhost vars: list_of_sequence: "{{ range(1, 100) | list }}" tasks: - name: Create a series of directories with even numbers for some reason ansible.builtin.file: path: "/var/test{{ '%02d' | format(item) }}" state: directory mode: '0655' become: true register: res when: not (res.changed | d(false)) loop: '{{ list_of_sequence }}' On Friday, January 27, 2023 at 7:06:19 PM UTC+5:30 [email protected] wrote: You are asking us to solve your problem. You aren't asking us a question about ansible itself. Walter -- Walter Rowe, Division Chief Infrastructure Services, OISM Mobile: 202.355.4123<tel:(202)%20355-4123> On Jan 27, 2023, at 8:32 AM, javed khan Siddque <[email protected]> wrote: i am looking for some concent like below 1) Look For /var/test01 , if not there create it- test01 2) Look For /var/test01 , if already exist then move to next name :- test02 (move like next integer number) 3) Look for /var/test01 or 02 , then move to next name :- test03 (move like next integer number) and so on. the below concept is not working - name: "Register a Variable and Search to perform Operation" hosts: localhost tasks: - name: Create a series of directories with even numbers for some reason ansible.builtin.file: dest: "/var/test{{ '%02d' | format(item) }}" state: directory mode: '0655' become: true loop: "{{ range(0, 100) | list }}" -- 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/c364f32a-b419-4313-a9d5-8085384f658an%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2Fc364f32a-b419-4313-a9d5-8085384f658an%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cb4c4bf17c8874af4913908db007b95b2%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638104303033875481%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=MWXnRKQy3pklUw5oO5byumJlopdq8EWFQsJPUctVoiw%3D&reserved=0>. -- 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/56c4c0ac-541f-412f-a0de-c54b2fbb22ben%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F56c4c0ac-541f-412f-a0de-c54b2fbb22ben%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cb4c4bf17c8874af4913908db007b95b2%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638104303033886501%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=w1Cj2hEpdEieo1d3d4zh0il5dHhGgPoBcJsKhsnhOOo%3D&reserved=0>. -- 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]<mailto:[email protected]>. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/634ef828-71b1-4740-b8ff-8056f91cf480n%40googlegroups.com<https://gcc02.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgroups.google.com%2Fd%2Fmsgid%2Fansible-project%2F634ef828-71b1-4740-b8ff-8056f91cf480n%2540googlegroups.com%3Futm_medium%3Demail%26utm_source%3Dfooter&data=05%7C01%7Cwalter.rowe%40nist.gov%7Cb4c4bf17c8874af4913908db007b95b2%7C2ab5d82fd8fa4797a93e054655c61dec%7C1%7C0%7C638104303033886501%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C&sdata=KhNvz2GEkbUbXkMOyby2KowSl7W0%2BigEUq00Ojw3y4c%3D&reserved=0>. -- 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/9B3D30ED-3419-463B-B348-109CF5DA5156%40nist.gov.
