On 07.08.2019 18:55, Veera wrote:
> Hi,
>
> Is there a way that we can use a playbook with no "hosts: XXX" defined.
No, hosts is a required attribute for a play.
> All the servers are available in the inventory file defined in the
> ansible.cfg , but the playbooks have to be run based on a single or
> multiple client on the ad-hoc request based.
You can always set hosts: all and use the --limit to only run on some hosts.
> Is there a way to remove
>
>
> hosts: all
>
>
> and have the same playbook working for security reasons ?
I don't understand what you mean by "for security reasons".
> In the meantime when a play is to be executed in all the clients they have
> to be mentioned from the command line(or jenkins)
You can use a variable for hosts an set it with extra vars on the command line
- hosts: '{{ myvar }}'
ansible-playbook pb.yml -e myvar=all
--
Kai Stian Olstad
--
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 view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/a72f190a-749a-71f9-673a-735e9e738d8e%40olstad.com.