Skip to content

Commit 22c390e

Browse files
committed
Merge remote-tracking branch 'upstream/master' into mode
2 parents 0885b75 + 86ffba8 commit 22c390e

File tree

15 files changed

+135
-69
lines changed

15 files changed

+135
-69
lines changed

.ansible-lint

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
skip_list:
2-
- '204'
2+
- 'yaml'
3+
- 'role-name'

.github/workflows/ci.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
---
2+
name: CI
3+
'on':
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
schedule:
9+
- cron: "0 1 * * 3"
10+
11+
defaults:
12+
run:
13+
working-directory: 'geerlingguy.mysql'
14+
15+
jobs:
16+
17+
lint:
18+
name: Lint
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Check out the codebase.
22+
uses: actions/checkout@v2
23+
with:
24+
path: 'geerlingguy.mysql'
25+
26+
- name: Set up Python 3.
27+
uses: actions/setup-python@v2
28+
with:
29+
python-version: '3.x'
30+
31+
- name: Install test dependencies.
32+
run: pip3 install yamllint
33+
34+
- name: Lint code.
35+
run: |
36+
yamllint .
37+
38+
molecule:
39+
name: Molecule
40+
runs-on: ubuntu-latest
41+
strategy:
42+
matrix:
43+
distro:
44+
- centos8
45+
- centos7
46+
- ubuntu1804
47+
- debian10
48+
49+
steps:
50+
- name: Check out the codebase.
51+
uses: actions/checkout@v2
52+
with:
53+
path: 'geerlingguy.mysql'
54+
55+
- name: Set up Python 3.
56+
uses: actions/setup-python@v2
57+
with:
58+
python-version: '3.x'
59+
60+
- name: Install test dependencies.
61+
run: pip3 install ansible molecule[docker] docker
62+
63+
# See: https://github.com/geerlingguy/ansible-role-mysql/issues/422
64+
- name: Disable AppArmor on Debian.
65+
run: |
66+
set -x
67+
sudo apt-get install apparmor-profiles
68+
sudo ln -s /etc/apparmor.d/usr.sbin.mysqld /etc/apparmor.d/disable/
69+
sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
70+
if: ${{ startsWith(matrix.distro, 'debian') }}
71+
72+
- name: Run Molecule tests.
73+
run: molecule test
74+
env:
75+
PY_COLORS: '1'
76+
ANSIBLE_FORCE_COLOR: '1'
77+
MOLECULE_DISTRO: ${{ matrix.distro }}

.github/workflows/release.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
---
2+
# This workflow requires a GALAXY_API_KEY secret present in the GitHub
3+
# repository or organization.
4+
#
5+
# See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy
6+
# See: https://github.com/ansible/galaxy/issues/46
7+
8+
name: Release
9+
'on':
10+
push:
11+
tags:
12+
- '*'
13+
14+
defaults:
15+
run:
16+
working-directory: 'geerlingguy.mysql'
17+
18+
jobs:
19+
20+
release:
21+
name: Release
22+
runs-on: ubuntu-latest
23+
steps:
24+
- name: Check out the codebase.
25+
uses: actions/checkout@v2
26+
with:
27+
path: 'geerlingguy.mysql'
28+
29+
- name: Set up Python 3.
30+
uses: actions/setup-python@v2
31+
with:
32+
python-version: '3.x'
33+
34+
- name: Install Ansible.
35+
run: pip3 install ansible-base
36+
37+
- name: Trigger a new import on Galaxy.
38+
run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2)

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
*.retry
22
*/__pycache__
33
*.pyc
4+
.cache

.travis.yml

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

.yamllint

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
---
22
extends: default
3+
34
rules:
45
line-length:
56
max: 160
67
level: warning
8+
9+
ignore: |
10+
.github/stale.yml

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Ansible Role: MySQL
22

3-
[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-mysql.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-mysql)
3+
[![CI](https://github.com/geerlingguy/ansible-role-mysql/workflows/CI/badge.svg?event=push)](https://github.com/geerlingguy/ansible-role-mysql/actions?query=workflow%3ACI)
44

55
Installs and configures MySQL or MariaDB server on RHEL/CentOS or Debian/Ubuntu servers.
66

@@ -84,9 +84,9 @@ The formats of these are the same as in the `mysql_user` module.
8484

8585
(RedHat/CentOS only) If you have enabled any additional repositories (might I suggest geerlingguy.repo-epel or geerlingguy.repo-remi), those repositories can be listed under this variable (e.g. `remi,epel`). This can be handy, as an example, if you want to install later versions of MySQL.
8686

87-
mysql_python_package_debian: ''
87+
mysql_python_package_debian: python3-mysqldb
8888

89-
(Ubuntu/Debian only) If you need to explicitly set the MySQL Python package, you can set it here. If not set, it will default to `python-mysqldb` for Python 2 and `python3-mysqldb` for Python 3.
89+
(Ubuntu/Debian only) If you need to explicitly override the MySQL Python package, you can set it here. Set this to `python-mysqldb` if using older distributions running Python 2.
9090

9191
mysql_port: "3306"
9292
mysql_bind_address: '0.0.0.0'

defaults/main.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ mysql_enablerepo: ""
3434
# - mysql-server
3535
# - MySQL-python
3636

37+
mysql_python_package_debian: python3-mysqldb
38+
3739
# MySQL connection settings.
3840
mysql_port: "3306"
3941
mysql_bind_address: '0.0.0.0'

meta/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
dependencies: []
33

44
galaxy_info:
5+
role_name: mysql
56
author: geerlingguy
67
description: MySQL server for RHEL/CentOS and Debian/Ubuntu.
78
company: "Midwestern Mac, LLC"
@@ -10,7 +11,6 @@ galaxy_info:
1011
platforms:
1112
- name: EL
1213
versions:
13-
- 6
1414
- 7
1515
- 8
1616
- name: Ubuntu

molecule/default/converge.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,6 @@
33
hosts: all
44
become: true
55

6-
vars:
7-
mysql_python_package_debian: python3-mysqldb
8-
96
roles:
107
- role: geerlingguy.mysql
118

molecule/default/molecule.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ dependency:
33
name: galaxy
44
driver:
55
name: docker
6-
lint: |
7-
set -e
8-
yamllint .
9-
ansible-lint
106
platforms:
117
- name: instance
128
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"

tasks/replication.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
when:
1010
- mysql_replication_role == 'master'
1111
- mysql_replication_user.name is defined
12-
- mysql_replication_master | default(false)
12+
- (mysql_replication_master | length) > 0
1313
tags: ['skip_ansible_galaxy']
1414

1515
- name: Check slave replication status.
@@ -21,7 +21,7 @@
2121
register: slave
2222
when:
2323
- mysql_replication_role == 'slave'
24-
- mysql_replication_master | default(false)
24+
- (mysql_replication_master | length) > 0
2525
tags: ['skip_ansible_galaxy']
2626

2727
- name: Check master replication status.
@@ -31,7 +31,7 @@
3131
when:
3232
- (slave.Is_Slave is defined and not slave.Is_Slave) or (slave.Is_Slave is not defined and slave is failed)
3333
- mysql_replication_role == 'slave'
34-
- mysql_replication_master | default(false)
34+
- (mysql_replication_master | length) > 0
3535
tags: ['skip_ansible_galaxy']
3636

3737
- name: Configure replication on the slave.
@@ -47,12 +47,12 @@
4747
- (slave.Is_Slave is defined and not slave.Is_Slave) or (slave.Is_Slave is not defined and slave is failed)
4848
- mysql_replication_role == 'slave'
4949
- mysql_replication_user.name is defined
50-
- mysql_replication_master | default(false)
50+
- (mysql_replication_master | length) > 0
5151

5252
- name: Start replication.
5353
mysql_replication: mode=startslave
5454
when:
5555
- (slave.Is_Slave is defined and not slave.Is_Slave) or (slave.Is_Slave is not defined and slave is failed)
5656
- mysql_replication_role == 'slave'
57-
- mysql_replication_master | default(false)
57+
- (mysql_replication_master | length) > 0
5858
tags: ['skip_ansible_galaxy']

tasks/secure-installation.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
shell: >
4444
mysql -u root -NBe
4545
'ALTER USER "{{ mysql_root_username }}"@"{{ item }}"
46-
IDENTIFIED WITH mysql_native_password BY "{{ mysql_root_password }}";'
46+
IDENTIFIED WITH mysql_native_password BY "{{ mysql_root_password }}"; FLUSH PRIVILEGES;'
4747
with_items: "{{ mysql_root_hosts.stdout_lines|default([]) }}"
4848
when: >
4949
((mysql_install_packages | bool) or mysql_root_password_update)
@@ -53,7 +53,7 @@
5353
- name: Update MySQL root password for localhost root account (< 5.7.x).
5454
shell: >
5555
mysql -NBe
56-
'SET PASSWORD FOR "{{ mysql_root_username }}"@"{{ item }}" = PASSWORD("{{ mysql_root_password }}");'
56+
'SET PASSWORD FOR "{{ mysql_root_username }}"@"{{ item }}" = PASSWORD("{{ mysql_root_password }}"); FLUSH PRIVILEGES;'
5757
with_items: "{{ mysql_root_hosts.stdout_lines|default([]) }}"
5858
when: >
5959
((mysql_install_packages | bool) or mysql_root_password_update)

tasks/setup-Debian.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,6 @@
77
apt: update_cache=yes
88
when: not mysql_installed.stat.exists
99

10-
- name: Determine required MySQL Python libraries.
11-
set_fact:
12-
mysql_python_package_debian: "{% if 'python3' in ansible_python_interpreter|default('') %}python3-mysqldb{% else %}python-mysqldb{% endif %}"
13-
when: mysql_python_package_debian is not defined
14-
1510
- name: Ensure MySQL Python libraries are installed.
1611
apt:
1712
name: "{{ mysql_python_package_debian }}"

vars/RedHat-6.yml

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

0 commit comments

Comments
 (0)