Saltstack Official PHP 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.

364 line
17KB

  1. # -*- coding: utf-8 -*-
  2. # vim: ft=jinja
  3. {%- if salt['grains.get']('os') == "Ubuntu" %}
  4. {%- set use_external_repo = salt['pillar.get']('php:use_external_repo', False) %}
  5. {%- if use_external_repo %}
  6. {%- set php_version = salt['pillar.get']('php:version', '7.0')|string %}
  7. {%- if salt['grains.get']('osrelease')|string >= '16.04' %}
  8. {# Ubuntu 16.04+ specific PHP definitions #}
  9. {%- set php = salt['grains.filter_by']({
  10. 'Ubuntu': {
  11. 'adodb_pkg': 'libphp-adodb',
  12. 'apc_pkg': 'php-apcu',
  13. 'apcu_pkg': 'php-apcu-bc',
  14. 'bcmath_pkg': 'php' + php_version + '-bcmath',
  15. 'build_pkgs': ['libssl-dev', 'libcurl4-openssl-dev', 'pkg-config', 'libsslcommon2-dev', 'gcc', 'make', 'autoconf', 'libc-dev', 'pkg-config'],
  16. 'cgi_pkg': 'php' + php_version + '-cgi',
  17. 'cli_pkg': 'php' + php_version + '-cli',
  18. 'composer_bin': 'composer',
  19. 'curl_pkg': 'php' + php_version + '-curl',
  20. 'dev_pkg': 'php' + php_version + '-dev',
  21. 'ext_conf_path': '/etc/php/' + php_version + '/mods-available',
  22. 'fpm_pkg': 'php' + php_version + '-fpm',
  23. 'fpm_service': 'php' + php_version + '-fpm',
  24. 'gd_pkg': 'php' + php_version + '-gd',
  25. 'imagick_pkg': 'php-imagick',
  26. 'imap_pkg': 'php' + php_version + '-imap',
  27. 'intl_pkg': 'php' + php_version + '-intl',
  28. 'json_pkg': 'php' + php_version + '-json',
  29. 'ldap_pkg': 'php' + php_version + '-ldap',
  30. 'local_bin': '/usr/local/bin',
  31. 'mail_pkg': 'php-mail',
  32. 'mbstring_pkg': 'php' + php_version + '-mbstring',
  33. 'mcrypt_pkg': 'php' + php_version + '-mcrypt',
  34. 'memcache_pkg': 'php-memcache',
  35. 'memcached_pkg': 'php-memcached',
  36. 'mongo_ext': 'mongodb.so',
  37. 'mongo_pecl': 'mongodb',
  38. 'mysql_pkg': 'php' + php_version + '-mysql',
  39. 'mysqlnd_pkg': 'php' + php_version + '-mysql',
  40. 'oauth_pkg': 'php-oauth',
  41. 'pear_pkg': 'php-pear',
  42. 'pgsql_pkg': 'php' + php_version + '-pgsql',
  43. 'php_ini': '/etc/php/' + php_version + '/apache2/php.ini',
  44. 'php_pkg': 'php' + php_version,
  45. 'phpenmod_command': 'phpenmod -v' + php_version,
  46. 'readline_pkg': 'php' + php_version + '-readline',
  47. 'redis_pkg': 'php-redis',
  48. 'soap_pkg': 'php' + php_version + '-soap',
  49. 'sqlite_pkg': 'php' + php_version + '-sqlite3',
  50. 'suhosin5_ext': 'suhosin.so',
  51. 'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
  52. 'suhosin7_ext': 'suhosin7.so',
  53. 'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
  54. 'temp_dir': '/tmp',
  55. 'xml_pkg': 'php' + php_version + '-xml',
  56. 'zip_pkg': 'php' + php_version + '-zip',
  57. }
  58. }, grain="os", merge=salt['pillar.get']('php:lookup')) %}
  59. {%- else %}
  60. {# All other Ubuntu PHP definitions #}
  61. {%- set php = salt['grains.filter_by']({
  62. 'Ubuntu': {
  63. 'adodb_pkg': 'libphp-adodb',
  64. 'apc_pkg': 'php-apcu',
  65. 'apcu_pkg': 'php-apcu',
  66. 'bcmath_pkg': 'php' + php_version + '-bcmath',
  67. 'build_pkgs': ['libssl-dev', 'libcurl4-openssl-dev', 'gcc', 'make', 'autoconf', 'libc-dev', 'pkg-config'],
  68. 'cgi_pkg': 'php' + php_version + '-cgi',
  69. 'cli_pkg': 'php' + php_version + '-cli',
  70. 'composer_bin': 'composer',
  71. 'curl_pkg': 'php' + php_version + '-curl',
  72. 'dev_pkg': 'php' + php_version + '-dev',
  73. 'ext_conf_path': '/etc/php/' + php_version + '/mods-available',
  74. 'fpm_pkg': 'php' + php_version + '-fpm',
  75. 'fpm_service': 'php' + php_version + '-fpm',
  76. 'gd_pkg': 'php' + php_version + '-gd',
  77. 'imagick_pkg': 'php-imagick',
  78. 'imap_pkg': 'php' + php_version + '-imap',
  79. 'intl_pkg': 'php' + php_version + '-intl',
  80. 'json_pkg': 'php' + php_version + '-json',
  81. 'ldap_pkg': 'php' + php_version + '-ldap',
  82. 'local_bin': '/usr/local/bin',
  83. 'mail_pkg': 'php-mail',
  84. 'mbstring_pkg': 'php' + php_version + '-mbstring',
  85. 'mcrypt_pkg': 'php' + php_version + '-mcrypt',
  86. 'memcache_pkg': 'php-memcache',
  87. 'memcached_pkg': 'php-memcached',
  88. 'mongo_ext': 'mongodb.so',
  89. 'mongo_pecl': 'mongodb',
  90. 'mysql_pkg': 'php' + php_version + '-mysql',
  91. 'mysqlnd_pkg': 'php' + php_version + '-mysql',
  92. 'oauth_pkg': 'php-oauth',
  93. 'pear_pkg': 'php-pear',
  94. 'pgsql_pkg': 'php' + php_version + '-pgsql',
  95. 'php_ini': '/etc/php/' + php_version + '/apache2/php.ini',
  96. 'php_pkg': 'php' + php_version,
  97. 'phpenmod_command': 'phpenmod -v' + php_version,
  98. 'readline_pkg': 'php' + php_version + '-readline',
  99. 'redis_pkg': 'php-redis',
  100. 'soap_pkg': 'php' + php_version + '-soap',
  101. 'sqlite_pkg': 'php' + php_version + '-sqlite3',
  102. 'suhosin5_ext': 'suhosin.so',
  103. 'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
  104. 'suhosin7_ext': 'suhosin7.so',
  105. 'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
  106. 'temp_dir': '/tmp',
  107. 'xml_pkg': 'php' + php_version + '-xml',
  108. 'zip_pkg': 'php' + php_version + '-zip',
  109. }
  110. }, grain="os", merge=salt['pillar.get']('php:lookup')) %}
  111. {%- endif %}
  112. {%- else %}
  113. {%- if salt['grains.get']('osrelease')|string >= '16.04' %}
  114. {# Ubuntu 16.04+ specific PHP definitions #}
  115. {%- set php = salt['grains.filter_by']({
  116. 'Ubuntu': {
  117. 'adodb_pkg': 'libphp-adodb',
  118. 'apc_pkg': 'php',
  119. 'apcu_pkg': 'php-apcu',
  120. 'bcmath_pkg': 'php-bcmath',
  121. 'build_pkgs': ['libssl-dev', 'libcurl4-openssl-dev', 'pkg-config', 'libsslcommon2-dev'],
  122. 'cgi_pkg': 'php-cgi',
  123. 'cli_pkg': 'php-cli',
  124. 'composer_bin': 'composer',
  125. 'curl_pkg': 'php-curl',
  126. 'dev_pkg': 'php-dev',
  127. 'ext_conf_path': '/etc/php/7.0/mods-available',
  128. 'fpm_pkg': 'php-fpm',
  129. 'fpm_service': 'php7.0-fpm',
  130. 'gd_pkg': 'php-gd',
  131. 'imagick_pkg': 'php-imagick',
  132. 'imap_pkg': 'php-imap',
  133. 'intl_pkg': 'php-intl',
  134. 'json_pkg': 'php-json',
  135. 'ldap_pkg': 'php-ldap',
  136. 'local_bin': '/usr/local/bin',
  137. 'mail_pkg': 'php-mail',
  138. 'mbstring_pkg': 'php-mbstring',
  139. 'mcrypt_pkg': 'php-mcrypt',
  140. 'memcache_pkg': 'php-memcache',
  141. 'memcached_pkg': 'php-memcached',
  142. 'mongo_ext': 'mongodb.so',
  143. 'mongo_pecl': 'php-mongodb',
  144. 'mysql_pkg': 'php-mysql',
  145. 'mysqlnd_pkg': 'php',
  146. 'oauth_pkg': 'php-oauth',
  147. 'pear_pkg': 'php-pear',
  148. 'pgsql_pkg': 'php-pgsql',
  149. 'php_ini': '/etc/php/7.0/apache2/php.ini',
  150. 'php_pkg': 'php',
  151. 'phpenmod_command': 'phpenmod',
  152. 'readline_pkg': ' php-readline',
  153. 'redis_pkg': 'php-redis',
  154. 'soap_pkg': 'php-soap',
  155. 'sqlite_pkg': 'php-sqlite3',
  156. 'suhosin5_ext': 'suhosin.so',
  157. 'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
  158. 'suhosin7_ext': 'suhosin7.so',
  159. 'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
  160. 'temp_dir': '/tmp',
  161. 'xml_pkg': 'php-xml',
  162. 'zip_pkg': 'php-zip',
  163. }
  164. }, grain="os", merge=salt['pillar.get']('php:lookup')) %}
  165. {%- else %}
  166. {# All other Ubuntu PHP definitions #}
  167. {%- set php = salt['grains.filter_by']({
  168. 'Ubuntu': {
  169. 'adodb_pkg': 'php5-adodb',
  170. 'apc_pkg': 'php-apc',
  171. 'apcu_pkg': 'php5-apcu',
  172. 'bcmath_pkg': 'php5',
  173. 'build_pkgs': ['libssl-dev', 'libcurl4-openssl-dev'],
  174. 'cgi_pkg': 'php5-cgi',
  175. 'cli_pkg': 'php5-cli',
  176. 'composer_bin': 'composer',
  177. 'curl_pkg': 'php5-curl',
  178. 'dev_pkg': 'php5-dev',
  179. 'ext_conf_path': salt['grains.filter_by']({
  180. 'precise': '/etc/php5/conf.d',
  181. 'default': '/etc/php5/mods-available',
  182. }, grain='oscodename'),
  183. 'fpm_pkg': 'php5-fpm',
  184. 'fpm_service': 'php5-fpm',
  185. 'gd_pkg': 'php5-gd',
  186. 'imagick_pkg': 'php5-imagick',
  187. 'imap_pkg': 'php5-imap',
  188. 'intl_pkg': 'php5-intl',
  189. 'json_pkg': 'php5-json',
  190. 'ldap_pkg': 'php5-ldap',
  191. 'local_bin': '/usr/local/bin',
  192. 'mail_pkg': 'php-mail',
  193. 'mbstring_pkg': 'php5',
  194. 'mcrypt_pkg': 'php5-mcrypt',
  195. 'memcache_pkg': 'php5-memcache',
  196. 'memcached_pkg': 'php5-memcached',
  197. 'mongo_ext': 'mongo.so',
  198. 'mongo_pecl': 'mongo',
  199. 'mysql_pkg': 'php5-mysql',
  200. 'mysqlnd_pkg': 'php5-mysqlnd',
  201. 'oauth_pkg': 'php5-oauth',
  202. 'pear_pkg': 'php-pear',
  203. 'pgsql_pkg': 'php5-pgsql',
  204. 'php_ini': '/etc/php5/apache2/php.ini',
  205. 'php_pkg': 'php5',
  206. 'phpenmod_command': salt['grains.filter_by']({
  207. 'precise': 'true',
  208. 'default': 'php5enmod',
  209. }, grain='oscodename'),
  210. 'phpenmod_command': 'php5enmod',
  211. 'readline_pkg': ' php5-readline',
  212. 'redis_pkg': 'php5-redis',
  213. 'soap_pkg': 'php-soap',
  214. 'sqlite_pkg': 'php5-sqlite',
  215. 'suhosin5_ext': 'suhosin.so',
  216. 'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
  217. 'suhosin7_ext': 'suhosin7.so',
  218. 'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
  219. 'temp_dir': '/tmp',
  220. 'xml_pkg': 'php5',
  221. 'zip_pkg': 'php5',
  222. },
  223. }, grain='os', merge=salt['pillar.get']('php:lookup')) %}
  224. {%- endif %}
  225. {%- endif %}
  226. {%- else %}
  227. {%- set php = salt['grains.filter_by']({
  228. 'Debian': {
  229. 'adodb_pkg': 'php5-adodb',
  230. 'apc_pkg': 'php-apc',
  231. 'apcu_pkg': salt['grains.filter_by']({
  232. 'wheezy': 'php-apc',
  233. 'jessie': 'php5-apcu',
  234. }, grain='oscodename'),
  235. 'bcmath_pkg': 'php5-fpm',
  236. 'build_pkgs': ['libssl-dev', 'libcurl4-openssl-dev', 'build-essential'],
  237. 'cgi_pkg': 'php5-cgi',
  238. 'cli_pkg': 'php5-cli',
  239. 'composer_bin': 'composer',
  240. 'curl_pkg': 'php5-curl',
  241. 'dev_pkg': 'php5-dev',
  242. 'ext_conf_path': '/etc/php5/mods-available',
  243. 'fpm_pkg': 'php5-fpm',
  244. 'fpm_service': 'php5-fpm',
  245. 'gd_pkg': 'php5-gd',
  246. 'imagick_pkg': 'php5-imagick',
  247. 'imap_pkg': 'php5-imap',
  248. 'intl_pkg': 'php5-intl',
  249. 'json_pkg': 'php5-json',
  250. 'ldap_pkg': 'php5-ldap',
  251. 'local_bin': '/usr/local/bin',
  252. 'mail_pkg': 'php-mail',
  253. 'mbstring_pkg': 'php5',
  254. 'mcrypt_pkg': 'php5-mcrypt',
  255. 'memcache_pkg': 'php5-memcache',
  256. 'memcached_pkg': 'php5-memcached',
  257. 'mongo_ext': 'mongo.so',
  258. 'mongo_pecl': 'mongo',
  259. 'mysql_pkg': 'php5-mysql',
  260. 'mysqlnd_pkg': 'php5-mysqlnd',
  261. 'oauth_pkg': 'php5-oauth',
  262. 'pear_pkg': 'php-pear',
  263. 'pgsql_pkg': 'php5-pgsql',
  264. 'php_ini': '/etc/php5/apache2/php.ini',
  265. 'php_pkg': 'php5',
  266. 'phpenmod_command': 'php5enmod',
  267. 'readline_pkg': ' php5-readline',
  268. 'redis_pkg': 'php5-redis',
  269. 'soap_pkg': 'php-soap',
  270. 'sqlite_pkg': 'php5-sqlite',
  271. 'suhosin5_ext': 'suhosin.so',
  272. 'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
  273. 'suhosin7_ext': 'suhosin7.so',
  274. 'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
  275. 'temp_dir': '/tmp',
  276. 'xml_pkg': 'php5',
  277. 'zip_pkg': 'php5',
  278. },
  279. 'RedHat': {
  280. 'adodb_pkg': 'php-adodb',
  281. 'apc_pkg': 'php-pecl-apcu',
  282. 'apcu_pkg': 'php-pecl-apcu',
  283. 'bcmath_pkg': 'php-bcmath',
  284. 'build_pkgs': ['openssl-devel', 'gcc'],
  285. 'cgi_pkg': 'php-cgi',
  286. 'cli_pkg': 'php-cli',
  287. 'composer_bin': 'composer',
  288. 'curl_pkg': 'curl',
  289. 'dev_pkg': 'php-devel',
  290. 'ext_conf_path': '/etc/php.d',
  291. 'fpm_pkg': 'php-fpm',
  292. 'fpm_service': 'php-fpm',
  293. 'gd_pkg': 'php-gd',
  294. 'imagick_pkg': 'php-pecl-imagick',
  295. 'imap_pkg': 'php-imap',
  296. 'intl_pkg': 'php-intl',
  297. 'json_pkg': 'php-common',
  298. 'ldap_pkg': 'php-ldap',
  299. 'local_bin': '/usr/local/bin',
  300. 'mail_pkg': 'php-pear-Mail',
  301. 'mbstring_pkg': 'php-mbstring',
  302. 'mcrypt_pkg': 'php-mcrypt',
  303. 'memcache_pkg': 'php-pecl-memcache',
  304. 'memcached_pkg': 'php-pecl-memcached',
  305. 'mongo_ext': 'mongo.so',
  306. 'mongo_pecl': 'mongo',
  307. 'mysql_pkg': 'php-mysql',
  308. 'mysqlnd_pkg': 'php-mysqlnd',
  309. 'oauth_pkg': 'php-pecl-oauth',
  310. 'pear_pkg': 'php-pear',
  311. 'pgsql_pkg': 'php-pgsql',
  312. 'php_ini': '/etc/php.ini',
  313. 'php_pkg': 'php',
  314. 'readline_pkg': 'php-cli',
  315. 'redis_pkg': 'php-pecl-redis',
  316. 'soap_pkg': 'php-soap',
  317. 'sqlite_pkg': 'php-pdo',
  318. 'suhosin5_ext': 'suhosin.so',
  319. 'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
  320. 'suhosin7_ext': 'suhosin7.so',
  321. 'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
  322. 'temp_dir': '/tmp',
  323. 'xml_pkg': 'php-xml',
  324. 'zip_pkg': 'php',
  325. },
  326. 'Suse': {
  327. 'adodb_pkg': 'php5-dba',
  328. 'cli_pkg': 'php5-cli',
  329. 'composer_bin': 'composer',
  330. 'curl_pkg': 'php5-curl',
  331. 'dev_pkg': 'php5-devel',
  332. 'ext_conf_path': '/etc/php5/conf.d',
  333. 'fpm_pkg': 'php5-fpm',
  334. 'fpm_service': 'php5-fpm',
  335. 'gd_pkg': 'php5-gd',
  336. 'imap_pkg': 'php5-imap',
  337. 'intl_pkg': 'php5-intl',
  338. 'json_pkg': 'php5-json',
  339. 'ldap_pkg': 'php5-ldap',
  340. 'local_bin': '/usr/local/bin',
  341. 'mbstring_pkg': 'php5-mbstring',
  342. 'mcrypt_pkg': 'php5-mcrypt',
  343. 'mongo_ext': 'mongo.so',
  344. 'mongo_pecl': 'mongo',
  345. 'mysql_pkg': 'php5-mysql',
  346. 'pear_pkg': 'php5-pear',
  347. 'pgsql_pkg': 'php5-pgsql',
  348. 'php_ini': '/etc/php5/apache2/php.ini',
  349. 'php_pkg': 'php5',
  350. 'readline_pkg': ' php5-readline',
  351. 'soap_pkg': 'php5-soap',
  352. 'sqlite_pkg': 'php5-sqlite',
  353. 'suhosin5_ext': 'suhosin.so',
  354. 'suhosin5_repo': 'https://github.com/sektioneins/suhosin',
  355. 'suhosin7_ext': 'suhosin7.so',
  356. 'suhosin7_repo': 'https://github.com/sektioneins/suhosin7',
  357. 'temp_dir': '/tmp',
  358. 'xml_pkg': ['php5-xmlreader','php5-xmlwriter','php5-xmlrpc'],
  359. 'zip_pkg': 'php5-zip',
  360. },
  361. }, merge=salt['pillar.get']('php:lookup')) %}
  362. {%- endif %}