Ver código fonte

Remove separate galera.ssl state

This patch removes separate state galera.ssl as it was previously
wrongly introduced. Instead include ssl tasks to master/slave when
ssl is enabled.
This fixes missing requirements when applying separate states.
Ensure that mysql package is installed before changing group
ownership for ssl files to mysql, as group will be added by mysql
packages.

Fix ssl inital configuration. SSL settings are not applied during
service reload, we have to add them during initial galera cluster
start.

Change-Id: Iff9a268000c3e5e722cc6e197cfd223ec1015f73
Related-Prod: PROD-16695
master
Vasyl Saienko 7 anos atrás
pai
commit
c0a5071814
5 arquivos alterados com 31 adições e 4 exclusões
  1. +14
    -3
      galera/_ssl.sls
  2. +7
    -0
      galera/files/my.cnf.init
  3. +0
    -1
      galera/init.sls
  4. +5
    -0
      galera/master.sls
  5. +5
    -0
      galera/slave.sls

galera/ssl.sls → galera/_ssl.sls Ver arquivo

@@ -1,7 +1,9 @@
{%- from "galera/map.jinja" import master, slave with context %}

{%- set service = master if pillar.galera.master is defined else slave %}
{%- set role = 'master' if pillar.galera.master is defined else 'slave' %}
{%- if master.get('enabled', False) %}
{%- set service, role = master, 'master' %}
{%- elif slave.get('enabled', False) %}
{%- set service, role = slave, 'slave' %}
{%- endif %}

{%- if service.get('ssl', {}).get('enabled', False) %}
{%- if service.ssl.cacert_chain is defined %}
@@ -13,6 +15,7 @@ mysql_cacertificate:
- makedirs: true
- require_in:
- service: galera_service
- file: galera_config
{%- else %}
mysql_cacertificate_exists:
file.exists:
@@ -26,6 +29,7 @@ mysql_cacertificate:
- file: mysql_cacertificate_exists
- require_in:
- service: galera_service
- file: galera_config
{%- endif %}

{%- if service.ssl.cert is defined %}
@@ -37,6 +41,7 @@ mysql_certificate:
- makedirs: true
- require_in:
- service: galera_service
- file: galera_config
{%- else %}
mysql_certificate_exists:
file.exists:
@@ -50,6 +55,7 @@ mysql_certificate:
- file: mysql_certificate_exists
- require_in:
- service: galera_service
- file: galera_config
{%- endif %}

{%- if service.ssl.key is defined %}
@@ -61,8 +67,11 @@ mysql_server_key:
- group: mysql
- mode: 0440
- makedirs: true
- require:
- pkg: galera_packages
- require_in:
- service: galera_service
- file: galera_config
{%- else %}
mysql_server_key_exists:
file.exists:
@@ -76,8 +85,10 @@ mysql_server_key:
- create: False
- require:
- file: mysql_server_key_exists
- pkg: galera_packages
- require_in:
- service: galera_service
- file: galera_config
{%- endif %}

{%- endif %}

+ 7
- 0
galera/files/my.cnf.init Ver arquivo

@@ -58,6 +58,13 @@ wsrep_node_address={{ service.bind.address }}
wsrep_provider_options="gcache.size = 256M"
wsrep_provider_options="gmcast.listen_addr = tcp://{{ service.bind.address }}:4567"

{% if service.get('ssl', {}).get('enabled', False) %}
wsrep_provider_options="socket.ssl=yes;socket.ssl_key={{ service.ssl.key_file }};socket.ssl_cert={{ service.ssl.cert_file }};socket.ssl_ca={{ service.ssl.ca_file }}"
ssl-ca={{ service.ssl.ca_file }}
ssl-cert={{ service.ssl.cert_file }}
ssl-key={{ service.ssl.key_file }}
{% endif %}

[xtrabackup]
parallel=4


+ 0
- 1
galera/init.sls Ver arquivo

@@ -1,7 +1,6 @@

{%- if pillar.galera is defined %}
include:
- galera.ssl
{%- if pillar.galera.master is defined %}
- galera.master
{%- endif %}

+ 5
- 0
galera/master.sls Ver arquivo

@@ -1,6 +1,11 @@
{%- from "galera/map.jinja" import master with context %}
{%- if master.get('enabled', False) %}

{%- if master.get('ssl', {}).get('enabled', False) %}
include:
- galera._ssl
{%- endif %}

{%- if grains.os_family == 'RedHat' %}
xtrabackup_repo:
pkg.installed:

+ 5
- 0
galera/slave.sls Ver arquivo

@@ -1,6 +1,11 @@
{%- from "galera/map.jinja" import slave with context %}
{%- if slave.get('enabled', False) %}

{%- if slave.get('ssl', {}).get('enabled', False) %}
include:
- galera._ssl
{%- endif %}

{%- if grains.os_family == 'RedHat' %}
xtrabackup_repo:
pkg.installed:

Carregando…
Cancelar
Salvar