feat: add official repository
This commit is contained in:
parent
a9d589e40d
commit
0c5cd7d681
8 changed files with 40 additions and 13 deletions
|
@ -17,7 +17,7 @@ provisioner:
|
||||||
platforms:
|
platforms:
|
||||||
- name: debian-9
|
- name: debian-9
|
||||||
driver_config:
|
driver_config:
|
||||||
image: "nishiki/debian9:ansible-<%= ENV['ANSIBLE_VERSION'] ? ENV['ANSIBLE_VERSION'] : '2.7' %>"
|
image: "nishiki/debian9:ansible-<%= ENV['ANSIBLE_VERSION'] ? ENV['ANSIBLE_VERSION'] : '2.8' %>"
|
||||||
command: /bin/systemd
|
command: /bin/systemd
|
||||||
volume:
|
volume:
|
||||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||||
|
|
|
@ -3,8 +3,7 @@ sudo: required
|
||||||
language: ruby
|
language: ruby
|
||||||
|
|
||||||
env:
|
env:
|
||||||
- ANSIBLE_VERSION=2.6
|
- ANSIBLE_VERSION=2.8
|
||||||
- ANSIBLE_VERSION=2.7
|
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- docker
|
- docker
|
||||||
|
|
|
@ -4,14 +4,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
||||||
Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
Which is based on [Keep A Changelog](http://keepachangelog.com/)
|
||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
- breaking: remove support for ansible 2.5
|
|
||||||
|
- breaking: remove support for ansible < 2.8
|
||||||
|
- feat: add official repository
|
||||||
- feat: remove unused users in init
|
- feat: remove unused users in init
|
||||||
- feat: install database if datadir doesn't exist
|
- feat: install database if datadir doesn't exist
|
||||||
|
|
||||||
## [v1.0.1] - 2019-03-16
|
## [v1.0.1] - 2019-03-16
|
||||||
|
|
||||||
- fix: add client-server option in default configuration
|
- fix: add client-server option in default configuration
|
||||||
- fix: install python-mysqldb package
|
- fix: install python-mysqldb package
|
||||||
- test: add tests with travis-ci
|
- test: add tests with travis-ci
|
||||||
|
|
||||||
## [v1.0.0] - 2019-02-23
|
## [v1.0.0] - 2019-02-23
|
||||||
|
|
||||||
- first version
|
- first version
|
||||||
|
|
18
README.md
18
README.md
|
@ -1,4 +1,5 @@
|
||||||
# Ansible role: MariaDB
|
# Ansible role: MariaDB
|
||||||
|
|
||||||
[![Version](https://img.shields.io/badge/latest_version-1.0.1-green.svg)](https://git.yaegashi.fr/nishiki/ansible-role-mariadb/releases)
|
[![Version](https://img.shields.io/badge/latest_version-1.0.1-green.svg)](https://git.yaegashi.fr/nishiki/ansible-role-mariadb/releases)
|
||||||
[![Build Status](https://travis-ci.org/nishiki/ansible-role-mariadb.svg?branch=master)](https://travis-ci.org/nishiki/ansible-role-mariadb)
|
[![Build Status](https://travis-ci.org/nishiki/ansible-role-mariadb.svg?branch=master)](https://travis-ci.org/nishiki/ansible-role-mariadb)
|
||||||
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://git.yaegashi.fr/nishiki/ansible-role-mariadb/src/branch/master/LICENSE)
|
[![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](https://git.yaegashi.fr/nishiki/ansible-role-mariadb/src/branch/master/LICENSE)
|
||||||
|
@ -12,11 +13,13 @@ Install and configure MariaDB
|
||||||
|
|
||||||
## Role variables
|
## Role variables
|
||||||
|
|
||||||
- `mariadb_user` - login to connect on mariadb (default: `root`)
|
* `mariadb_use_official_repository` - use the official repository (default: `yes`)
|
||||||
- `mariadb_password` - password to connect on mariadb (default: `secret`)
|
* `mariadb_branch` - the branch version to install (default: `10.3`)
|
||||||
- `mariadb_master` - the server is master (default: `no`)
|
* `mariadb_user` - login to connect on mariadb (default: `root`)
|
||||||
- `mariadb_autorestart` - restart mariadb when the config change (default: `no`)
|
* `mariadb_password` - password to connect on mariadb (default: `secret`)
|
||||||
- `mariadb_users` - array with the users to manage
|
* `mariadb_master` - the server is master (default: `no`)
|
||||||
|
* `mariadb_autorestart` - restart mariadb when the config change (default: `no`)
|
||||||
|
* `mariadb_users` - array with the users to manage
|
||||||
|
|
||||||
```
|
```
|
||||||
- name: johndoe
|
- name: johndoe
|
||||||
|
@ -26,14 +29,14 @@ Install and configure MariaDB
|
||||||
state: present
|
state: present
|
||||||
```
|
```
|
||||||
|
|
||||||
- `mariadb_databases` - array with the databases to manage
|
* `mariadb_databases` - array with the databases to manage
|
||||||
|
|
||||||
```
|
```
|
||||||
- name: superprogram
|
- name: superprogram
|
||||||
state: present
|
state: present
|
||||||
```
|
```
|
||||||
|
|
||||||
- `mariadb_config` - hash with mariadb configuration
|
* `mariadb_config` - hash with mariadb configuration
|
||||||
|
|
||||||
```
|
```
|
||||||
mysqld:
|
mysqld:
|
||||||
|
@ -50,6 +53,7 @@ Install and configure MariaDB
|
||||||
```
|
```
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
### Test syntax with yamllint
|
### Test syntax with yamllint
|
||||||
|
|
||||||
* install `python` and `python-pip`
|
* install `python` and `python-pip`
|
||||||
|
|
|
@ -1,4 +1,10 @@
|
||||||
---
|
---
|
||||||
|
mariadb_use_official_repository: yes
|
||||||
|
mariadb_branch: 10.3
|
||||||
|
mariadb_repository: |
|
||||||
|
deb http://mariadb.mirrors.ovh.net/MariaDB/repo/{{ mariadb_branch }}/debian {{ ansible_distribution_release }} main
|
||||||
|
mariadb_repository_key_id: '0xF1656F24C74CD1D8'
|
||||||
|
mariadb_repository_key_server: keyserver.ubuntu.com
|
||||||
mariadb_user: root
|
mariadb_user: root
|
||||||
mariadb_password: secret
|
mariadb_password: secret
|
||||||
mariadb_master: no
|
mariadb_master: no
|
||||||
|
|
|
@ -1,4 +1,7 @@
|
||||||
---
|
---
|
||||||
|
- import_tasks: repo.yml
|
||||||
|
when: mariadb_use_official_repository|bool
|
||||||
|
|
||||||
- name: install package
|
- name: install package
|
||||||
package:
|
package:
|
||||||
name: '{{ packages }}'
|
name: '{{ packages }}'
|
||||||
|
@ -14,7 +17,7 @@
|
||||||
- name: copy configuration file
|
- name: copy configuration file
|
||||||
template:
|
template:
|
||||||
src: my.cnf.j2
|
src: my.cnf.j2
|
||||||
dest: /etc/mysql/mariadb.cnf
|
dest: /etc/mysql/my.cnf
|
||||||
owner: root
|
owner: root
|
||||||
group: root
|
group: root
|
||||||
mode: 0644
|
mode: 0644
|
||||||
|
|
11
tasks/repo.yml
Normal file
11
tasks/repo.yml
Normal file
|
@ -0,0 +1,11 @@
|
||||||
|
---
|
||||||
|
- name: add gpg key for mariadb repository
|
||||||
|
apt_key:
|
||||||
|
keyserver: '{{ mariadb_repository_key_server }}'
|
||||||
|
id: '{{ mariadb_repository_key_id }}'
|
||||||
|
tags: mariadb
|
||||||
|
|
||||||
|
- name: add official repo
|
||||||
|
apt_repository:
|
||||||
|
repo: '{{ mariadb_repository }}'
|
||||||
|
tags: mariadb
|
|
@ -23,7 +23,7 @@ describe file('/opt/mariadb') do
|
||||||
it { should be_grouped_into 'root' }
|
it { should be_grouped_into 'root' }
|
||||||
end
|
end
|
||||||
|
|
||||||
describe file('/etc/mysql/mariadb.cnf') do
|
describe file('/etc/mysql/my.cnf') do
|
||||||
it { should be_file }
|
it { should be_file }
|
||||||
it { should be_mode 644 }
|
it { should be_mode 644 }
|
||||||
it { should be_owned_by 'root' }
|
it { should be_owned_by 'root' }
|
||||||
|
|
Loading…
Reference in a new issue