- name: execute uname on the inventory hosts as demo hosts: nextcloud tasks: - name: create file to write in become: false command: touch output.txt - name: get system informations become: true shell: apt update register: os_info - debug: msg: "{{os_info.stdout_lines}}" #when: inventory_hostname in groups['proxy']