new major release compatible with Mirantis galera
diff --git a/debian/changelog b/debian/changelog
index 59ab511..b1df366 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+salt-formula-galera (1.0) trusty; urgency=medium
+
+  * New major release
+
+ -- Pavel Cizinsky <pavel.cizinsky@tcpcloud.eu>  Wed, 24 Aug 2016 10:56:00 +0200
+
 salt-formula-galera (0.2) trusty; urgency=medium
 
   * First public release
diff --git a/galera/files/debian.cnf b/galera/files/debian.cnf
index 2be2e68..e1b543b 100644
--- a/galera/files/debian.cnf
+++ b/galera/files/debian.cnf
@@ -1,12 +1,20 @@
+{%- if pillar.galera.master is defined %}
+{%- from "galera/map.jinja" import master with context %}
+{%- set service = master %}
+{%- endif %}
+{%- if pillar.galera.slave is defined %}
+{%- from "galera/map.jinja" import slave with context %}
+{%- set service = slave %}
+{%- endif %}
 [client]
 host = localhost
 user = debian-sys-maint
-password = {{ pillar['mysql_config']['maintenance_password'] }}
+password = {{ service.maintenance_password }}
 socket = /var/run/mysqld/mysqld.sock
 
 [mysql_upgrade]
 host = localhost
 user = debian-sys-maint
-password = {{ pillar['mysql_config']['maintenance_password'] }}
+password = {{ service.maintenance_password }}
 socket = /var/run/mysqld/mysqld.sock
-basedir = /usr
\ No newline at end of file
+basedir = /usr
diff --git a/galera/files/my.cnf b/galera/files/my.cnf
index eb17afe..970e630 100644
--- a/galera/files/my.cnf
+++ b/galera/files/my.cnf
@@ -9,181 +9,59 @@
 {%- from "galera/map.jinja" import slave with context %}
 {%- set service = slave %}
 {%- endif %}
-[MYSQLD]
-user=mysql
-basedir=/usr/
-datadir=/var/lib/mysql
-socket={{ service.socket }}
-pid_file=mysqld.pid
-port=3306
-log_error={{ service.log_file }}
-log_warnings=2
-#log_output=FILE
-### INNODB OPTIONS 
-innodb_buffer_pool_size=9211M
-innodb_flush_log_at_trx_commit=2
-innodb_file_per_table=1
-innodb_data_file_path = ibdata1:100M:autoextend
-## You may want to tune the below depending on number of cores and disk sub
-innodb_read_io_threads=4
-innodb_write_io_threads=4
-innodb_io_capacity=200
-innodb_doublewrite=1
-innodb_log_file_size=1024M
-innodb_log_buffer_size=96M
-innodb_buffer_pool_instances=8
-innodb_log_files_in_group=2
-innodb_thread_concurrency=64
-#innodb_file_format=barracuda
-innodb_flush_method = O_DIRECT
-innodb_autoinc_lock_mode=2
-## avoid statistics update when doing e.g show tables
-innodb_stats_on_metadata=0
-default_storage_engine=innodb
 
+[mysqld]
+datadir=/var/lib/mysql
 bind-address={{ service.bind.address }}
-
-# CHARACTER SET
-#collation_server = utf8_unicode_ci
-#init_connect='SET NAMES utf8'
-character_set_server = utf8
-
-# REPLICATION SPECIFIC
-#server_id must be unique across all mysql servers participating in replication.
-#server_id=SERVERID
-binlog_format=ROW
-#log_slave_updates=1
-#log_bin=binlog
-#relay_log=relay-bin
-#expire_logs_days=7
-#gtid_mode=ON
-#enforce_gtid_consistency=1
-# OTHER THINGS, BUFFERS ETC
-key_buffer_size = 24M
-tmp_table_size = 64M
-max_heap_table_size = 64M
-max_allowed_packet = 512M
-#sort_buffer_size = 256K
-#read_buffer_size = 256K
-#read_rnd_buffer_size = 512K
-#myisam_sort_buffer_size = 8M
-skip_name_resolve
-memlock=0
-sysdate_is_now=1
+port=3306
 max_connections={{ service.get('max_connections', 20000) }}
-thread_cache_size=512
-query_cache_type = 0
-query_cache_size = 0
-table_open_cache=1024
-lower_case_table_names=0
-# 5.6 backwards compatibility
-#explicit_defaults_for_timestamp=1
-##
-## WSREP options
-##
+default-storage-engine=innodb
+binlog_format=ROW
+collation-server=utf8_general_ci
+init-connect='SET NAMES utf8'
+character-set-server=utf8
+default-storage-engine=innodb
+log_error=/var/log/mysql/error.log
+skip-external-locking
+skip-name-resolve
 
-# Full path to wsrep provider library or 'none'
+myisam_sort_buffer_size=64M
+wait_timeout=1800
+open_files_limit=102400
+table_open_cache=10000
+key_buffer_size=64M
+max_allowed_packet=256M
+query_cache_size=0
+query_cache_type=0
+
+innodb_file_format=Barracuda
+innodb_file_per_table=1
+innodb_buffer_pool_size=3138M
+innodb_log_file_size=627M
+innodb_read_io_threads=8
+innodb_write_io_threads=8
+innodb_io_capacity=500
+innodb_flush_log_at_trx_commit=2
+innodb_flush_method=O_DIRECT
+innodb_doublewrite=0
+innodb_autoinc_lock_mode=2
+innodb_locks_unsafe_for_binlog=1
+
+wsrep_cluster_address="gcomm://{% for member in service.members %}{{ member.host}}:4567{% if not loop.last %},{% endif %}{% endfor %}/?pc.wait_prim=no"
 wsrep_provider={{ service.wsrep_provider }}
+wsrep_cluster_name="openstack"
 
-wsrep_node_address={{ service.bind.address }}
-# Provider specific configuration options
-wsrep_provider_options="gcache.size=8192M"
-
-# Logical cluster name. Should be the same for all nodes.
-wsrep_cluster_name="my_wsrep_cluster"
-
-# Group communication system handle
-#wsrep_cluster_address=gcomm://10.0.0.3:4567,10.0.0.4:4567,10.0.0.2:4567
-wsrep_cluster_address=gcomm://{% for member in service.members %}{{ member.host}}{% if not loop.last %},{% endif %}{% endfor %}
-
-# Human_readable node name (non-unique). Hostname by default.
-wsrep_node_name={{ service.bind.address }}
-
-# Address for incoming client connections. Autodetect by default.
-#wsrep_node_incoming_address=
-
-# How many threads will process writesets from other nodes
 wsrep_slave_threads=8
-
-# DBUG options for wsrep provider
-#wsrep_dbug_option
-
-# Generate fake primary keys for non-PK tables (required for multi-master
-# and parallel applying operation)
-wsrep_certify_nonPK=1
-
-# Location of the directory with data files. Needed for non-mysqldump
-# state snapshot transfers. Defaults to mysql_real_data_home.
-#wsrep_data_home_dir=
-
-# Maximum number of rows in write set
-wsrep_max_ws_rows=131072
-
-# Maximum size of write set
-wsrep_max_ws_size=1073741824
-
-# to enable debug level logging, set this to 1
-wsrep_debug=0
-
-# convert locking sessions into transactions
-wsrep_convert_LOCK_to_trx=0
-
-# how many times to retry deadlocked autocommits
-wsrep_retry_autocommit=1
-
-# change auto_increment_increment and auto_increment_offset automatically
-wsrep_auto_increment_control=1
-
-# replicate myisam
-wsrep_replicate_myisam=1
-# retry autoinc insert, which failed for duplicate key error
-wsrep_drupal_282555_workaround=0
-
-# enable "strictly synchronous" semantics for read operations
-wsrep_causal_reads=0
-
-# Command to call when node status or cluster membership changes.
-# Will be passed all or some of the following options:
-# --status  - new status of this node
-# --uuid    - UUID of the cluster
-# --primary - whether the component is primary or not ("yes"/"no")
-# --members - comma-separated list of members
-# --index   - index of this node in the list
-#wsrep_notify_cmd=
-
-##
-## WSREP State Transfer options
-##
-
-# State Snapshot Transfer method
-# ClusterControl currently DOES NOT support wsrep_sst_method=mysqldump
-wsrep_sst_method=xtrabackup
-
-# Address on THIS node to receive SST at. DON'T SET IT TO DONOR ADDRESS!!!
-# (SST method dependent. Defaults to the first IP of the first interface)
-#wsrep_sst_receive_address=
-
-# SST authentication string. This will be used to send SST to joining nodes.
-# Depends on SST method. For mysqldump method it is root:<root password>
+wsrep_sst_method=xtrabackup-v2
 wsrep_sst_auth={{ service.admin.user }}:{{ service.admin.password }}
+wsrep_node_address={{ service.bind.address }}
+wsrep_provider_options="gcache.size = 256M"
+wsrep_provider_options="gmcast.listen_addr = tcp://{{ service.bind.address }}:4567"
 
-# Desired SST donor name.
-#wsrep_sst_donor=
+[xtrabackup]
+parallel=4
 
-# Protocol version to use
-# wsrep_protocol_version=
-[MYSQL]
-socket={{ service.socket }}
-#default_character_set=utf8
-[client]
-socket={{ service.socket }}
-default_character_set=utf8
-[mysqldump]
-max_allowed_packet = 512M
-socket={{ service.socket }}
-default_character_set=utf8
-[MYSQLD_SAFE]
-pid_file=mysqld.pid
-log_error={{ service.log_file }}
-basedir=/usr/
-datadir=/var/lib/mysql
+[sst]
+streamfmt=xbstream
+transferfmt=socat
+sockopt=,nodelay,sndbuf=1048576,rcvbuf=1048576
diff --git a/galera/files/my.cnf.init b/galera/files/my.cnf.init
index f782ac9..d3a1dec 100644
--- a/galera/files/my.cnf.init
+++ b/galera/files/my.cnf.init
@@ -9,180 +9,59 @@
 {%- from "galera/map.jinja" import slave with context %}
 {%- set service = slave %}
 {%- endif %}
-[MYSQLD]
-user=mysql
-basedir=/usr/
-datadir=/var/lib/mysql
-socket={{ service.socket }}
-pid_file=mysqld.pid
-port=3306
-log_error={{ service.log_file }}
-log_warnings=2
-#log_output=FILE
-### INNODB OPTIONS 
-innodb_buffer_pool_size=9211M
-innodb_flush_log_at_trx_commit=2
-innodb_file_per_table=1
-innodb_data_file_path = ibdata1:100M:autoextend
-## You may want to tune the below depending on number of cores and disk sub
-innodb_read_io_threads=4
-innodb_write_io_threads=4
-innodb_io_capacity=200
-innodb_doublewrite=1
-innodb_log_file_size=1024M
-innodb_log_buffer_size=96M
-innodb_buffer_pool_instances=8
-innodb_log_files_in_group=2
-innodb_thread_concurrency=64
-#innodb_file_format=barracuda
-innodb_flush_method = O_DIRECT
-innodb_autoinc_lock_mode=2
-## avoid statistics update when doing e.g show tables
-innodb_stats_on_metadata=0
-default_storage_engine=innodb
 
+[mysqld]
+datadir=/var/lib/mysql
 bind-address={{ service.bind.address }}
-
-# CHARACTER SET
-#collation_server = utf8_unicode_ci
-#init_connect='SET NAMES utf8'
-character_set_server = utf8
-
-# REPLICATION SPECIFIC
-#server_id must be unique across all mysql servers participating in replication.
-#server_id=SERVERID
-binlog_format=ROW
-#log_slave_updates=1
-#log_bin=binlog
-#relay_log=relay-bin
-#expire_logs_days=7
-#gtid_mode=ON
-#enforce_gtid_consistency=1
-# OTHER THINGS, BUFFERS ETC
-key_buffer_size = 24M
-tmp_table_size = 64M
-max_heap_table_size = 64M
-max_allowed_packet = 512M
-#sort_buffer_size = 256K
-#read_buffer_size = 256K
-#read_rnd_buffer_size = 512K
-#myisam_sort_buffer_size = 8M
-skip_name_resolve
-memlock=0
-sysdate_is_now=1
+port=3306
 max_connections={{ service.get('max_connections', 20000) }}
-thread_cache_size=512
-query_cache_type = 0
-query_cache_size = 0
-table_open_cache=1024
-lower_case_table_names=0
-# 5.6 backwards compatibility
-#explicit_defaults_for_timestamp=1
-##
-## WSREP options
-##
+default-storage-engine=innodb
+binlog_format=ROW
+collation-server=utf8_general_ci
+init-connect='SET NAMES utf8'
+character-set-server=utf8
+default-storage-engine=innodb
 
-# Full path to wsrep provider library or 'none'
+skip-external-locking
+skip-name-resolve
+
+myisam_sort_buffer_size=64M
+wait_timeout=1800
+open_files_limit=102400
+table_open_cache=10000
+key_buffer_size=64M
+max_allowed_packet=256M
+query_cache_size=0
+query_cache_type=0
+
+innodb_file_format=Barracuda
+innodb_file_per_table=1
+innodb_buffer_pool_size=3138M
+innodb_log_file_size=627M
+innodb_read_io_threads=8
+innodb_write_io_threads=8
+innodb_io_capacity=500
+innodb_flush_log_at_trx_commit=2
+innodb_flush_method=O_DIRECT
+innodb_doublewrite=0
+innodb_autoinc_lock_mode=2
+innodb_locks_unsafe_for_binlog=1
+
+wsrep_cluster_address="gcomm://"
 wsrep_provider={{ service.wsrep_provider }}
+wsrep_cluster_name="openstack"
 
-wsrep_node_address={{ service.bind.address }}
-# Provider specific configuration options
-wsrep_provider_options="gcache.size=8192M"
-
-# Logical cluster name. Should be the same for all nodes.
-wsrep_cluster_name="my_wsrep_cluster"
-
-# Group communication system handle
-wsrep_cluster_address=gcomm://
-
-# Human_readable node name (non-unique). Hostname by default.
-wsrep_node_name={{ service.bind.address }}
-
-# Address for incoming client connections. Autodetect by default.
-#wsrep_node_incoming_address=
-
-# How many threads will process writesets from other nodes
 wsrep_slave_threads=8
-
-# DBUG options for wsrep provider
-#wsrep_dbug_option
-
-# Generate fake primary keys for non-PK tables (required for multi-master
-# and parallel applying operation)
-wsrep_certify_nonPK=1
-
-# Location of the directory with data files. Needed for non-mysqldump
-# state snapshot transfers. Defaults to mysql_real_data_home.
-#wsrep_data_home_dir=
-
-# Maximum number of rows in write set
-wsrep_max_ws_rows=131072
-
-# Maximum size of write set
-wsrep_max_ws_size=1073741824
-
-# to enable debug level logging, set this to 1
-wsrep_debug=0
-
-# convert locking sessions into transactions
-wsrep_convert_LOCK_to_trx=0
-
-# how many times to retry deadlocked autocommits
-wsrep_retry_autocommit=1
-
-# change auto_increment_increment and auto_increment_offset automatically
-wsrep_auto_increment_control=1
-
-# replicate myisam
-wsrep_replicate_myisam=1
-# retry autoinc insert, which failed for duplicate key error
-wsrep_drupal_282555_workaround=0
-
-# enable "strictly synchronous" semantics for read operations
-wsrep_causal_reads=0
-
-# Command to call when node status or cluster membership changes.
-# Will be passed all or some of the following options:
-# --status  - new status of this node
-# --uuid    - UUID of the cluster
-# --primary - whether the component is primary or not ("yes"/"no")
-# --members - comma-separated list of members
-# --index   - index of this node in the list
-#wsrep_notify_cmd=
-
-##
-## WSREP State Transfer options
-##
-
-# State Snapshot Transfer method
-# ClusterControl currently DOES NOT support wsrep_sst_method=mysqldump
-wsrep_sst_method=xtrabackup
-
-# Address on THIS node to receive SST at. DON'T SET IT TO DONOR ADDRESS!!!
-# (SST method dependent. Defaults to the first IP of the first interface)
-#wsrep_sst_receive_address=
-
-# SST authentication string. This will be used to send SST to joining nodes.
-# Depends on SST method. For mysqldump method it is root:<root password>
+wsrep_sst_method=xtrabackup-v2
 wsrep_sst_auth={{ service.admin.user }}:{{ service.admin.password }}
+wsrep_node_address={{ service.bind.address }}
+wsrep_provider_options="gcache.size = 256M"
+wsrep_provider_options="gmcast.listen_addr = tcp://{{ service.bind.address }}:4567"
 
-# Desired SST donor name.
-#wsrep_sst_donor=
+[xtrabackup]
+parallel=4
 
-# Protocol version to use
-# wsrep_protocol_version=
-[MYSQL]
-socket={{ service.socket }}
-#default_character_set=utf8
-[client]
-socket={{ service.socket }}
-default_character_set=utf8
-[mysqldump]
-max_allowed_packet = 512M
-socket={{ service.socket }}
-default_character_set=utf8
-[MYSQLD_SAFE]
-pid_file=mysqld.pid
-log_error={{ service.log_file }}
-basedir=/usr/
-datadir=/var/lib/mysql
+[sst]
+streamfmt=xbstream
+transferfmt=socat
+sockopt=,nodelay,sndbuf=1048576,rcvbuf=1048576
diff --git a/galera/files/mysql b/galera/files/mysql
deleted file mode 100644
index 6d31087..0000000
--- a/galera/files/mysql
+++ /dev/null
@@ -1,206 +0,0 @@
-#!/bin/bash
-#
-### BEGIN INIT INFO
-# Provides:          mysql
-# Required-Start:    $remote_fs $syslog
-# Required-Stop:     $remote_fs $syslog
-# Should-Start:      $network $named $time
-# Should-Stop:       $network $named $time
-# Default-Start:     2 3 4 5
-# Default-Stop:      0 1 6
-# Short-Description: Start and stop the mysql database server daemon
-# Description:       Controls the main MySQL database server daemon "mysqld"
-#                    and its wrapper script "mysqld_safe".
-### END INIT INFO
-#
-set -e
-set -u
-${DEBIAN_SCRIPT_DEBUG:+ set -v -x}
-
-test -x /usr/sbin/mysqld || exit 0
-
-. /lib/lsb/init-functions
-
-SELF=$(cd $(dirname $0); pwd -P)/$(basename $0)
-CONF=/etc/mysql/my.cnf
-# MYADMIN="/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf"
-
-# priority can be overriden and "-s" adds output to stderr
-ERR_LOGGER="logger -p daemon.err -t /etc/init.d/mysql -i"
-
-# Safeguard (relative paths, core dumps..)
-cd /
-umask 077
-
-# mysqladmin likes to read /root/.my.cnf. This is usually not what I want
-# as many admins e.g. only store a password without a username there and
-# so break my scripts.
-export HOME=/etc/mysql/
-
-## Fetch a particular option from mysql's invocation.
-#
-# Usage: void mysqld_get_param option
-mysqld_get_param() {
-	/usr/sbin/mysqld --print-defaults \
-		| tr " " "\n" \
-		| grep -- "--$1" \
-		| tail -n 1 \
-		| cut -d= -f2
-}
-
-# Determine parameters once per script invocation
-datadir=`mysqld_get_param datadir`
-[ -z "$datadir" ] && datadir="/var/lib/mysql"
-pidfile=`mysqld_get_param pid_file`
-#[ -z "$pidfile" ] && pidfile="$datadir/$(hostname).pid"
-
-#JPavlik tcp cloud fix for init script
-pidfile="/var/lib/mysql/mysqld.pid"
-## Do some sanity checks before even trying to start mysqld.
-sanity_checks() {
-  # check for config file
-  if [ ! -r /etc/mysql/my.cnf ]; then
-    log_warning_msg "$0: WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz"
-    echo                "WARNING: /etc/mysql/my.cnf cannot be read. See README.Debian.gz" | $ERR_LOGGER
-  fi
-
-  # check for diskspace shortage
-  if LC_ALL=C BLOCKSIZE= df --portability $datadir/. | tail -n 1 | awk '{ exit ($4>4096) }'; then
-    log_failure_msg "$0: ERROR: The partition with $datadir is too full!"
-    echo                "ERROR: The partition with $datadir is too full!" | $ERR_LOGGER
-    exit 1
-  fi
-}
-
-## Checks if there is a server running and if so if it is accessible.
-#
-# check_alive insists on a pingable server
-# check_dead also fails if there is a lost mysqld in the process list
-#
-# Usage: boolean mysqld_status [check_alive|check_dead] [warn|nowarn]
-mysqld_status() {
-#    ping_output=`$MYADMIN ping 2>&1`; ping_alive=$(( ! $? ))
-
-    ps_alive=0
-    if [ -f "$pidfile" ] && ps `cat $pidfile` >/dev/null 2>&1; then ps_alive=1; fi
-    if [ "$1" = "check_alive"  -a  $ps_alive = 1 ] ||
-       [ "$1" = "check_dead"   -a  $ps_alive = 0 ]; then
-	return 0 # EXIT_SUCCESS
-    else
-	if [ "$2" = "warn" ]; then
-#	    echo -e "$ps_alive processes alive and '$MYADMIN ping' resulted in\n$ping_output\n" | $ERR_LOGGER -p daemon.debug
-	    echo -e "$ps_alive processes alive\n" | $ERR_LOGGER -p daemon.debug
-	fi
-	return 1 # EXIT_FAILURE
-    fi
-}
-
-
-#
-# main()
-#
-
-cmd=${1:-''}
-[ $# -ge 1 ] && shift
-other_args="$*"
-
-case "$cmd" in
-  'start')
-	sanity_checks;
-	# Start daemon
-	log_daemon_msg "Starting MySQL database server" "mysqld"
-	if mysqld_status check_alive nowarn; then
-	   log_progress_msg "already running"
-	   log_end_msg 0
-	else
-	    # Could be removed during boot
-	    test -e /var/run/mysqld || install -m 755 -o mysql -g root -d /var/run/mysqld
-
-	    # Check for additional wsrep options
-	    WSREP_OPTS=${WSREP_OPTS:-""}
-	    WSREP_PROVIDER=${WSREP_PROVIDER:-""}
-	    WSREP_CLUSTER_ADDRESS=${WSREP_CLUSTER_ADDRESS:-""}
-	    test -n "$WSREP_PROVIDER" && \
-	    WSREP_OPTS="$WSREP_OPTS --wsrep_provider=$WSREP_PROVIDER"
-	    test -n "$WSREP_CLUSTER_ADDRESS" && \
-	    WSREP_OPTS="$WSREP_OPTS --wsrep_cluster_address=$WSREP_CLUSTER_ADDRESS"
-
-	    # Start MySQL!.
-	    /usr/bin/mysqld_safe $WSREP_OPTS $other_args > /dev/null 2>&1 &
-
-	    # 6s was reported in #352070 to be too few when using ndbcluster
-	    for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14; do
-                sleep 1
-	        if mysqld_status check_alive nowarn ; then break; fi
-		log_progress_msg "."
-	    done
-	    if mysqld_status check_alive warn; then
-                log_end_msg 0
-	        # Now start mysqlcheck or whatever the admin wants.
-#	        output=$(/etc/mysql/debian-start)
-#		[ -n "$output" ] && log_action_msg "$output"
-	    else
-	        log_end_msg 1
-		log_failure_msg "Please take a look at the syslog"
-	    fi
-	fi
-	;;
-
-  'stop')
-	# * As a passwordless mysqladmin (e.g. via ~/.my.cnf) must be possible
-	# at least for cron, we can rely on it here, too. (although we have 
-	# to specify it explicit as e.g. sudo environments points to the normal
-	# users home and not /root)
-	log_daemon_msg "Stopping MySQL database server" "mysqld"
-	if ! mysqld_status check_dead nowarn; then
-	  log_daemon_msg "Killing MySQL database server by signal" "mysqld"
-          pid=$(cat $pidfile || echo 0)
-          if [ $pid -eq 0 ]; then
-            log_failure_msg "Failed to get MySQL server pid"
-            exit 1
-          fi
-	  kill -15 $pid
-          server_down=
-	  for i in 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15; do
-            log_progress_msg "."
-            sleep 1
-            if mysqld_status check_dead nowarn; then server_down=1; break; fi
-          done
-        fi
-
-        if ! mysqld_status check_dead warn; then
-	  log_end_msg 1
-	  log_failure_msg "Please stop MySQL manually and read /usr/share/doc/mysql-server-5.1/README.Debian.gz!"
-	  exit -1
-	else
-	  log_end_msg 0
-        fi
-	;;
-
-  'restart')
-	set +e; $SELF stop; set -e
-	$SELF start $other_args
-	;;
-
-  'reload'|'force-reload')
-	log_daemon_msg "Reloading MySQL database server" "mysqld"
-	$MYADMIN reload
-	log_end_msg 0
-	;;
-
-  'status')
-	if mysqld_status check_alive nowarn; then
-#	  log_action_msg "$($MYADMIN version)"
-	  log_action_msg "MySQL is running (PID: $(cat $pidfile))"
-	else
-	  log_action_msg "MySQL is stopped."
-	  exit 3
-	fi
-	;;
-
-  *)
-	echo "Usage: $SELF start|stop|restart|reload|force-reload|status"
-	exit 1
-	;;
-esac
-
diff --git a/galera/map.jinja b/galera/map.jinja
index 2e22de6..6894a3d 100644
--- a/galera/map.jinja
+++ b/galera/map.jinja
@@ -1,7 +1,7 @@
 
 {%- set master = salt['grains.filter_by']({
   'Debian': {
-    'pkgs': ['mysql-server-wsrep', 'galera', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup-21', 'socat'],
+    'pkgs': ['mysql-server-wsrep-5.6', 'galera-3', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup', 'socat'],
     'service': 'mysql',
     'wsrep_provider': '/usr/lib/galera/libgalera_smm.so',
     'log_file': '/var/log/mysql.log',
@@ -21,7 +21,7 @@
 
 {%- set slave = salt['grains.filter_by']({
   'Debian': {
-    'pkgs': ['mysql-server-wsrep', 'galera', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup-21', 'socat'],
+    'pkgs': ['mysql-server-wsrep', 'galera', 'rsync', 'python-mysqldb', 'libmysqlclient18', 'psmisc', 'netcat', 'percona-xtrabackup', 'socat'],
     'service': 'mysql',
     'wsrep_provider': '/usr/lib/galera/libgalera_smm.so',
     'log_file': '/var/log/mysql.log',
diff --git a/galera/master.sls b/galera/master.sls
index ddd432a..58b0a89 100644
--- a/galera/master.sls
+++ b/galera/master.sls
@@ -44,16 +44,24 @@
   - group: root
   - require:
     - pkg: galera_packages
-{%- endif %}
 
-galera_init_script:
-  file.managed:
-  - name: /etc/init.d/mysql
-  - source: salt://galera/files/mysql
-  - mode: 755
+galera_purge_init:
+  file.absent:
+  - name: /etc/init/mysql.conf
   - require: 
     - pkg: galera_packages
 
+galera_conf_debian:
+  file.managed:
+  - name: /etc/mysql/debian.cnf
+  - template: jinja
+  - source: salt://galera/files/debian.cnf
+  - mode: 640
+  - require:
+    - pkg: galera_packages
+
+{%- endif %} 
+
 galera_bootstrap_script:
   file.managed:
   - name: /usr/local/sbin/galera_bootstrap.sh
@@ -63,21 +71,10 @@
 
 {%- if salt['cmd.run']('test -e /var/lib/mysql/.galera_bootstrap; echo $?') != '0'  %}
 
-galera_bootstrap_temp_config:
-  file.managed:
-  - name: {{ master.config }}
-  - source: salt://galera/files/my.cnf.bootstrap
-  - mode: 644
-  - template: jinja
-  - require: 
-    - pkg: galera_packages
-    - file: galera_init_script
-
 galera_bootstrap_start_service:
   cmd.run:
   - name: /usr/local/sbin/galera_bootstrap.sh
   - require:
-    - file: galera_bootstrap_temp_config
     - file: galera_run_dir
     - file: galera_bootstrap_script
 
diff --git a/galera/slave.sls b/galera/slave.sls
index d461245..4a47c0c 100644
--- a/galera/slave.sls
+++ b/galera/slave.sls
@@ -44,16 +44,24 @@
   - group: root
   - require:
     - pkg: galera_packages
-{%- endif %}
 
-galera_init_script:
-  file.managed:
-  - name: /etc/init.d/mysql
-  - source: salt://galera/files/mysql
-  - mode: 755
-  - require: 
+galera_purge_init:
+  file.absent:
+  - name: /etc/init/mysql.conf
+  - require:
     - pkg: galera_packages
 
+galera_conf_debian:
+  file.managed:
+  - name: /etc/mysql/debian.cnf
+  - template: jinja
+  - source: salt://galera/files/debian.cnf
+  - mode: 640
+  - require:
+    - pkg: galera_packages
+
+{%- endif %}
+
 galera_bootstrap_script:
   file.managed:
   - name: /usr/local/sbin/galera_bootstrap.sh
@@ -63,21 +71,10 @@
 
 {%- if salt['cmd.run']('test -e /var/lib/mysql/.galera_bootstrap; echo $?') != '0'  %}
 
-galera_bootstrap_temp_config:
-  file.managed:
-  - name: {{ slave.config }}
-  - source: salt://galera/files/my.cnf.bootstrap
-  - mode: 644
-  - template: jinja
-  - require: 
-    - pkg: galera_packages
-    - file: galera_init_script
-
 galera_bootstrap_start_service:
   cmd.run:
   - name: /usr/local/sbin/galera_bootstrap.sh
   - require: 
-    - file: galera_bootstrap_temp_config
     - file: galera_run_dir
     - file: galera_bootstrap_script
 
diff --git a/metadata.yml b/metadata.yml
index 309ec2b..2b94052 100644
--- a/metadata.yml
+++ b/metadata.yml
@@ -1,5 +1,5 @@
 name: "galera"
-version: "0.2"
+version: "1.0"
 source: "https://github.com/tcpcloud/salt-formula-galera"
 dependencies:
 - name: mysql