matrixtest-IaC-ansible/kubenodes.yaml

46 lines
1.5 KiB
YAML

---
- name: Create os volume for kubernetes nodes
openstack.cloud.volume:
state: present
size: 30
image: debian-12
is_bootable: true
state: present
name: kube{{ item }}-matrix-test-sunet-se-osvol
loop: "{{ range(1,4)|list }}"
- name: Create snap volume for kubernetes nodes
openstack.cloud.volume:
state: present
size: 20
image: debian-12
is_bootable: true
state: present
name: kube{{ item }}-matrix-test-sunet-se-snapvol
loop: "{{ range(1,4)|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 secgroupallegress=secgroups.security_groups|selectattr('name', 'equalto', 'allegress')| first -%}
{% set secgroupkubenode=secgroups.security_groups|selectattr('name', 'equalto', 'kubenode')| first -%}
{% set secgroupssh=secgroups.security_groups|selectattr('name', 'equalto', 'ssh-from-jumphost')| first -%}
{{ secgroupallegress['id'] }},{{secgroupkubenode['id']}},{{secgroupssh['id'] -}}
loop: "{{ range(1,4)|list }}"
- name: Launch kubernetes instances
openstack.cloud.server:
name: "kube{{ item }}.matrix-test.sunet.se"
state: present
flavor: b2.c4r16
boot_volume: kube{{ item }}-matrix-test-sunet-se-osvol
nics:
- port-name: "kube{{ item }}-matrix-test-sunet-se-port"
loop: "{{ range(1,4)|list }}"