Re: [ansible-project] Define hostname for group based on index+1

2022-04-15 Thread Stefan Hornburg (Racke)
On 15/04/2022 12:45, dudu.c...@gmail.com wrote: First of all thank you - it works. But, can i spare  the following definition  ? *groups['web-server']* Basically in the begging of the playbook I'm defining the group under hosts - hosts: web-server You could try ansible_play_hosts instead.

Re: [ansible-project] Define hostname for group based on index+1

2022-04-15 Thread dudu.c...@gmail.com
First of all thank you - it works. But, can i spare the following definition ? *groups['web-server']* Basically in the begging of the playbook I'm defining the group under hosts - hosts: web-server ב-יום שישי, 15 באפריל 2022 בשעה 11:58:31 UTC+3, ra...@linuxia.de כתב/ה: > On 15/04/2022 09:18,

Re: [ansible-project] Define hostname for group based on index+1

2022-04-15 Thread Stefan Hornburg (Racke)
On 15/04/2022 09:18, dudu.c...@gmail.com wrote: Hi, I have X amount of server inside a defined group (For example - web server) I want to loop the server a define there hostname based on index+1 For example, if the group have 3 server , so server one should be "web-server1" , second ,

[ansible-project] Define hostname for group based on index+1

2022-04-15 Thread dudu.c...@gmail.com
Hi, I have X amount of server inside a defined group (For example - web server) I want to loop the server a define there hostname based on index+1 For example, if the group have 3 server , so server one should be "web-server1" , second , "web-server-2" etc. The below didnt do the trick -