Hi Rama,
You can create playbook/role simples:
1) create regex and split server from number "{{
ansible_hostname.split('server')[1] }}"
2) Check if the number is divisor per 2; {{ variable_number % 2 }}
3) if divisor 2, copy script1 else copy script 2 file: src: script{{
var01 }}
On Mon, Jun 15, 2020 at 3:26 AM rama543 <[email protected]> wrote:
> Hi Friends,
>
> I am new to this Ansible world
>
> Needs to write a playbook for one scenario
>
> Scenario-1:
>
> I have 1000 Servers . Host-names are like Server1, Server2, Server3,
> Server4, Server5, .........Server1000 .
>
> I have two Script files Script-1.sh and Script-2.sh in my controller .
>
> Now i want create a folder "/opt/Server/Odd" and copy the Script-1.sh
> file in Server1, Server3, Server5, Server7 ......Server999 .
> create a folder "/opt/Server/Even" and copy the Script-2.sh file in
> Server2, Server4, Server6, Server8, .................Server1000.
>
> Can you guys help me to write playbook
>
> Thanks in Advance
>
> --
> 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/682613d9-09c4-4aa6-b52e-338a076c51e2o%40googlegroups.com
> <https://groups.google.com/d/msgid/ansible-project/682613d9-09c4-4aa6-b52e-338a076c51e2o%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
--
Atenciosamente,
Rafael Tomelin
Tel.: 51-984104084
Skype: rafael.tomelin
LPI ID: LPI000191271
Red Hat Certified Engineer
Puppet Professional 2017 Certification
--
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/CAGEUqbDzoBg%2BUjORXQtaeVk4m0ZEYHNWiuPz-Sms%2B0TrRpeNzw%40mail.gmail.com.