Files
product-demos/windows/powershell_script.yml
MKletz 788cf7b675 Powershell templates (#5)
Windows Powershell Demos
2022-02-23 12:01:02 -05:00

21 lines
490 B
YAML

---
- name: PowerShell Script
hosts: "{{ HOSTS | default('windows') }}"
gather_facts: false
vars:
remote_dest: "C:\\sample_script.ps1"
tasks:
- name: Copy script to remote
ansible.windows.win_copy:
src: "{{playbook_dir}}/sample_script.ps1"
dest: "{{ remote_dest }}"
- name: Run Script
ansible.windows.win_powershell:
script: |
{{ remote_dest }} -ServiceState {{ service_state }}
register: ps_output
- debug:
var: ps_output