51 lines
1.6 KiB
YAML
51 lines
1.6 KiB
YAML
---
|
|
- name: Create os volume for kubernetes nodes
|
|
openstack.cloud.volume:
|
|
state: present
|
|
size: 30
|
|
image: debian-12
|
|
is_bootable: true
|
|
name: kube{{ item }}-matrix-test-sunet-se-osvol
|
|
loop: "{{ range(1, numnodes + 1 )|list }}"
|
|
|
|
- name: Create snap volume for kubernetes nodes
|
|
openstack.cloud.volume:
|
|
state: present
|
|
size: 20
|
|
is_bootable: false
|
|
name: kube{{ item }}-matrix-test-sunet-se-snapvol
|
|
loop: "{{ range(1, numnodes + 1 )|list }}"
|
|
|
|
- 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
|
|
security_groups: |-
|
|
{%- set secgrlist = [] -%}
|
|
{%- for sg in kubesecgroups -%}
|
|
{% set sgdict=secgroups.security_groups|selectattr('name', 'equalto', sg )| first -%}
|
|
{{- secgrlist.append(sgdict['id']) -}}
|
|
{%- endfor -%}
|
|
{{ secgrlist | join(',') }}
|
|
loop: "{{ range(1, numnodes + 1 )|list }}"
|
|
|
|
- name: Launch kubernetes instances
|
|
openstack.cloud.server:
|
|
name: "kube{{ item }}.matrix-test.sunet.se"
|
|
state: present
|
|
flavor: b2.c4r16
|
|
key_name: manderssonpub
|
|
boot_volume: kube{{ item }}-matrix-test-sunet-se-osvol
|
|
volumes:
|
|
- "kube{{ item }}-matrix-test-sunet-se-snapvol"
|
|
nics:
|
|
- port-name: "kube{{ item }}-matrix-test-sunet-se-port"
|
|
security_groups: "{{ kubesecgroups | join(',') }}"
|
|
userdata: |
|
|
{{ lookup('ansible.builtin.template', 'kubenodes-user.yaml.j2') | indent(4, False ) }}
|
|
loop: "{{ range(1, numnodes + 1 )|list }}"
|