NEW: Initial commit

testrun playbook which displays powershell version
This commit is contained in:
KenF
2025-06-13 20:28:56 +08:00
parent 6de650a591
commit a6977f3796
5 changed files with 55 additions and 1 deletions
+1
View File
@@ -0,0 +1 @@
*.key
+11 -1
View File
@@ -1,2 +1,12 @@
# ansible-lab
# 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
+4
View File
@@ -0,0 +1,4 @@
[defaults]
inventory = ./aws_ec2.yml
enable_plugins = aws_ec2
host_key_checking = False
+13
View File
@@ -0,0 +1,13 @@
plugin: amazon.aws.aws_ec2
regions:
- ap-east-1
filters:
instance-state-name: running
hostnames:
- name: 'instance-id'
#compose:
# ansible_host: instance_id
# ansible_connection: 'community.aws.aws_ssm'
+26
View File
@@ -0,0 +1,26 @@
---
- name: First windows playbook
hosts: all
gather_facts: no
collections:
- ansible.windows
tasks:
- name: Get powershell version, requires powershell 7
ansible.windows.win_powershell:
script: |
$PSVersionTable.PSVersion.ToString()
executable: pwsh.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
#ansible_shell_executable: pwsh.exe
- name: Show output
debug:
msg: "{{ win_out.output[0] }}"