Home > Back-end >  How can I see the output of my script launch with ansible
How can I see the output of my script launch with ansible

Time:09-30

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

CodePudding user response:

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
  • Related