I've got a problem with my ansible playbook :

*My playbook is composed of 5 roles and looks like this :*

---
- name: Création de la machine virtuelle {{ Host_Name }} à l'aide du template 
{{ vcenter_template }}
  hosts: localhost
  gather_facts: no
  roles:
  - roles/VMWare/deploy
  tags: deploy

- name: Configuration de l'échange de clé de root@lrtstfpe vers root@{{ 
Host_Name }}
  hosts: localhost
  gather_facts: no
  roles:
  - roles/VMWare/pre_config
  tags: pre_config

- name: Opérations post install
  hosts: '{{ Host_Name }}'
  gather_facts: no
  roles:
  - roles/VMWare/post_install
  tags: post_install

- name: Ajout du pointeur DNS sur le controleur de domaine wpsrvctldom1.uem.lan
  hosts: DNS
  gather_facts: no
  roles:
  - roles/DNS/
  tags: DNS

- name: Ajout du mot de passe Keepass de l'utilisateur root de la machine
  hosts: DNS
  gather_facts: no
  roles:
  - roles/Keepass/
  tags: keepass

*I launch this playbook with this command :*

ansible-playbook playbook/deployVM.yml --extra-vars "Host_Name=toto"

My variable is correctly interpreted in my tasks name but my third role 
which use the value of this variable to do operations on the appropriate 
host is skipped and Ansible says "skipping: no hosts matched".

But when I re-launch my playbook with "--tags post_install" to play only 
this role... *It works !*

I don't know why when I launch the entire playbook it doesn't work and when 
I launch just the 3rd role.. It works..

Can someone help me ?

Thx :)

PS : I add my {{ Host_Name }} machine into /etc/ansible/hosts file thanks 
to the 2nd role :

[VM]
toto

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/b5b1bfe1-6d83-4a70-a522-32b3b6d93ef4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to