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 %} diff --git a/salt/files/master.d/f_defaults.conf b/salt/files/master.d/f_defaults.conf index 54cb732..38a202d 100644 --- a/salt/files/master.d/f_defaults.conf +++ b/salt/files/master.d/f_defaults.conf @@ -282,11 +282,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: diff --git a/salt/files/minion.d/f_defaults.conf b/salt/files/minion.d/f_defaults.conf index b3cb6b3..b87fe73 100644 --- a/salt/files/minion.d/f_defaults.conf +++ b/salt/files/minion.d/f_defaults.conf @@ -32,6 +32,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') }} @@ -150,7 +156,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 }} @@ -159,7 +165,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 }}