How to loop on a parameter file the play of the playbook

14 views
Skip to first unread message

fanvalt

unread,
Apr 18, 2016, 8:29:01 AM4/18/16
to Ansible Project
Hello,

I would like to use only parameters in my playbook and so to use an external variables file to set the host, user, http parameters etc ... so my playbook would loop on it.
Is this possible ?

Here is an explaination of my needs:
I would like noone has to modify the playbook to set the parameters, I want all variables to be external variables.

I'd like to give the following informations when playing the playbook:

host=server1, user=user1, http_port=8080, release=1.2
host=server1, user=user2, http_port=8081, release=2.3
host=server2, user=user1, http_port=8080, release=2.3
etc ...

Is using the hosts file a way to do so,are we allowed to set any parameters we want like:
[deployed_server]
server1 user=user1 http_port=8080 release=1.2
server2 user=user1 http_port=8080 release=2.3 
or can we only pass ansible variables in the hosts file ?

My purpose would be to allowed a user to create a file in EXcel and to transfer is on the ansible master host and then the playbook would be run with this excel file as an external parameter file.

Any clue ?
Regards

fanvalt

unread,
Apr 19, 2016, 6:32:10 AM4/19/16
to Ansible Project
Done, I did use an array to set the parameters in the hosts file
Reply all
Reply to author
Forward
0 new messages