-
Notifications
You must be signed in to change notification settings - Fork 0
/
add-windows-workers.yaml
41 lines (34 loc) · 1.58 KB
/
add-windows-workers.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
- name: find infrastructure id
command: oc get -o jsonpath='{.status.infrastructureName}{"\n"}' infrastructure cluster
register: getinfrastructureID
- name: set infrastructure ID in dynamic vars yaml file
copy:
content: "infrastructureID: {{ getinfrastructureID.stdout }}"
dest: "vars/dynamic/main.yaml"
- name: set machineset name in dynamic vars yaml file
ansible.builtin.lineinfile:
line: "machinesetName: {{ getinfrastructureID.stdout }}-windows-worker-{{ zone }}"
path: "vars/dynamic/main.yaml"
- name: set private subnet name in dynamic vars yaml file
ansible.builtin.lineinfile:
line: "privateSubnetName: {{ getinfrastructureID.stdout }}-private-{{ zone }}"
path: "vars/dynamic/main.yaml"
- name: find ami for windows server image to use for windows worker nodes
shell: "aws ec2 describe-images --region '{{ region }}' --filters 'Name=name,Values=Windows_Server-2022*English*Full-Base*' 'Name=is-public,Values=true' --query 'reverse(sort_by(Images, &CreationDate))[*].{name: Name, id: ImageId}' --output json | jq .[0].id"
register: describeImagesResult
- name: set ami id in dynamic vars yaml file
ansible.builtin.lineinfile:
line: "ami: {{ describeImagesResult.stdout }}"
path: "vars/dynamic/main.yaml"
- name: reload dynamic var data
include_vars:
dir: ../vars/dynamic
ignore_unknown_extensions: True
extensions:
- yaml
- name: create machineset
kubernetes.core.k8s:
state: present
apply: true
validate_certs: false
resource_definition: "{{ lookup('template', './templates/machineset.yaml.j2') | from_yaml }}"