FreeKB - play_hosts variable
Ansible - play_hosts variable

This assumes you have installed Ansible, are familiar with the ansible-playbook command and have created a playbook.

The play_hosts variable will contain the hosts the play is being run against, like this.

- debug: msg="{{play_hosts}}"

 

Which will produce output like this.

TASK [debug]
ok: [server1.example.com] => {
    "msg": [
         server1.example.com"
    ]
}

 

Or, you can create a new variable that contains the value of play_hosts.

target_servers: "{{play_hosts}}"

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 4a76a in the box below so that we can be sure you are a human.




Comments