2024-01-15 09:21:45 +00:00
|
|
|
---
|
2024-01-15 14:59:25 +00:00
|
|
|
- name: Create os volume for kubernetes nodes
|
2024-01-15 09:21:45 +00:00
|
|
|
openstack.cloud.volume:
|
|
|
|
state: present
|
|
|
|
size: 30
|
|
|
|
image: debian-12
|
|
|
|
is_bootable: true
|
2024-01-15 14:59:25 +00:00
|
|
|
name: kube{{ item }}-matrix-test-sunet-se-osvol
|
2024-01-15 21:42:19 +00:00
|
|
|
loop: "{{ range(1, numnodes + 1 )|list }}"
|
2024-01-15 14:59:25 +00:00
|
|
|
|
|
|
|
- name: Create snap volume for kubernetes nodes
|
|
|
|
openstack.cloud.volume:
|
|
|
|
state: present
|
|
|
|
size: 20
|
2024-01-15 19:28:12 +00:00
|
|
|
is_bootable: false
|
2024-01-15 14:59:25 +00:00
|
|
|
name: kube{{ item }}-matrix-test-sunet-se-snapvol
|
2024-01-15 21:42:19 +00:00
|
|
|
loop: "{{ range(1, numnodes + 1 )|list }}"
|
2024-01-15 14:17:06 +00:00
|
|
|
|
|
|
|
- name: OS secgroups
|
|
|
|
openstack.cloud.security_group_info:
|
|
|
|
register: secgroups
|
|
|
|
|
|
|
|
- openstack.cloud.port:
|
|
|
|
state: present
|
|
|
|
name: kube{{ item }}-matrix-test-sunet-se-port
|
|
|
|
network: public
|
2024-01-15 14:45:19 +00:00
|
|
|
security_groups: |-
|
2024-01-16 06:40:38 +00:00
|
|
|
{%- set secgrlist = [] -%}
|
|
|
|
{%- for sg in kubesecgroups -%}
|
|
|
|
{% set sgdict=secgroups.security_groups|selectattr('name', 'equalto', sg )| first -%}
|
|
|
|
{{- secgrlist.append(sgdict['id']) -}}
|
|
|
|
{%- endfor -%}
|
|
|
|
{{ secgrlist | join(',') }}
|
2024-01-15 21:42:19 +00:00
|
|
|
loop: "{{ range(1, numnodes + 1 )|list }}"
|
2024-01-15 15:22:37 +00:00
|
|
|
|
|
|
|
- name: Launch kubernetes instances
|
|
|
|
openstack.cloud.server:
|
|
|
|
name: "kube{{ item }}.matrix-test.sunet.se"
|
|
|
|
state: present
|
|
|
|
flavor: b2.c4r16
|
2024-01-15 15:58:00 +00:00
|
|
|
key_name: manderssonpub
|
2024-01-15 15:46:32 +00:00
|
|
|
boot_volume: kube{{ item }}-matrix-test-sunet-se-osvol
|
2024-01-15 19:40:17 +00:00
|
|
|
volumes:
|
|
|
|
- "kube{{ item }}-matrix-test-sunet-se-snapvol"
|
2024-01-15 15:52:42 +00:00
|
|
|
nics:
|
|
|
|
- port-name: "kube{{ item }}-matrix-test-sunet-se-port"
|
2024-01-16 06:40:38 +00:00
|
|
|
security_groups: "{{ kubesecgroups | join(',') }}"
|
2024-01-15 19:28:12 +00:00
|
|
|
userdata: |
|
|
|
|
{{ lookup('ansible.builtin.template', 'kubenodes-user.yaml.j2') | indent(4, False ) }}
|
2024-01-15 21:42:19 +00:00
|
|
|
loop: "{{ range(1, numnodes + 1 )|list }}"
|