- name: aktualisiere /etc/hosts
  blockinfile:
    path: /etc/hosts
    block: |
      {% for host in groups['master'] %}
      {{ hostvars[host].ansible_default_ipv4.address }} 
         {{ hostvars[host].ansible_hostname }}
      {% endfor %}
      {% for host in groups['worker'] %}
      {{ hostvars[host].ansible_default_ipv4.address }} 
         {{ hostvars[host].ansible_hostname }}
      {% endfor %}
