Skip to content

Commit

Permalink
Windows multi region
Browse files Browse the repository at this point in the history
  • Loading branch information
UNiXMIT committed Mar 7, 2024
1 parent ab83dde commit ef8f381
Show file tree
Hide file tree
Showing 14 changed files with 71 additions and 35 deletions.
1 change: 1 addition & 0 deletions db/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,7 @@
msg:
- "Instance Name - {{ semaphore_vars.task_details.username|upper }}-{{ imageName }} {{ hostvars[item.public_ip_address].DBSHORT }}"
- 'AWS ID - {{ item.instance_id }}'
- 'AWS Region - {{ awsRegion }}'
- 'Public IP - {{ item.public_ip_address }}'
- 'Public DNS - {{ item.public_dns_name }}'
- 'Private IP - {{ item.private_ip_address }}'
Expand Down
16 changes: 8 additions & 8 deletions win/ed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
bucket: mturner
mode: geturl
object: '{{ S3Prefix }}{{ installerNameEDVS }}'
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3edvs
Expand All @@ -18,7 +18,7 @@
bucket: mturner
mode: geturl
object: '{{ S3Prefix }}{{ installerNameEDE }}'
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3ede
Expand All @@ -30,7 +30,7 @@
bucket: mturner
mode: geturl
object: ED/Licenses/lservrc.net
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3sn
Expand All @@ -42,7 +42,7 @@
bucket: mturner
mode: geturl
object: ED/Licenses/LicFile.txt
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3ap
Expand Down Expand Up @@ -77,7 +77,7 @@
bucket: mturner
mode: geturl
object: '{{ S3PrefixPU }}{{ installerNameEDVSPU }}'
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3edvspu
Expand All @@ -89,7 +89,7 @@
bucket: mturner
mode: geturl
object: '{{ S3PrefixPU }}{{ installerNameEDEPU }}'
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3edepu
Expand All @@ -109,7 +109,7 @@
- name: Add ED Tags
amazon.aws.ec2_tag:
aws_profile: '{{ awsProfile }}'
region: '{{ awsRegion }}'
region: "{{ hostvars['localhost']['awsRegion'] }}"
resource: '{{ item }}'
tags:
Name: '{{ semaphore_vars.task_details.username|upper }}-{{ imageName }} {{ productName }}'
Expand All @@ -123,7 +123,7 @@
- name: Add ED PU Tags
amazon.aws.ec2_tag:
aws_profile: '{{ awsProfile }}'
region: '{{ awsRegion }}'
region: "{{ hostvars['localhost']['awsRegion'] }}"
resource: '{{ item }}'
tags:
EDVSPU: '{{ installerNameEDVSPU }}'
Expand Down
2 changes: 1 addition & 1 deletion win/ed50.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
bucket: mturner
mode: geturl
object: '{{ S3Prefix }}Microsoft.VisualStudio.Setup.Configuration.Native.dll'
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3
Expand Down
2 changes: 1 addition & 1 deletion win/ed60.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
bucket: mturner
mode: geturl
object: '{{ S3Prefix }}Microsoft.VisualStudio.Setup.Configuration.Native.dll'
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3
Expand Down
2 changes: 1 addition & 1 deletion win/ed70.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
bucket: mturner
mode: geturl
object: ED/70/Microsoft.VisualStudio.Setup.Configuration.Native.dll
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3
Expand Down
12 changes: 6 additions & 6 deletions win/es.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
bucket: mturner
mode: geturl
object: '{{ S3Prefix }}{{ installerNameES }}'
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3es
Expand All @@ -18,7 +18,7 @@
bucket: mturner
mode: geturl
object: ED/Licenses/lservrc.net
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3sn
Expand All @@ -30,7 +30,7 @@
bucket: mturner
mode: geturl
object: ED/Licenses/LicFile.txt
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3ap
Expand Down Expand Up @@ -60,7 +60,7 @@
bucket: mturner
mode: geturl
object: '{{ S3PrefixPU }}{{ installerNameESPU }}'
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3espu
Expand All @@ -75,7 +75,7 @@
- name: Add ES Tags
amazon.aws.ec2_tag:
aws_profile: '{{ awsProfile }}'
region: '{{ awsRegion }}'
region: "{{ hostvars['localhost']['awsRegion'] }}"
resource: '{{ item }}'
tags:
Name: '{{ semaphore_vars.task_details.username|upper }}-{{ imageName }} {{ productName }}'
Expand All @@ -88,7 +88,7 @@
- name: Add ES PU Tags
amazon.aws.ec2_tag:
aws_profile: '{{ awsProfile }}'
region: '{{ awsRegion }}'
region: "{{ hostvars['localhost']['awsRegion'] }}"
resource: '{{ item }}'
tags:
ESPU: '{{ installerNameESPU }}'
Expand Down
4 changes: 2 additions & 2 deletions win/extend.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
bucket: mturner
mode: geturl
object: '{{ S3Prefix }}{{ installerName }}'
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3
Expand All @@ -18,7 +18,7 @@
- name: Add extend Tags
amazon.aws.ec2_tag:
aws_profile: '{{ awsProfile }}'
region: '{{ awsRegion }}'
region: "{{ hostvars['localhost']['awsRegion'] }}"
resource: '{{ item }}'
tags:
Name: '{{ semaphore_vars.task_details.username|upper }}-{{ imageName }} {{ productName }}'
Expand Down
30 changes: 30 additions & 0 deletions win/initial.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
- name: EMEA Region
set_fact:
awsRegion: eu-west-2
availabilityZone: us-west-2a
awsAMI: ami-0be53fc5198dbd294
securityGroups: '{{ securityGroupsEMEA }}'
when: userRegion | default("1") == "1"

- name: AMS Region
set_fact:
awsRegion: us-east-2
availabilityZone: us-east-2a
awsAMI: ami-0e6aa5f69f06ffa91
securityGroups: '{{ securityGroupsAMS }}'
when: userRegion | default("1") == "2"

- name: APJ Region
set_fact:
awsRegion: ap-southeast-2
availabilityZone: ap-southeast-2a
awsAMI: ami-02ed1a17d1bd5f706
securityGroups: '{{ securityGroupsAPJ }}'
when: userRegion | default("1") == "3"

- name: Set AWS Facts
set_fact:
instanceType: t3.xlarge
deviceName: /dev/sda1
volumeType: gp3
volumeSize: 120
9 changes: 9 additions & 0 deletions win/main.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
- name: AWS Initial Configuration
hosts: local
gather_facts: no
tasks:
- name: Import initial.yml
import_tasks: initial.yml
tags: default

- name: SSO 2FA
hosts: local
gather_facts: no
Expand Down Expand Up @@ -314,6 +322,7 @@
msg:
- "Instance Name - {{ semaphore_vars.task_details.username|upper }}-{{ imageName }} {{ hostvars[item.public_ip_address].productName }}"
- 'AWS ID - {{ item.instance_id }}'
- 'AWS Region - {{ awsRegion }}'
- 'Public IP - {{ item.public_ip_address }}'
- 'Public DNS - {{ item.public_dns_name }}'
- 'Private IP - {{ item.private_ip_address }}'
Expand Down
4 changes: 2 additions & 2 deletions win/software.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
bucket: mturner
mode: geturl
object: DB2/v11.5.9_nt32_odbc_cli.zip
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s332
Expand All @@ -130,7 +130,7 @@
bucket: mturner
mode: geturl
object: DB2/v11.5.9_ntx64_odbc_cli.zip
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s364
Expand Down
1 change: 1 addition & 0 deletions win/system.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- name: Set timezone to 'GMT Standard Time' (GMT)
community.windows.win_timezone:
timezone: GMT Standard Time
when: userRegion | default("1") == "1"

- name: Disable Windows Firewall
win_firewall:
Expand Down
15 changes: 5 additions & 10 deletions win/variables.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,16 @@
"myPassword": "strongPassword",
"ansibleUser": "administrator",
"imageName": "WINS2022",
"awsAMI": "ami-0d8e82a3d7fda95e0",
"keyName": "support",
"keyLocation": "~/.ssh/support.pem",
"securityGroups": "['sg-XXXXXX','sg-XXXXXX']",
"awsRegion": "eu-west-2",
"availabilityZone": "eu-west-2a",
"instanceType": "t3.xlarge",
"deviceName": "/dev/sda1",
"volumeType": "gp3",
"volumeSize": 120,
"securityGroupsEMEA": "['sg-XXXXXX','sg-XXXXXX']",
"securityGroupsAMS": "['sg-XXXXXX','sg-XXXXXX']",
"securityGroupsAPJ": "['sg-XXXXXX','sg-XXXXXX']",
"awsProfile": "848105473048_Fed_COBOL2_Compute",
"vmCount": 1,
"webAPI": "https://WebAPI.com/",
"ssoEmail": "[email protected]",
"ssoPassword": "strongPassword",
"ssoMethod": "1",
"ssoToken": "XXXXXX",
"webAPI": "https://WebAPI.com/"
"vmCount": 1
}
4 changes: 2 additions & 2 deletions win/vpn.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
bucket: mturner
mode: geturl
object: PulseVPN/ps-pulse-win-9.1r15.0-b15819-64bitinstaller.msi
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3
Expand All @@ -21,7 +21,7 @@
bucket: mturner
mode: geturl
object: PulseVPN/MFIPulseVPN.pulsepreconfig
region: '{{ awsRegion }}'
region: eu-west-2
expiry: 4000
sig_v4: true
register: s3
Expand Down
4 changes: 2 additions & 2 deletions win/vs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
- name: Add VS 2019 Tags
amazon.aws.ec2_tag:
aws_profile: '{{ awsProfile }}'
region: '{{ awsRegion }}'
region: "{{ hostvars['localhost']['awsRegion'] }}"
resource: '{{ item }}'
tags:
VS: 'Visual Studio Professional 2019'
Expand All @@ -25,7 +25,7 @@
- name: Add VS 2022 Tags
amazon.aws.ec2_tag:
aws_profile: '{{ awsProfile }}'
region: '{{ awsRegion }}'
region: "{{ hostvars['localhost']['awsRegion'] }}"
resource: '{{ item }}'
tags:
VS: 'Visual Studio Professional 2022'
Expand Down

0 comments on commit ef8f381

Please sign in to comment.