matrixtest-IaC-ansible/kubenodes.yaml

45 lines
1.5 KiB
YAML
Raw Normal View History

2024-01-15 09:21:45 +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
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
2024-01-15 09:21:45 +00:00
loop: "{{ range(1,4)|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: |-
{%- set secgroupallegress=secgroups.security_groups|selectattr('name', 'equalto', 'allegress')| first -%}
2024-01-15 14:17:06 +00:00
{% set secgroupkubenode=secgroups.security_groups|selectattr('name', 'equalto', 'kubenode')| first -%}
{% set secgroupssh=secgroups.security_groups|selectattr('name', 'equalto', 'ssh-from-jumphost')| first -%}
2024-01-15 14:45:19 +00:00
{{ secgroupallegress['id'] }},{{secgroupkubenode['id']}},{{secgroupssh['id'] -}}
2024-01-15 14:17:06 +00:00
loop: "{{ range(1,4)|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
boot_volume: kube{{ item }}-matrix-test-sunet-se-osvol
2024-01-15 15:22:37 +00:00
nics: "port-name=kube{{ item }}-matrix-test-sunet-se-port"
loop: "{{ range(1,4)|list }}"