๐
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<powershell> | |
$admin = [adsi]("WinNT://./administrator, user") | |
$admin.PSBase.Invoke("SetPassword", "{{ win_initial_password }}") | |
Invoke-Expression ((New-Object System.Net.Webclient).DownloadString('https://raw.githubusercontent.com/ansible/ansible/devel/examples/scripts/ConfigureRemotingForAnsible.ps1')) | |
</powershell> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
vars_files: | |
- secret.yml | |
gather_facts: no | |
tasks: | |
- name: create ec2 windows server security group | |
ec2_group: | |
name: "{{ aws.windows_security_group }}" | |
description: Windows server |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
localhost ansible_connection=local ansible_python_interpreter=python | |
[win] | |
[win:vars] | |
ansible_connection=winrm | |
ansible_ssh_port=5986 | |
ansible_ssh_user=Administrator | |
ansible_ssh_pass={{ win_initial_password }} | |
ansible_winrm_server_cert_validation=ignore |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: install aws tools | |
win_package: | |
path: http://sdk-for-net.amazonwebservices.com/latest/AWSToolsAndSDKForNet.msi | |
arguments: '/quiet /qn /le Z:\aws-tools-installlog.txt' | |
product_id: '{186A6440-3AD4-4E0E-ACC2-C098CA589290}' | |
state: present | |
creates_path: 'C:\Program Files\Amazon\Ec2ConfigService' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-AWSCredential -AccessKey {{lookup('env', 'AWS_ACCESS_KEY_ID')}} -SecretKey {{lookup('env', 'AWS_SECRET_ACCESS_KEY')}} -StoreAs default | |
Set-DefaultAWSRegion -Region {{aws.region}} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: copy aws config | |
win_template: | |
src: aws_config.ps1.j2 | |
dest: 'Z:\aws_config.ps1' | |
- name: config aws sdk tools | |
win_shell: Z:\aws_config.ps1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: download artifact | |
win_command: "PowerShell.exe -Command Read-S3Object -Region {{aws.region}} -BucketName <bucket_name> -Key <key> -File {{ target_path }} " |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: install pscx | |
win_chocolatey: | |
name: pscx | |
state: present |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: find exe path | |
win_find: | |
paths: "{{ extracted_path }}" | |
patterns: "*.exe" | |
register: exe_find |