Merge of RedHatGov/product-demos (#56)
Co-authored-by: MKletz <michael.kletz.27@gmail.com> Co-authored-by: Ajay Chenampara <ajay.chenampara@gmail.com> Co-authored-by: dlemons-redhat <69318976+dlemons-redhat@users.noreply.github.com> Co-authored-by: Nicolas Leiva <nicolasleiva@gmail.com> Co-authored-by: benblasco <42140583+benblasco@users.noreply.github.com> Co-authored-by: Benjamin Blasco <bblasco@redhat.com> Co-authored-by: calvingsmith <4283930+calvingsmith@users.noreply.github.com> Co-authored-by: Calvin Smith <calvingsmith@users.noreply.github.com> Co-authored-by: Hicham Mourad <43329991+HichamMourad@users.noreply.github.com>
This commit is contained in:
@@ -1,20 +1,22 @@
|
||||
---
|
||||
- name: PowerShell Script
|
||||
hosts: "{{ HOSTS | default('windows') }}"
|
||||
hosts: "{{ _hosts | default('os_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
|
||||
remote_dest: "C:\\query_services.ps1"
|
||||
|
||||
- debug:
|
||||
var: ps_output
|
||||
tasks:
|
||||
- name: Copy script to remote
|
||||
ansible.windows.win_copy:
|
||||
src: "{{ playbook_dir }}/query_services.ps1"
|
||||
dest: "{{ remote_dest }}"
|
||||
|
||||
- name: Run Script
|
||||
ansible.windows.win_powershell:
|
||||
script: |
|
||||
{{ remote_dest }} -ServiceState {{ service_state }}
|
||||
register: ps_output
|
||||
|
||||
- name: Print output
|
||||
ansible.builtin.debug:
|
||||
var: ps_output
|
||||
|
||||
Reference in New Issue
Block a user