--- - name: 1. Preparación Común hosts: all become: yes roles: - common - name: 2. Despliegue Core hosts: core_group become: yes roles: - core - name: 3. Despliegue Gateway hosts: gateway_group become: yes roles: - gateway tasks: - name: "INTEGRACIÓN: Añadir IP del Core al /etc/hosts del Gateway" lineinfile: path: /etc/hosts line: "{{ hostvars[groups['core_group'][0]]['ansible_host'] }} alicante-core" state: present