diff options
author | Jonas Gunz <himself@jonasgunz.de> | 2024-02-15 23:01:26 +0100 |
---|---|---|
committer | Jonas Gunz <himself@jonasgunz.de> | 2024-02-15 23:01:26 +0100 |
commit | b4e8b5f82e942dc5861198d26d19edc3d273b7c2 (patch) | |
tree | 796a59a460fd436426784b272965f7f56800a1f0 /roles/netbox/templates | |
parent | 98f866aa2ba09a74e7a06b827f35e2c0275bda97 (diff) | |
download | ansible_collection-b4e8b5f82e942dc5861198d26d19edc3d273b7c2.tar.gz |
netbox
Diffstat (limited to 'roles/netbox/templates')
-rw-r--r-- | roles/netbox/templates/configuration.py.j2 | 18 | ||||
-rw-r--r-- | roles/netbox/templates/gunicorn.py.j2 | 18 |
2 files changed, 36 insertions, 0 deletions
diff --git a/roles/netbox/templates/configuration.py.j2 b/roles/netbox/templates/configuration.py.j2 new file mode 100644 index 0000000..0d58cd0 --- /dev/null +++ b/roles/netbox/templates/configuration.py.j2 @@ -0,0 +1,18 @@ +# vi: ft=python +# This file is created by Ansible. DO NOT CHANGE! + +{% macro procval(val) -%} +{% if val is string -%}"{{ val }}" +{%- elif val is sameas true or val is sameas false -%}{{ val | string }} +{%- elif val is mapping %}{ +{% for k, v in val.items() %}{{ prockv_map(k,v) }}, +{% endfor %} } +{% elif val is iterable %}[ {%+ for v in val %}{{ procval(v) }}{{ ", " if not loop.last else "" }} {% endfor %} ] +{%- else -%}{{ val }}{%- endif %} +{%- endmacro %} +{% macro prockv(key, val) %}{{ key }} = {{ procval(val) }}{%- endmacro %} +{% macro prockv_map(key, val) %}"{{ key }}" : {{ procval(val) }}{%- endmacro %} + +{% for key in netbox_config %} +{{ prockv(key, netbox_config[key]) }} +{% endfor %} diff --git a/roles/netbox/templates/gunicorn.py.j2 b/roles/netbox/templates/gunicorn.py.j2 new file mode 100644 index 0000000..4c86905 --- /dev/null +++ b/roles/netbox/templates/gunicorn.py.j2 @@ -0,0 +1,18 @@ +# vi: ft=python +# This file is created by Ansible. DO NOT CHANGE! + +{% macro procval(val) -%} +{% if val is string -%}"{{ val }}" +{%- elif val is sameas true or val is sameas false -%}{{ val | string }} +{%- elif val is mapping %}{ +{% for k, v in val.items() %}{{ prockv_map(k,v) }}, +{% endfor %} } +{% elif val is iterable %}[ {%+ for v in val %}{{ procval(v) }}{{ ", " if not loop.last else "" }} {% endfor %} ] +{%- else -%}{{ val }}{%- endif %} +{%- endmacro %} +{% macro prockv(key, val) %}{{ key }} = {{ procval(val) }}{%- endmacro %} +{% macro prockv_map(key, val) %}"{{ key }}" : {{ procval(val) }}{%- endmacro %} + +{% for key in gunicorn_config %} +{{ prockv(key, gunicorn_config[key]) }} +{% endfor %} |