Set hosts value with an extra-vars doesn't work for my Ansible role

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 :slight_smile:

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

[VM]
toto