From 153649092af586989b4798f8d41f1fe7a346f102 Mon Sep 17 00:00:00 2001 From: KenF Date: Fri, 13 Jun 2025 21:21:41 +0800 Subject: [PATCH] UPD: Created another version which runs on powershell 5 --- README.md | 5 +---- playbooks/powershell.yml | 25 ++++++++++++++++++++++ playbooks/{testrun.yml => powershell7.yml} | 0 3 files changed, 26 insertions(+), 4 deletions(-) create mode 100644 playbooks/powershell.yml rename playbooks/{testrun.yml => powershell7.yml} (100%) diff --git a/README.md b/README.md index 0d34931..0077632 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,9 @@ # Ansible collection for Windows -# Requirements -testrun.yml requires powershell 7 - # Install plugins Install amazon.aws plugin: ansible-galaxy collection install amazon.aws Install ssm plygin: ansible-galaxy collection install community.aws Install win_shell plugin: ansible-galaxy collection install ansible.windows # Example -ansible-playbook playbooks/testrun.yml +ansible-playbook playbooks/powershell7.yml diff --git a/playbooks/powershell.yml b/playbooks/powershell.yml new file mode 100644 index 0000000..08ba4cc --- /dev/null +++ b/playbooks/powershell.yml @@ -0,0 +1,25 @@ +--- +- name: First windows playbook + hosts: all + gather_facts: no + collections: + - ansible.windows + + tasks: + - name: Get powershell version + ansible.windows.win_powershell: + script: | + $PSVersionTable.PSVersion.ToString() + executable: powershell.exe + register: win_out + vars: + ansible_connection: amazon.aws.aws_ssm + ansible_aws_ssm_bucket_name: rosm-ansible-040216112220 + ansible_aws_ssm_region: ap-east-1 + ansible_aws_ssm_retries: 2 + ansible_aws_ssm_timeout: 20 + ansible_shell_type: powershell + + - name: Show output + debug: + msg: "{{ win_out.output[0] }}" diff --git a/playbooks/testrun.yml b/playbooks/powershell7.yml similarity index 100% rename from playbooks/testrun.yml rename to playbooks/powershell7.yml