--- - name: Run a command gather_facts: False hosts: seed-hypervisor:seed:overcloud:infra-vms tasks: - name: Run a command shell: "{{ host_command_to_run }}" register: command_output - name: Print stdout debug: msg: "{{ command_output.stdout }}" when: show_output | bool - name: Print stderr debug: msg: "{{ command_output.stderr }}" when: show_output | bool