FreeKB - ansible-playbook - play_hosts
ansible-playbook - play_hosts

Home > Search


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

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 2acd8 in the box below so that we can be sure you are a human.




Comments