2015-05-26 16:41:04 +02:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# vim: ft=jinja
|
2015-03-17 05:39:32 +01:00
|
|
|
|
2016-09-05 10:48:31 +02:00
|
|
|
{%- macro deep_merge(a, b) %}
|
2018-01-06 13:21:02 +01:00
|
|
|
{#- This whole `'dict' in x.__class__.__name__` mess is a
|
|
|
|
workaround for the missing mapping test in CentOS 6's
|
2017-02-24 18:10:54 +01:00
|
|
|
ancient Jinja2, see #193 #}
|
2017-08-14 13:15:30 +02:00
|
|
|
{%- for k,v in b.items() %}
|
2016-09-05 10:48:31 +02:00
|
|
|
{%- if v is string or v is number %}
|
|
|
|
{%- do a.update({ k: v }) %}
|
2017-02-24 18:10:54 +01:00
|
|
|
{%- elif 'dict' not in v.__class__.__name__ %}
|
2016-09-05 10:48:31 +02:00
|
|
|
{%- if a[k] is not defined %}
|
|
|
|
{%- do a.update({ k: v }) %}
|
2018-01-06 13:21:02 +01:00
|
|
|
{%- elif a[k] is iterable and 'dict' not in a[k].__class__.__name__ and
|
2017-02-24 18:10:54 +01:00
|
|
|
a[k] is not string %}
|
2016-09-05 10:48:31 +02:00
|
|
|
{%- do a.update({ k: v|list + a[k]|list}) %}
|
|
|
|
{%- else %}
|
|
|
|
{%- do a.update({ k: v }) %}
|
|
|
|
{%- endif %}
|
2017-02-24 18:10:54 +01:00
|
|
|
{%- elif 'dict' in v.__class__.__name__ %}
|
2016-09-05 10:48:31 +02:00
|
|
|
{%- if a[k] is not defined %}
|
|
|
|
{%- do a.update({ k: v }) %}
|
2017-02-24 18:10:54 +01:00
|
|
|
{%- elif 'dict' in a[k].__class__.__name__ %}
|
2016-09-05 10:48:31 +02:00
|
|
|
{%- do a.update({ k: v }) %}
|
|
|
|
{%- else %}
|
|
|
|
{%- do deep_merge(a[k], v) %}
|
|
|
|
{%- endif %}
|
|
|
|
{%- else %}
|
|
|
|
{%- do a.update({ k: 'ERROR: case not contempled in merging!' }) %}
|
|
|
|
{%- endif %}
|
|
|
|
{%- endfor %}
|
|
|
|
{%- endmacro %}
|
|
|
|
|
|
|
|
|
2015-05-26 16:41:04 +02:00
|
|
|
{## Start with defaults from defaults.yaml ##}
|
|
|
|
{% import_yaml "salt/defaults.yaml" as default_settings %}
|
2015-03-17 05:39:32 +01:00
|
|
|
|
2015-12-05 11:24:05 +01:00
|
|
|
{##
|
2015-05-26 16:41:04 +02:00
|
|
|
Setup variable using grains['os_family'] based logic, only add key:values here
|
|
|
|
that differ from whats in defaults.yaml
|
|
|
|
##}
|
2016-06-20 21:30:45 +02:00
|
|
|
{% set osrelease = salt['grains.get']('osrelease') %}
|
2017-05-30 09:18:54 +02:00
|
|
|
{% set salt_release = salt['pillar.get']('salt:release', 'latest') %}
|
2015-05-26 16:41:04 +02:00
|
|
|
{% set os_family_map = salt['grains.filter_by']({
|
2015-08-20 06:46:49 +02:00
|
|
|
'Debian': {
|
2016-06-20 21:30:45 +02:00
|
|
|
'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
|
2017-07-18 22:18:44 +02:00
|
|
|
salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/amd64/' + salt_release + ' ' + salt['grains.get']('oscodename') + ' main',
|
|
|
|
'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/amd64/' + salt_release + '/SALTSTACK-GPG-KEY.pub',
|
2015-08-20 06:46:49 +02:00
|
|
|
'libgit2': 'libgit2-22',
|
2017-08-15 22:48:15 +02:00
|
|
|
'pyinotify': 'python-pyinotify',
|
2015-08-20 06:46:49 +02:00
|
|
|
'gitfs': {
|
|
|
|
'pygit2': {
|
|
|
|
'install_from_source': True,
|
|
|
|
'version': '0.22.1',
|
2015-09-01 23:28:27 +02:00
|
|
|
'git': {
|
|
|
|
'require_state': False,
|
|
|
|
'install_from_package': 'git',
|
|
|
|
},
|
2015-08-20 06:46:49 +02:00
|
|
|
'libgit2': {
|
|
|
|
'install_from_source': False,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2015-06-02 21:40:53 +02:00
|
|
|
'RedHat': {
|
2017-05-31 22:53:48 +02:00
|
|
|
'pkgrepo': 'https://repo.saltstack.com/yum/redhat/$releasever/$basearch/' + salt_release,
|
|
|
|
'key_url': 'https://repo.saltstack.com/yum/redhat/$releasever/$basearch/' + salt_release + '/SALTSTACK-GPG-KEY.pub',
|
2016-12-20 05:29:42 +01:00
|
|
|
'pygit2': salt['grains.filter_by']({
|
|
|
|
'Fedora': 'python2-pygit2',
|
|
|
|
'default': 'python-pygit2',
|
|
|
|
}, grain='os'),
|
2016-05-30 13:50:16 +02:00
|
|
|
'python_git': 'GitPython',
|
2015-06-02 21:40:53 +02:00
|
|
|
'gitfs': {
|
2018-04-01 13:52:29 +02:00
|
|
|
'gitpython': {
|
|
|
|
'install_from_source': False,
|
|
|
|
},
|
2015-06-02 21:40:53 +02:00
|
|
|
'pygit2': {
|
2015-09-01 23:28:27 +02:00
|
|
|
'install_from_source': False,
|
|
|
|
'git': {
|
|
|
|
'require_state': False,
|
|
|
|
'install_from_package': 'git',
|
|
|
|
},
|
2015-06-02 21:40:53 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
'master': {
|
|
|
|
'gitfs_provider': 'pygit2'
|
|
|
|
},
|
|
|
|
},
|
2017-11-20 23:34:09 +01:00
|
|
|
'Suse': {
|
|
|
|
'pygit2': 'python-pygit2',
|
|
|
|
'pyinotify': 'python-pyinotify',
|
|
|
|
'gitfs': {
|
|
|
|
'pygit2': {
|
|
|
|
'install_from_source': False,
|
2017-11-21 00:18:22 +01:00
|
|
|
'git': {
|
|
|
|
'require_state': False,
|
|
|
|
'install_from_package': 'git',
|
|
|
|
},
|
2017-11-20 23:34:09 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
'master': {
|
|
|
|
'gitfs_provider': 'pygit2'
|
|
|
|
},
|
|
|
|
},
|
2015-05-26 16:41:04 +02:00
|
|
|
'Gentoo': {
|
|
|
|
'salt_master': 'app-admin/salt',
|
|
|
|
'salt_minion': 'app-admin/salt',
|
|
|
|
'salt_syndic': 'app-admin/salt',
|
|
|
|
'salt_api': 'app-admin/salt',
|
2015-08-20 06:46:49 +02:00
|
|
|
'salt_cloud': 'app-admin/salt',
|
2017-09-11 14:32:47 +02:00
|
|
|
'pyinotify': 'dev-python/pyinotify',
|
2015-05-26 16:41:04 +02:00
|
|
|
},
|
|
|
|
'Arch': {
|
2016-11-10 14:05:48 +01:00
|
|
|
'salt_master': 'salt',
|
|
|
|
'salt_minion': 'salt',
|
|
|
|
'salt_syndic': 'salt',
|
|
|
|
'salt_cloud': 'salt',
|
|
|
|
'salt_api': 'salt',
|
|
|
|
'salt_ssh': 'salt',
|
2017-01-13 17:03:19 +01:00
|
|
|
'pygit2': 'python2-pygit2',
|
|
|
|
'libgit2': 'libgit2',
|
2017-08-16 09:20:00 +02:00
|
|
|
'pyinotify': 'python2-pyinotify',
|
2015-05-26 16:41:04 +02:00
|
|
|
},
|
2017-01-13 17:31:47 +01:00
|
|
|
'Alpine': {
|
|
|
|
'salt_master': 'salt-master',
|
|
|
|
'salt_minion': 'salt-minion',
|
|
|
|
'salt_syndic': 'salt-syndic',
|
|
|
|
'salt_cloud': 'salt-cloud',
|
|
|
|
'salt_api': 'salt-api',
|
|
|
|
'salt_ssh': 'salt-ssh',
|
|
|
|
'pygit2': 'py2-pygit2',
|
|
|
|
'libgit2': 'libgit2',
|
|
|
|
},
|
2015-05-26 16:41:04 +02:00
|
|
|
'FreeBSD': {
|
|
|
|
'salt_master': 'py27-salt',
|
|
|
|
'salt_minion': 'py27-salt',
|
|
|
|
'salt_syndic': 'py27-salt',
|
|
|
|
'salt_cloud': 'py27-salt',
|
|
|
|
'salt_api': 'py27-salt',
|
2015-07-24 22:11:23 +02:00
|
|
|
'salt_ssh': 'py27-salt',
|
2015-07-24 22:30:02 +02:00
|
|
|
'python_git': 'py27-GitPython',
|
2015-07-24 23:06:15 +02:00
|
|
|
'pygit2': 'py27-pygit2',
|
2015-05-26 16:41:04 +02:00
|
|
|
'config_path': '/usr/local/etc/salt',
|
|
|
|
'minion_service': 'salt_minion',
|
|
|
|
'master_service': 'salt_master',
|
|
|
|
'api_service': 'salt_api',
|
2015-08-20 06:46:49 +02:00
|
|
|
'syndic_service': 'salt_syndic',
|
2015-05-26 16:41:04 +02:00
|
|
|
},
|
2016-07-02 04:25:06 +02:00
|
|
|
'OpenBSD': {
|
|
|
|
'salt_master': 'salt',
|
|
|
|
'salt_minion': 'salt',
|
|
|
|
'salt_syndic': 'salt',
|
|
|
|
'salt_cloud': 'salt',
|
|
|
|
'salt_api': 'salt',
|
|
|
|
'salt_ssh': 'salt',
|
|
|
|
'config_path': '/etc/salt',
|
|
|
|
'minion_service': 'salt_minion',
|
|
|
|
'master_service': 'salt_master',
|
|
|
|
'python_git': 'py-GitPython',
|
|
|
|
},
|
2016-03-23 02:15:44 +01:00
|
|
|
'Windows': {
|
2018-01-06 13:21:02 +01:00
|
|
|
'salt_minion': 'salt-minion',
|
2016-03-23 02:15:44 +01:00
|
|
|
'config_path': 'C:\salt\conf',
|
|
|
|
'minion_service': 'salt-minion',
|
|
|
|
},
|
2018-01-06 13:54:57 +01:00
|
|
|
'MacOS': {
|
|
|
|
'salt_minion': 'com.saltstack.salt',
|
2018-04-17 22:26:20 +02:00
|
|
|
'salt_minion_pkg_source': '',
|
2018-01-06 14:21:15 +01:00
|
|
|
'salt_minion_pkg_hash': '',
|
2018-01-06 13:54:57 +01:00
|
|
|
'config_path': '/private/etc/salt',
|
|
|
|
'minion_service': 'com.saltstack.salt.minion',
|
|
|
|
},
|
2016-08-13 19:56:53 +02:00
|
|
|
}, merge=salt['grains.filter_by']({
|
|
|
|
'Ubuntu': {
|
|
|
|
'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
|
2017-05-30 09:18:54 +02:00
|
|
|
salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/' + salt_release + ' ' + salt['grains.get']('oscodename') + ' main',
|
|
|
|
'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/' + salt_release + '/SALTSTACK-GPG-KEY.pub',
|
2016-09-13 09:03:06 +02:00
|
|
|
'pygit2': 'python-pygit2',
|
|
|
|
'gitfs': {
|
|
|
|
'pygit2': {
|
|
|
|
'install_from_source': False,
|
|
|
|
'git': {
|
|
|
|
'require_state': False,
|
|
|
|
'install_from_package': None,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2016-08-13 19:56:53 +02:00
|
|
|
},
|
|
|
|
'Raspbian': {
|
|
|
|
'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
|
2017-07-18 22:18:44 +02:00
|
|
|
salt['grains.get']('os_family')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/armhf/' + salt_release + ' ' + salt['grains.get']('oscodename') + ' main',
|
|
|
|
'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os_family')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease)|string + '/armhf/' + salt_release + '/SALTSTACK-GPG-KEY.pub',
|
2016-08-13 19:56:53 +02:00
|
|
|
},
|
2016-11-14 23:13:52 +01:00
|
|
|
'SmartOS': {
|
|
|
|
'salt_master': 'salt',
|
|
|
|
'salt_minion': 'salt',
|
|
|
|
'salt_syndic': 'salt',
|
|
|
|
'salt_cloud': 'salt',
|
|
|
|
'salt_api': 'salt',
|
|
|
|
'salt_ssh': 'salt',
|
|
|
|
'minion_service': 'salt:minion',
|
|
|
|
'master_service': 'salt:master',
|
2017-12-23 22:23:53 +01:00
|
|
|
'api_service': 'salt:api',
|
2016-11-14 23:13:52 +01:00
|
|
|
'python_dulwich': 'py27-dulwich',
|
|
|
|
'gitfs': {
|
|
|
|
'dulwich': {
|
|
|
|
'install_from_source': False,
|
|
|
|
}
|
|
|
|
},
|
2016-11-14 23:22:52 +01:00
|
|
|
'config_path': '/opt/local/etc/salt',
|
2016-11-14 23:13:52 +01:00
|
|
|
'master': {
|
|
|
|
'gitfs_provider': 'dulwich'
|
|
|
|
},
|
|
|
|
}
|
2016-08-13 19:56:53 +02:00
|
|
|
}, grain='os', merge=salt['pillar.get']('salt:lookup')))
|
2015-05-26 16:41:04 +02:00
|
|
|
%}
|
2015-03-17 05:39:32 +01:00
|
|
|
|
2015-05-26 16:41:04 +02:00
|
|
|
{## Merge the flavor_map to the default settings ##}
|
2016-09-05 10:48:31 +02:00
|
|
|
{% do deep_merge(default_settings.salt,os_family_map) %}
|
2015-08-20 06:46:49 +02:00
|
|
|
|
2015-05-26 16:41:04 +02:00
|
|
|
{## Merge in salt:lookup pillar ##}
|
|
|
|
{% set salt_settings = salt['pillar.get'](
|
|
|
|
'salt',
|
|
|
|
default=default_settings.salt,
|
2015-08-20 06:46:49 +02:00
|
|
|
merge=True)
|
2015-05-26 16:41:04 +02:00
|
|
|
%}
|