Not sure the best way to do this, have read the documentation but still a
wee bit befuddled.
We're ramping up to be able to deploy to several hundred servers. Each
server will have an assigned name. Some of the files that will be deployed
will need that name, whereas as deployed they have a place holder. I think
I have a pretty firm handle on using the replace module. What I'm not sure
about is how best to apply the names to the servers and then pull each name
out as a var, based on server being presently deployed to, so I can use it
in the replace function.
SO, let's say I have three servers each in Dallas and Baltimore. If I set
up my inventory file as follows:
[Dallas]
server01 ansible_ssh_host=192.174.38.12
server02 ansible_ssh_host=someOtherIP
server03 ansible_ssh_host=yetAnotherIP
[Baltimore]
server04 ansible_ssh_host=aFourthIP
server05 ansible_ssh_host=aFifthIP
server06 ansible_ssh_host=LastIP
I have now named each server with a unique name, right? But in the
inventory docs it says: "The preferred practice in Ansible is actually not
to store variables in the main inventory file." and I agree. At some point
I will want to add more variables.
So how would I set up a variable file such that it provides a name, based
on the IP being deployed to? and how do I reference that file in the
playbook so the plays know where to get the vars from? Sorry, very new at
all this.
Once I've done that, I'm thinking the play to replace the place holder
would look something like this?
- replace:
dest=abc.conf
regexp='placeholder'
replace={{ server_name }}
backup=yes
--
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 post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/6f24a6ba-c72f-4bd5-b16b-62ac047a42d2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.