- name: create data dir on K8s-worker-node2 become: yes file: path: /data state: directory when: "'K8s-worker-node2' in ansible_facts.hostname" - name: copy file on K8s-worker-node2 become: yes copy: src: index.html dest: /data/ mode: '0755' when: "'K8s-worker-node2' in ansible_facts.hostname"