Futureproof securitygroup logic.
This commit is contained in:
parent
d5cad0d824
commit
01c8936db7
|
@ -1 +1,5 @@
|
|||
numnodes: 3
|
||||
kubesecgroups:
|
||||
- allegress
|
||||
- kubenode
|
||||
- ssh-from-jumphost
|
||||
|
|
|
@ -25,10 +25,12 @@
|
|||
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'] -}}
|
||||
{%- 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
|
||||
|
@ -42,6 +44,7 @@
|
|||
- "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 }}"
|
||||
|
|
Loading…
Reference in a new issue