Skip to content

Commit 2a13c42

Browse files
author
JvE
committed
Merge branch 'master' into 132-overridable-variables
# Conflicts: # .travis.yml # defaults/main.yml # vars/Debian.yml # vars/RedHat-6.yml # vars/RedHat-7.yml
2 parents 7ea3944 + ac4a277 commit 2a13c42

File tree

13 files changed

+76
-104
lines changed

13 files changed

+76
-104
lines changed

.travis.yml

Lines changed: 36 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -2,40 +2,43 @@
22
sudo: required
33

44
env:
5-
- distribution: centos
6-
version: 6
7-
init: /sbin/init
8-
run_opts: ""
9-
playbook: test.yml
10-
- distribution: centos
11-
version: 7
12-
init: /usr/lib/systemd/systemd
13-
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
14-
playbook: test.yml
15-
- distribution: ubuntu
16-
version: 14.04
17-
init: /sbin/init
18-
run_opts: ""
19-
playbook: test.yml
20-
# - distribution: ubuntu
21-
# version: 12.04
22-
# init: /sbin/init
23-
# run_opts: ""
24-
# playbook: test.yml
5+
global:
6+
# https://github.com/travis-ci/travis-ci/issues/6461#issuecomment-239577306
7+
DOCKER_VERSION: "1.9.1-0~trusty"
8+
matrix:
9+
- distro: centos7
10+
init: /usr/lib/systemd/systemd
11+
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
12+
playbook: centos-7-test.yml
13+
- distro: centos6
14+
init: /sbin/init
15+
run_opts: ""
16+
playbook: test.yml
17+
- distro: ubuntu1604
18+
init: /lib/systemd/systemd
19+
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
20+
playbook: test.yml
21+
- distro: ubuntu1404
22+
init: /sbin/init
23+
run_opts: ""
24+
playbook: test.yml
2525

2626
services:
2727
- docker
2828

2929
before_install:
30+
# Downgrade to older version of Docker engine.
31+
- sudo apt-get update
32+
- sudo apt-get remove docker-engine -yq
33+
- sudo apt-get install docker-engine=$DOCKER_VERSION -yq --no-install-suggests --no-install-recommends --force-yes -o Dpkg::Options::="--force-confnew"
34+
3035
# Pull container
31-
- 'sudo docker pull ${distribution}:${version}'
32-
# Customize container
33-
- 'sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests'
36+
- 'sudo docker pull geerlingguy/docker-${distro}-ansible:latest'
3437

3538
script:
3639
- container_id=$(mktemp)
3740
# Run container in detached state
38-
- 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"'
41+
- 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/role_under_test:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"'
3942

4043
# Ansible syntax check.
4144
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} --syntax-check'
@@ -44,8 +47,10 @@ script:
4447
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook}'
4548

4649
# Test role idempotence.
50+
- idempotence=$(mktemp)
51+
- sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook} | tee -a ${idempotence}
4752
- >
48-
sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/role_under_test/tests/${playbook}
53+
tail ${idempotence}
4954
| grep -q 'changed=0.*failed=0'
5055
&& (echo 'Idempotence test: pass' && exit 0)
5156
|| (echo 'Idempotence test: fail' && exit 1)
@@ -72,5 +77,11 @@ script:
7277
# Clean up
7378
- sudo docker stop "$(cat ${container_id})"
7479

80+
after_failure:
81+
# Check MySQL settings.
82+
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm cat /var/log/mysql/error.log'
83+
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm cat /var/log/mysql.err'
84+
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm cat /var/log/mysql.log'
85+
7586
notifications:
7687
webhooks: https://galaxy.ansible.com/api/v1/notifications/

README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,10 +91,11 @@ Slow query log settings. Note that the log file will be created by this role, bu
9191
mysql_table_open_cache: "256"
9292
[...]
9393

94-
The rest of the settings in `defaults/main.yml` control MySQL's memory usage. The default values are tuned for a server where MySQL can consume ~512 MB RAM, so you should consider adjusting them to suit your particular server better.
94+
The rest of the settings in `defaults/main.yml` control MySQL's memory usage and some other common settings. The default values are tuned for a server where MySQL can consume ~512 MB RAM, so you should consider adjusting them to suit your particular server better.
9595

9696
mysql_server_id: "1"
9797
mysql_max_binlog_size: "100M"
98+
mysql_binlog_format: "ROW"
9899
mysql_expire_logs_days: "10"
99100
mysql_replication_role: ''
100101
mysql_replication_master: ''
@@ -147,4 +148,4 @@ MIT / BSD
147148

148149
## Author Information
149150

150-
This role was created in 2014 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/).
151+
This role was created in 2014 by [Jeff Geerling](http://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).

defaults/main.yml

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ mysql_datadir: /var/lib/mysql
3737

3838
# Slow query log settings.
3939
mysql_slow_query_log_enabled: no
40-
mysql_slow_query_time: 2
40+
mysql_slow_query_time: "2"
4141
# The following variable has a default value depending on operating system.
4242
# mysql_slow_query_log_file: /var/log/mysql-slow.log
4343

@@ -51,20 +51,28 @@ mysql_read_rnd_buffer_size: "4M"
5151
mysql_myisam_sort_buffer_size: "64M"
5252
mysql_thread_cache_size: "8"
5353
mysql_query_cache_size: "16M"
54-
mysql_max_connections: 151
54+
mysql_query_cache_limit: "1M"
55+
mysql_max_connections: "151"
56+
mysql_tmp_table_size: "16M"
57+
mysql_max_heap_table_size: "16M"
5558

5659
# Other settings.
57-
mysql_wait_timeout: 28800
60+
mysql_lower_case_table_names: "0"
61+
mysql_wait_timeout: "28800"
5862

5963
# InnoDB settings.
60-
# Set .._buffer_pool_size up to 80% of RAM but beware of setting too high.
6164
mysql_innodb_file_per_table: "1"
65+
# Set .._buffer_pool_size up to 80% of RAM but beware of setting too high.
6266
mysql_innodb_buffer_pool_size: "256M"
6367
# Set .._log_file_size to 25% of buffer pool size.
6468
mysql_innodb_log_file_size: "64M"
6569
mysql_innodb_log_buffer_size: "8M"
6670
mysql_innodb_flush_log_at_trx_commit: "1"
67-
mysql_innodb_lock_wait_timeout: 50
71+
mysql_innodb_lock_wait_timeout: "50"
72+
73+
# These settings require MySQL > 5.5.
74+
mysql_innodb_large_prefix: "1"
75+
mysql_innodb_file_format: "barracuda"
6876

6977
# mysqldump settings.
7078
mysql_mysqldump_max_allowed_packet: "64M"
@@ -96,6 +104,7 @@ mysql_users: []
96104
# Replication settings (replication is only enabled if master/user have values).
97105
mysql_server_id: "1"
98106
mysql_max_binlog_size: "100M"
107+
mysql_binlog_format: "ROW"
99108
mysql_expire_logs_days: "10"
100109
mysql_replication_role: ''
101110
mysql_replication_master: ''

templates/my.cnf.j2

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ log_bin = mysql-bin
4040
log-bin-index = mysql-bin.index
4141
expire_logs_days = {{ mysql_expire_logs_days }}
4242
max_binlog_size = {{ mysql_max_binlog_size }}
43+
binlog_format = {{mysql_binlog_format}}
4344

4445
{% for db in mysql_databases %}
4546
{% if db.replicate|default(1) %}
@@ -76,12 +77,20 @@ read_rnd_buffer_size = {{ mysql_read_rnd_buffer_size }}
7677
myisam_sort_buffer_size = {{ mysql_myisam_sort_buffer_size }}
7778
thread_cache_size = {{ mysql_thread_cache_size }}
7879
query_cache_size = {{ mysql_query_cache_size }}
80+
query_cache_limit = {{ mysql_query_cache_limit }}
7981
max_connections = {{ mysql_max_connections }}
82+
tmp_table_size = {{ mysql_tmp_table_size }}
83+
max_heap_table_size = {{ mysql_max_heap_table_size }}
8084

8185
# Other settings.
8286
wait_timeout = {{ mysql_wait_timeout }}
87+
lower_case_table_names = {{ mysql_lower_case_table_names }}
8388

8489
# InnoDB settings.
90+
{% if mysql_supports_innodb_large_prefix %}
91+
innodb_large_prefix = {{ mysql_innodb_large_prefix }}
92+
innodb_file_format = {{ mysql_innodb_file_format }}
93+
{% endif %}
8594
innodb_file_per_table = {{ mysql_innodb_file_per_table }}
8695
innodb_buffer_pool_size = {{ mysql_innodb_buffer_pool_size }}
8796
innodb_log_file_size = {{ mysql_innodb_log_file_size }}
@@ -102,4 +111,3 @@ pid-file = {{ mysql_pid_file }}
102111
#
103112
!includedir {{ mysql_config_include_dir }}
104113
{% endif %}
105-

tests/Dockerfile.centos-6

Lines changed: 0 additions & 15 deletions
This file was deleted.

tests/Dockerfile.centos-7

Lines changed: 0 additions & 27 deletions
This file was deleted.

tests/Dockerfile.ubuntu-12.04

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/Dockerfile.ubuntu-14.04

Lines changed: 0 additions & 14 deletions
This file was deleted.

tests/inventory

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/test.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,15 @@
11
---
22
- hosts: all
3+
4+
pre_tasks:
5+
- name: Copy initctl_faker into place for Ubuntu 14.04.
6+
copy:
7+
src: initctl_faker
8+
dest: /sbin/initctl
9+
mode: 0755
10+
force: yes
11+
when: ansible_distribution == 'Ubuntu' and ansible_distribution_version == '14.04'
12+
changed_when: false
13+
314
roles:
415
- role_under_test

0 commit comments

Comments
 (0)