Onyx
Onyx

Reputation: 45

How can I see the output of my script launch with ansible

How can I display in my shell the variable $output of my script launch with my playbook ansible ?

Playbook.yaml :

- name: firsttest
  hosts: win
  tasks:
   - name: Ping my Windows vm
     ansible.windows.win_ping:

   - name: Run basic PowerShell script
     ansible.windows.win_powershell:
       script: |
         $output = "Hello World"
         echo $output

Upvotes: 1

Views: 1344

Answers (1)

Jack
Jack

Reputation: 6158

register the results, then debug.

- name: Run basic PowerShell script
  ansible.windows.win_powershell:
    script: |
      $output = "Hello World"
      echo $output
  register: PS_output

- name: Show PS_output
  debug:
    var: PS_output

Upvotes: 3

Related Questions