Hi,
Bit of a confusing one, and perhaps I'm barking up the wrong tree (which is
why I've turned here after some research) .
I'm trying to create a bunch of kubernetes namespaces using a template,
have got that working fine, but now I want to add in different default
limit and request values for each namesapce.
Initially, I just had a list along these lines :-
namespaces:
- si
- qa
- dev
- build
- core-qa
- core-si
But now, I've tried to be clever and add some defaults below the build
namespace :-
namespaces:
- si
- qa
- dev
- build:
spec:
limits:
- default:
cpu: 100m
memory: 256Mi
defaultRequest:
cpu: 50m
memory: 128Mi
- core-qa
- core-si
these get used later on in my playbook (not able to test that bit yet)
Here's where I simply create a tmp file for use later on...
- name: Env Namespaces | create template in /tmp
tags: namespaces
template:
src: namespace.j2
dest: /tmp/{{ item }}.yaml
loop: "{{ namespaces }}"
However this breaks badly, as it tries to use the whole data structure for
the filename, including the default cpu, memory, request, etc.
I want something like this...
- name: Env Namespaces | create template in /tmp
tags: namespaces
template:
src: namespace.j2
dest: /tmp/{{ item[top_level_only_here] }}.yaml
loop: "{{ namespaces }}"
Is Ansible able to handle this for me??
Once I've got that working, I'll need to get it to only set the limits for
certain namespaces and leave others without any limits. Scratching my head
how to achieve that as well!?
Thanks,
Steve
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/573a9551-d22d-4306-9306-7e2860c142e4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.