-
Notifications
You must be signed in to change notification settings - Fork 5
/
eks_nodes.yml
30 lines (28 loc) · 1.18 KB
/
eks_nodes.yml
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
# Ignore errors as command is not idempotent
- name: Configure Worker Nodes
ansible.builtin.command: >
aws eks create-nodegroup
--cluster-name {{ cluster_name }}
--nodegroup-name {{ resource_prefix }}-nodegroup
--disk-size {{ node_disk_size }}
--subnets {{ create_subnet_1.subnet.id }} {{ create_subnet_2.subnet.id }}
--scaling-config minSize={{ min_node_count }},maxSize={{ max_node_count }},desiredSize={{ node_count }}
--instance-types {{ ec2_instance_type }}
--ami-type {{ aws_ami_type }}
--node-role {{ worker_role.arn }}
--tags Environment={{ ec2_environment }}
ignore_errors: yes
when: not delete
environment:
AWS_CONFIG_FILE: "{{ playbook_dir }}/.{{ cloud_provider }}/config"
AWS_SHARED_CREDENTIALS_FILE: "{{ playbook_dir }}/.{{ cloud_provider }}/credentials"
- name: Delete Worker Nodes
ansible.builtin.command: >
aws eks delete-nodegroup
--cluster-name {{ cluster_name }}
--nodegroup-name {{ resource_prefix }}-nodegroup
ignore_errors: yes
when: delete
environment:
AWS_CONFIG_FILE: "{{ playbook_dir }}/.{{ cloud_provider }}/config"
AWS_SHARED_CREDENTIALS_FILE: "{{ playbook_dir }}/.{{ cloud_provider }}/credentials"