From ca42d40ef98cdf7016a45a2c97ab09e0a5118045 Mon Sep 17 00:00:00 2001 From: risca Date: Tue, 7 Jun 2016 19:46:08 +0200 Subject: [PATCH] added support for LXC profiles --- pillar.example | 17 +++++++++++ salt/files/master.d/lxc_profiles.conf | 42 +++++++++++++++++++++++++++ 2 files changed, 59 insertions(+) create mode 100644 salt/files/master.d/lxc_profiles.conf diff --git a/pillar.example b/pillar.example index 4b16756..832f939 100644 --- a/pillar.example +++ b/pillar.example @@ -37,6 +37,23 @@ salt: ssl_key: /etc/pki/api/certs/server.key debug: False disable_ssl: False + # for profile configuration as https://docs.saltstack.com/en/latest/topics/tutorials/lxc.html#tutorial-lxc-profiles + lxc.container_profile: + debian: + template: download + options: + dist: debian + release: jessie + arch: amd64 + backing: lvm + vgname: kimsufi + size: 10G + lxc.network_profile: + basic: + eth0: + link: lxcbr0 + type: veth + flags: up ## for external auth - LDAP # filter to use for Active Directory LDAP auth.ldap.filter: {% raw %}'sAMAccountName={{username}}'{% endraw %} diff --git a/salt/files/master.d/lxc_profiles.conf b/salt/files/master.d/lxc_profiles.conf new file mode 100644 index 0000000..2538848 --- /dev/null +++ b/salt/files/master.d/lxc_profiles.conf @@ -0,0 +1,42 @@ +# This file managed by Salt, do not edit by hand!! +# Based on salt version 2015.8.7 default config +{% set cfg_salt = pillar.get('salt', {}) -%} +{% set cfg_master = cfg_salt.get('master', {}) -%} +{% set cfg_prof = cfg_master.get('lxc.container_profile', {}) -%} +{% set cfg_net = cfg_master.get('lxc.network_profile', {}) -%} + +###### Profile configurations ######### +####################################### +{% if cfg_prof %} +lxc.container_profile: +{%- for prof in cfg_prof %} + {{ prof }}: +{%- for conf in cfg_prof[prof] %} +{%- if cfg_prof[prof][conf] is mapping %} + {{ conf }}: +{%- for opt in cfg_prof[prof][conf] %} + {{ opt }}: {{ cfg_prof[prof][conf][opt] }} +{%- endfor %} +{%- else %} + {{ conf }}: {{ cfg_prof[prof][conf] }} +{%- endif %} +{%- endfor %} +{% endfor %} +{%- endif %} + +{% if cfg_net %} +lxc.network_profile: +{%- for prof in cfg_net %} + {{ prof }}: +{%- for conf in cfg_net[prof] -%} +{%- if cfg_net[prof][conf] is mapping %} + {{ conf }}: +{%- for opt in cfg_net[prof][conf] %} + {{ opt }}: {{ cfg_net[prof][conf][opt] }} +{%- endfor %} +{%- else %} + {{ conf }}: {{ cfg_net[prof][conf] }} +{%- endif %} +{%- endfor %} +{% endfor %} +{%- endif %}