Saltstack Official Salt Formula
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

176 line
5.6KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=jinja
  3. {%- macro deep_merge(a, b) %}
  4. {%- for k,v in b.iteritems() %}
  5. {%- if v is string or v is number %}
  6. {%- do a.update({ k: v }) %}
  7. {%- elif v is not mapping %}
  8. {%- if a[k] is not defined %}
  9. {%- do a.update({ k: v }) %}
  10. {%- elif a[k] is iterable and a[k] is not mapping and a[k] is not string %}
  11. {%- do a.update({ k: v|list + a[k]|list}) %}
  12. {%- else %}
  13. {%- do a.update({ k: v }) %}
  14. {%- endif %}
  15. {%- elif v is mapping %}
  16. {%- if a[k] is not defined %}
  17. {%- do a.update({ k: v }) %}
  18. {%- elif a[k] is not mapping %}
  19. {%- do a.update({ k: v }) %}
  20. {%- else %}
  21. {%- do deep_merge(a[k], v) %}
  22. {%- endif %}
  23. {%- else %}
  24. {%- do a.update({ k: 'ERROR: case not contempled in merging!' }) %}
  25. {%- endif %}
  26. {%- endfor %}
  27. {%- endmacro %}
  28. {## Start with defaults from defaults.yaml ##}
  29. {% import_yaml "salt/defaults.yaml" as default_settings %}
  30. {##
  31. Setup variable using grains['os_family'] based logic, only add key:values here
  32. that differ from whats in defaults.yaml
  33. ##}
  34. {% set osrelease = salt['grains.get']('osrelease') %}
  35. {% set os_family_map = salt['grains.filter_by']({
  36. 'Debian': {
  37. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  38. salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease) + '/amd64/latest ' + salt['grains.get']('oscodename') + ' main',
  39. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease) + '/amd64/latest/SALTSTACK-GPG-KEY.pub',
  40. 'libgit2': 'libgit2-22',
  41. 'gitfs': {
  42. 'pygit2': {
  43. 'install_from_source': True,
  44. 'version': '0.22.1',
  45. 'git': {
  46. 'require_state': False,
  47. 'install_from_package': 'git',
  48. },
  49. 'libgit2': {
  50. 'install_from_source': False,
  51. },
  52. },
  53. },
  54. },
  55. 'RedHat': {
  56. 'pygit2': 'python-pygit2',
  57. 'python_git': 'GitPython',
  58. 'gitfs': {
  59. 'pygit2': {
  60. 'install_from_source': False,
  61. 'git': {
  62. 'require_state': False,
  63. 'install_from_package': 'git',
  64. },
  65. },
  66. },
  67. 'master': {
  68. 'gitfs_provider': 'pygit2'
  69. },
  70. },
  71. 'Suse': {},
  72. 'Gentoo': {
  73. 'salt_master': 'app-admin/salt',
  74. 'salt_minion': 'app-admin/salt',
  75. 'salt_syndic': 'app-admin/salt',
  76. 'salt_api': 'app-admin/salt',
  77. 'salt_cloud': 'app-admin/salt',
  78. },
  79. 'Arch': {
  80. 'salt_master': 'salt',
  81. 'salt_minion': 'salt',
  82. 'salt_syndic': 'salt',
  83. 'salt_cloud': 'salt',
  84. 'salt_api': 'salt',
  85. 'salt_ssh': 'salt',
  86. },
  87. 'FreeBSD': {
  88. 'salt_master': 'py27-salt',
  89. 'salt_minion': 'py27-salt',
  90. 'salt_syndic': 'py27-salt',
  91. 'salt_cloud': 'py27-salt',
  92. 'salt_api': 'py27-salt',
  93. 'salt_ssh': 'py27-salt',
  94. 'python_git': 'py27-GitPython',
  95. 'pygit2': 'py27-pygit2',
  96. 'config_path': '/usr/local/etc/salt',
  97. 'minion_service': 'salt_minion',
  98. 'master_service': 'salt_master',
  99. 'api_service': 'salt_api',
  100. 'syndic_service': 'salt_syndic',
  101. },
  102. 'OpenBSD': {
  103. 'salt_master': 'salt',
  104. 'salt_minion': 'salt',
  105. 'salt_syndic': 'salt',
  106. 'salt_cloud': 'salt',
  107. 'salt_api': 'salt',
  108. 'salt_ssh': 'salt',
  109. 'config_path': '/etc/salt',
  110. 'minion_service': 'salt_minion',
  111. 'master_service': 'salt_master',
  112. 'python_git': 'py-GitPython',
  113. },
  114. 'Windows': {
  115. 'salt_minion': 'saltstack.minion',
  116. 'config_path': 'C:\salt\conf',
  117. 'minion_service': 'salt-minion',
  118. },
  119. }, merge=salt['grains.filter_by']({
  120. 'Ubuntu': {
  121. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  122. salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/latest ' + salt['grains.get']('oscodename') + ' main',
  123. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/latest/SALTSTACK-GPG-KEY.pub',
  124. 'pygit2': 'python-pygit2',
  125. 'gitfs': {
  126. 'pygit2': {
  127. 'install_from_source': False,
  128. 'git': {
  129. 'require_state': False,
  130. 'install_from_package': None,
  131. },
  132. },
  133. },
  134. },
  135. 'Raspbian': {
  136. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  137. salt['grains.get']('os_family')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease) + '/armhf/latest ' + salt['grains.get']('oscodename') + ' main',
  138. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os_family')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease) + '/armhf/latest/SALTSTACK-GPG-KEY.pub',
  139. },
  140. 'SmartOS': {
  141. 'salt_master': 'salt',
  142. 'salt_minion': 'salt',
  143. 'salt_syndic': 'salt',
  144. 'salt_cloud': 'salt',
  145. 'salt_api': 'salt',
  146. 'salt_ssh': 'salt',
  147. 'minion_service': 'salt:minion',
  148. 'master_service': 'salt:master',
  149. 'python_dulwich': 'py27-dulwich',
  150. 'gitfs': {
  151. 'dulwich': {
  152. 'install_from_source': False,
  153. }
  154. },
  155. 'config_path': '/opt/local/etc/salt',
  156. 'master': {
  157. 'gitfs_provider': 'dulwich'
  158. },
  159. }
  160. }, grain='os', merge=salt['pillar.get']('salt:lookup')))
  161. %}
  162. {## Merge the flavor_map to the default settings ##}
  163. {% do deep_merge(default_settings.salt,os_family_map) %}
  164. {## Merge in salt:lookup pillar ##}
  165. {% set salt_settings = salt['pillar.get'](
  166. 'salt',
  167. default=default_settings.salt,
  168. merge=True)
  169. %}