Saltstack Official Galera Formula
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. {%- from "galera/map.jinja" import slave with context %}
  2. {%- if slave.get('enabled', False) %}
  3. {%- if slave.get('ssl', {}).get('enabled', False) %}
  4. include:
  5. - galera._ssl
  6. {%- endif %}
  7. galera_packages:
  8. pkg.installed:
  9. - names: {{ slave.pkgs }}
  10. - refresh: true
  11. - force_yes: True
  12. galera_run_dir:
  13. file.directory:
  14. - name: /var/run/mysqld
  15. - makedirs: true
  16. - mode: 755
  17. - user: mysql
  18. - group: root
  19. - require:
  20. - galera_packages
  21. {%- if salt['cmd.shell']('test -e /etc/salt/.galera_bootstrap; echo $?') != '0' %}
  22. galera_set_root_password:
  23. cmd.run:
  24. - name: mysqladmin password "{{ slave.admin.password }}"
  25. {%- if grains.get('noservices') %}
  26. - onlyif: /bin/false
  27. {%- endif %}
  28. mariadb_update_maint_password:
  29. cmd.run:
  30. - name: mysql -u root -p{{ slave.admin.password }} -e "GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '{{ slave.maintenance_password }}';"
  31. {%- if grains.get('noservices') %}
  32. - onlyif: /bin/false
  33. {%- endif %}
  34. mariadb_service_dead:
  35. service.dead:
  36. - name: {{ slave.service }}
  37. galera_mariadb_finish_flag:
  38. file.touch:
  39. - name: /etc/salt/.galera_bootstrap
  40. {%- endif %}
  41. galera_config:
  42. file.managed:
  43. - name: {{ slave.config }}
  44. - source: salt://galera/files/my.cnf
  45. - mode: 644
  46. - template: jinja
  47. mariadb_service_enable:
  48. service.running:
  49. - name: {{ slave.service }}
  50. - enable: true
  51. - require:
  52. - galera_packages
  53. - galera_config
  54. {%- endif %}