Saltstack Official Salt Formula
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

181 lines
5.8KB

  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': salt['grains.filter_by']({
  57. 'Fedora': 'python2-pygit2',
  58. 'default': 'python-pygit2',
  59. }, grain='os'),
  60. 'python_git': 'GitPython',
  61. 'gitfs': {
  62. 'pygit2': {
  63. 'install_from_source': False,
  64. 'git': {
  65. 'require_state': False,
  66. 'install_from_package': 'git',
  67. },
  68. },
  69. },
  70. 'master': {
  71. 'gitfs_provider': 'pygit2'
  72. },
  73. },
  74. 'Suse': {},
  75. 'Gentoo': {
  76. 'salt_master': 'app-admin/salt',
  77. 'salt_minion': 'app-admin/salt',
  78. 'salt_syndic': 'app-admin/salt',
  79. 'salt_api': 'app-admin/salt',
  80. 'salt_cloud': 'app-admin/salt',
  81. },
  82. 'Arch': {
  83. 'salt_master': 'salt',
  84. 'salt_minion': 'salt',
  85. 'salt_syndic': 'salt',
  86. 'salt_cloud': 'salt',
  87. 'salt_api': 'salt',
  88. 'salt_ssh': 'salt',
  89. 'pygit2': 'python2-pygit2',
  90. 'libgit2': 'libgit2',
  91. },
  92. 'FreeBSD': {
  93. 'salt_master': 'py27-salt',
  94. 'salt_minion': 'py27-salt',
  95. 'salt_syndic': 'py27-salt',
  96. 'salt_cloud': 'py27-salt',
  97. 'salt_api': 'py27-salt',
  98. 'salt_ssh': 'py27-salt',
  99. 'python_git': 'py27-GitPython',
  100. 'pygit2': 'py27-pygit2',
  101. 'config_path': '/usr/local/etc/salt',
  102. 'minion_service': 'salt_minion',
  103. 'master_service': 'salt_master',
  104. 'api_service': 'salt_api',
  105. 'syndic_service': 'salt_syndic',
  106. },
  107. 'OpenBSD': {
  108. 'salt_master': 'salt',
  109. 'salt_minion': 'salt',
  110. 'salt_syndic': 'salt',
  111. 'salt_cloud': 'salt',
  112. 'salt_api': 'salt',
  113. 'salt_ssh': 'salt',
  114. 'config_path': '/etc/salt',
  115. 'minion_service': 'salt_minion',
  116. 'master_service': 'salt_master',
  117. 'python_git': 'py-GitPython',
  118. },
  119. 'Windows': {
  120. 'salt_minion': 'saltstack.minion',
  121. 'config_path': 'C:\salt\conf',
  122. 'minion_service': 'salt-minion',
  123. },
  124. }, merge=salt['grains.filter_by']({
  125. 'Ubuntu': {
  126. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  127. salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/latest ' + salt['grains.get']('oscodename') + ' main',
  128. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os')|lower + '/' + osrelease + '/amd64/latest/SALTSTACK-GPG-KEY.pub',
  129. 'pygit2': 'python-pygit2',
  130. 'gitfs': {
  131. 'pygit2': {
  132. 'install_from_source': False,
  133. 'git': {
  134. 'require_state': False,
  135. 'install_from_package': None,
  136. },
  137. },
  138. },
  139. },
  140. 'Raspbian': {
  141. 'pkgrepo': 'deb http://repo.saltstack.com/apt/' +
  142. salt['grains.get']('os_family')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease) + '/armhf/latest ' + salt['grains.get']('oscodename') + ' main',
  143. 'key_url': 'https://repo.saltstack.com/apt/' + salt['grains.get']('os_family')|lower + '/' + salt['grains.get']('osmajorrelease', osrelease) + '/armhf/latest/SALTSTACK-GPG-KEY.pub',
  144. },
  145. 'SmartOS': {
  146. 'salt_master': 'salt',
  147. 'salt_minion': 'salt',
  148. 'salt_syndic': 'salt',
  149. 'salt_cloud': 'salt',
  150. 'salt_api': 'salt',
  151. 'salt_ssh': 'salt',
  152. 'minion_service': 'salt:minion',
  153. 'master_service': 'salt:master',
  154. 'python_dulwich': 'py27-dulwich',
  155. 'gitfs': {
  156. 'dulwich': {
  157. 'install_from_source': False,
  158. }
  159. },
  160. 'config_path': '/opt/local/etc/salt',
  161. 'master': {
  162. 'gitfs_provider': 'dulwich'
  163. },
  164. }
  165. }, grain='os', merge=salt['pillar.get']('salt:lookup')))
  166. %}
  167. {## Merge the flavor_map to the default settings ##}
  168. {% do deep_merge(default_settings.salt,os_family_map) %}
  169. {## Merge in salt:lookup pillar ##}
  170. {% set salt_settings = salt['pillar.get'](
  171. 'salt',
  172. default=default_settings.salt,
  173. merge=True)
  174. %}