Skip to content

Instantly share code, notes, and snippets.

@gpkvt
gpkvt / init.sls
Last active January 11, 2020 22:55
SaltStack: MySQL-Replication (Slave-Info)
{% set query = [] %}
{% if not salt['mysql.get_slave_status']()['Master_Host'] %}
{% for host, hostinfo in salt['mine.get']("*.mysql_master?.de", 'grains.items').items() %}
{% if hostinfo['cluster'] == "active" and hostinfo['host'] == salt['grains.get']('host') %}
{% do query.append(salt['mine.get'](hostinfo['fqdn'], 'mysql.get_master_status')[hostinfo['fqdn']]) %}
{% do query.append(salt['grains.get']('ipv4')[0].split('.')[-1]) %}
{% endif %}
{% endfor %}
{% set doquery = "CHANGE MASTER TO MASTER_HOST='192.168.0."+ query[1] +"', MASTER_USER='repl', MASTER_PASSWORD='foobar', MASTER_LOG_FILE='"+ query[0]['File'] +"', MASTER_LOG_POS="+ query[0]['Position']|string +";" %}
@gpkvt
gpkvt / init.sls
Last active April 25, 2022 13:09
SaltStack: Install VirtualBox with ExtensionPack
# This state installs VirtualBox with Extpack
#
# To reinstall the extpack simply delete /srv/*.vbox-extpack
# To update the extpack it's important to keep the original download name otherwise install will fail
{% set extpack = 'Oracle_VM_VirtualBox_Extension_Pack-4.3.10.vbox-extpack' %}
vbox_repo:
pkgrepo.managed:
- name: deb http://download.virtualbox.org/virtualbox/debian wheezy contrib non-free
@gpkvt
gpkvt / config.php
Last active September 16, 2017 03:23
SaltStack: Install phpVirtualBox
<?php
class phpVBoxConfig {
/* Username / Password for system user that runs VirtualBox */
var $username = 'vbox';
var $password = 'CHANGE_ME';
/* SOAP URL of vboxwebsrv (not phpVirtualBox's URL) */
var $location = 'http://localhost:18083/';