Saltstack Official Galera Formula
選択できるのは25トピックまでです。 トピックは、先頭が英数字で、英数字とダッシュ('-')を使用した35文字以内のものにしてください。

80 行
1.7KB

  1. {%- from "galera/map.jinja" import master with context %}
  2. {%- if master.get('enabled', False) %}
  3. {%- if master.get('ssl', {}).get('enabled', False) %}
  4. include:
  5. - galera._ssl
  6. {%- endif %}
  7. galera_packages:
  8. pkg.installed:
  9. - names: {{ master.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_mariadb_stop_service:
  23. service.dead:
  24. - name: {{ master.service }}
  25. galera_mariadb_new_cluster:
  26. cmd.run:
  27. - name: /usr/bin/galera_new_cluster
  28. - require:
  29. - galera_packages
  30. - galera_config
  31. galera_set_root_password:
  32. cmd.run:
  33. - name: mysqladmin password "{{ master.admin.password }}"
  34. {%- if grains.get('noservices') %}
  35. - onlyif: /bin/false
  36. {%- endif %}
  37. - require:
  38. - galera_mariadb_new_cluster
  39. mariadb_update_maint_password:
  40. cmd.run:
  41. - name: mysql -u root -p{{ master.admin.password }} -e "GRANT ALL PRIVILEGES ON *.* TO 'debian-sys-maint'@'localhost' IDENTIFIED BY '{{ master.maintenance_password }}';"
  42. {%- if grains.get('noservices') %}
  43. - onlyif: /bin/false
  44. {%- endif %}
  45. - require:
  46. - galera_mariadb_new_cluster
  47. galera_mariadb_finish_flag:
  48. file.touch:
  49. - name: /etc/salt/.galera_bootstrap
  50. - require:
  51. - galera_mariadb_new_cluster
  52. {%- endif %}
  53. galera_config:
  54. file.managed:
  55. - name: {{ master.config }}
  56. - source: salt://galera/files/my.cnf
  57. - mode: 644
  58. - template: jinja
  59. mariadb_service_enable:
  60. service.running:
  61. - name: {{ master.service }}
  62. - enable: true
  63. - require:
  64. - galera_packages
  65. - galera_config
  66. {%- endif %}