On Wed, 22 Jan 2020 21:32:54 +0530 Punit Jain <[email protected]> wrote:
> - hosts: all
> connection: local
> gather_facts: no
>
> tasks:
> - name: add host
> add_host:
> name: 'testserver'
> groups: all
>
> - name: refresh
> meta: refresh_inventory
>
> - name: print
> debug:
> msg: "hello"
> [...]
> it doesnot run task for added host
> I dont see task for testserver.
Split the playbook to 2 plays. Add the host in the first play, and use it the
second.
- hosts: all
connection: local
gather_facts: no
tasks:
- name: add host
add_host:
name: 'testserver'
groups: all
run_once: true
- hosts: all
connection: local
gather_facts: no
tasks:
- name: print
debug:
msg: "hello"
HTH,
-vlado
--
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/20200122171550.77f78b2f%40gmail.com.
pgpfvr4F438ac.pgp
Description: OpenPGP digital signature
