From dcab81866e4e22494c5d82f5d5964df97913f84c Mon Sep 17 00:00:00 2001 From: Fastmarkets Infrastructure Date: Thu, 2 Jul 2015 17:22:14 +0100 Subject: [PATCH 1/5] ACL code in master config doesn't allow for nesting commands under minion names --- salt/files/master.d/f_defaults.conf | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/salt/files/master.d/f_defaults.conf b/salt/files/master.d/f_defaults.conf index e15689c..714a06c 100644 --- a/salt/files/master.d/f_defaults.conf +++ b/salt/files/master.d/f_defaults.conf @@ -279,11 +279,9 @@ event_return_blacklist: # - network.* {% if 'client_acl' in cfg_master -%} client_acl: -{%- for name, user in cfg_master['client_acl']|dictsort %} +{%- for name, items in cfg_master['client_acl']|dictsort %} {{ name}}: -{%- for command in user %} - - {% raw %}'{% endraw %}{{ command }}{% raw %}'{% endraw %} -{%- endfor -%} + {{ items | yaml }} {%- endfor -%} {% elif 'client_acl' in cfg_salt -%} client_acl: From 09ca116f5859c9ba01b60e26d7731931b731a4f7 Mon Sep 17 00:00:00 2001 From: John Carlyle-Clarke Date: Thu, 9 Jul 2015 10:43:36 +0100 Subject: [PATCH 2/5] Add master_type and master_retry_interval to minion config --- salt/files/minion.d/f_defaults.conf | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/salt/files/minion.d/f_defaults.conf b/salt/files/minion.d/f_defaults.conf index 3e743c9..c81113f 100644 --- a/salt/files/minion.d/f_defaults.conf +++ b/salt/files/minion.d/f_defaults.conf @@ -43,6 +43,12 @@ master: # choose a random master {{ get_config('random_master', 'False') }} +# Set the master type +{{ get_config('master_type', 'str') }} + +# Set the master alive interval (if master type set to failover) +{{ get_config('master_alive_interval', '30') }} + # use IPv6 {{ get_config('ipv6', 'False') }} From f4a823a89689843dd0ada076279d6ac8298f22e1 Mon Sep 17 00:00:00 2001 From: John Carlyle-Clarke Date: Thu, 9 Jul 2015 10:45:01 +0100 Subject: [PATCH 3/5] Fix problem with code to include extra files in minion config --- salt/files/minion.d/f_defaults.conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/salt/files/minion.d/f_defaults.conf b/salt/files/minion.d/f_defaults.conf index c81113f..0cbd9b1 100644 --- a/salt/files/minion.d/f_defaults.conf +++ b/salt/files/minion.d/f_defaults.conf @@ -163,7 +163,7 @@ mine_functions: # include extra config {% if 'include' in cfg_minion -%} - {% if isinstance(cfg_minion['include'], list) -%} + {% if cfg_minion['include'] is iterable -%} include: {% for include in cfg_minion['include'] -%} - {{ include }} @@ -172,7 +172,7 @@ mine_functions: include: cfg_minion['include'] {% endif -%} {% elif 'include' in cfg_salt -%} - {% if isinstance(cfg_salt['include'], list) -%} + {% if cfg_salt['include'] is iterable -%} include: {% for include in cfg_salt['include'] -%} - {{ include }} From eb3643bfbba9596bfab91f530d137912505b9079 Mon Sep 17 00:00:00 2001 From: John Carlyle-Clarke Date: Thu, 9 Jul 2015 17:11:24 +0100 Subject: [PATCH 4/5] Add pillar_source_merging_strategy to master config --- salt/files/master.d/f_defaults.conf | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/salt/files/master.d/f_defaults.conf b/salt/files/master.d/f_defaults.conf index 714a06c..272b149 100644 --- a/salt/files/master.d/f_defaults.conf +++ b/salt/files/master.d/f_defaults.conf @@ -695,6 +695,14 @@ ext_pillar: # master config file that can then be used on minions. {{ get_config('pillar_opts', 'True') }} +# The pillar_source_merging_strategy option allows you to configure merging strategy +# between different sources. It accepts four values: recurse, aggregate, overwrite, +# or smart. Recurse will merge recursively mapping of data. Aggregate instructs +# aggregation of elements between sources that use the #!yamlex renderer. Overwrite +# will verwrite elements according the order in which they are processed. This is +# behavior of the 2014.1 branch and earlier. Smart guesses the best strategy based +# on the "renderer" setting and is the default value. +{{ get_config('pillar_source_merging_strategy', 'smart') }} ##### Syndic settings ##### ########################################## From 23eb122aa9f64fd52dbe18b5147b684c95040970 Mon Sep 17 00:00:00 2001 From: John Carlyle-Clarke Date: Thu, 9 Jul 2015 17:24:57 +0100 Subject: [PATCH 5/5] Add some sample proxmox files and sample pillar data to go with them --- pillar.example | 17 +++++++++++++++++ salt/files/cloud.profiles.d/proxmox.conf | 19 +++++++++++++++++++ salt/files/cloud.providers.d/proxmox.conf | 11 +++++++++++ 3 files changed, 47 insertions(+) create mode 100644 salt/files/cloud.profiles.d/proxmox.conf create mode 100644 salt/files/cloud.providers.d/proxmox.conf diff --git a/pillar.example b/pillar.example index 614cc7d..6296629 100644 --- a/pillar.example +++ b/pillar.example @@ -106,6 +106,23 @@ salt: - IAD - SYD - HKG + + # Configure the proxmox providers you want to use (one per cluster, normally) + proxmox_providers: + test: + user: root@pam + password: password + url: prox-test.mydomain + live: + user: root@pam + password: password + url: prox-live.mydomain + + # You'll need to hand-edit your profiles, but you can insert a default root password + # from here + proxmox_profile_defaults: + default_password: somesecretpassword + reactor: - 'deploy': - /srv/salt/reactors/deploy.sls diff --git a/salt/files/cloud.profiles.d/proxmox.conf b/salt/files/cloud.profiles.d/proxmox.conf new file mode 100644 index 0000000..60a5f8a --- /dev/null +++ b/salt/files/cloud.profiles.d/proxmox.conf @@ -0,0 +1,19 @@ +# This file managed by Salt, do not edit by hand!! +{% set cloud = salt['pillar.get']('salt:cloud', {}) -%} +{% if 'proxmox_profile_defaults' in cloud %} +{% set defaults = cloud.get('proxmox_profile_defaults') %} + +prox-test-1: + provider: proxmox-test + image: ISO:vztmpl/debian-7.0-standard_7.0-2_i386.tar.gz + technology: openvz + host: testvm01 + cpus: 2 + memory: 2048 + swap: 2048 + disk: 5 + password: {{ defaults.get('default_password', 'password') }} + ip_address: 192.168.1.100 + +{% endif %} + diff --git a/salt/files/cloud.providers.d/proxmox.conf b/salt/files/cloud.providers.d/proxmox.conf new file mode 100644 index 0000000..415753c --- /dev/null +++ b/salt/files/cloud.providers.d/proxmox.conf @@ -0,0 +1,11 @@ +# This file managed by Salt, do not edit by hand!! +{% set cloud = salt['pillar.get']('salt:cloud', {}) -%} +{% for name, config in cloud.get('proxmox_providers',dict()).items() %} +proxmox-{{ name }}: + minion: + master: {{ cloud.get('master', 'salt') }} + user: {{ config.get('user', '') }} + password: {{ config.get('password', '') }} + url: {{ config.get('url', '') }} + provider: proxmox +{% endfor %}