Skip to content

Instantly share code, notes, and snippets.

@Synforge
Last active August 29, 2015 13:57
Show Gist options
  • Save Synforge/9665085 to your computer and use it in GitHub Desktop.
Save Synforge/9665085 to your computer and use it in GitHub Desktop.
---
#file: example.mysql/defaults/main.yml
mysql_options:
#General
user: mysql
port: 3306
default_storage_engine: InnoDB
socket: /var/lib/mysql/mysql.sock
pid_file: /var/run/mysqld/mysql.pid
server_id: 1
#file: example.mysql/templates/my.cnf.j2
[mysqld]
# General
port = {{ mysql_options['port'] }}
user = {{ mysql_options['user'] }}
default_storage_engine = {{ mysql_options['default_storage_engine'] }}
socket = {{ mysql_options['socket'] }}
pid-file = {{ mysql_options['pid_file'] }}
server-id = {{ mysql_options['server_id'] }}
# Truncated

— #file: host_vars/mysql-master-1.example.org mysql_opts: server_id: 2

---
#file: mysql_master.yml
- hosts: mysql_master
roles:
- role: example.mysql
mysql_options: "{{mysql_opts}}"
tags: ['mysql']
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment