feat: add official repository

This commit is contained in:
Adrien Waksberg 2019-05-18 12:26:37 +02:00
parent a9d589e40d
commit 0c5cd7d681
8 changed files with 40 additions and 13 deletions

View file

@ -17,7 +17,7 @@ provisioner:
platforms:
- name: debian-9
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
volume:
- /sys/fs/cgroup:/sys/fs/cgroup:ro

View file

@ -3,8 +3,7 @@ sudo: required
language: ruby
env:
- ANSIBLE_VERSION=2.6
- ANSIBLE_VERSION=2.7
- ANSIBLE_VERSION=2.8
services:
- docker

View file

@ -4,14 +4,18 @@ This project adheres to [Semantic Versioning](http://semver.org/).
Which is based on [Keep A Changelog](http://keepachangelog.com/)
## [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: install database if datadir doesn't exist
## [v1.0.1] - 2019-03-16
- fix: add client-server option in default configuration
- fix: install python-mysqldb package
- test: add tests with travis-ci
## [v1.0.0] - 2019-02-23
- first version

View file

@ -1,4 +1,5 @@
# 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)
[![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)
@ -12,11 +13,13 @@ Install and configure MariaDB
## Role variables
- `mariadb_user` - login to connect on mariadb (default: `root`)
- `mariadb_password` - password to connect on mariadb (default: `secret`)
- `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
* `mariadb_use_official_repository` - use the official repository (default: `yes`)
* `mariadb_branch` - the branch version to install (default: `10.3`)
* `mariadb_user` - login to connect on mariadb (default: `root`)
* `mariadb_password` - password to connect on mariadb (default: `secret`)
* `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
@ -26,14 +29,14 @@ Install and configure MariaDB
state: present
```
- `mariadb_databases` - array with the databases to manage
* `mariadb_databases` - array with the databases to manage
```
- name: superprogram
state: present
```
- `mariadb_config` - hash with mariadb configuration
* `mariadb_config` - hash with mariadb configuration
```
mysqld:
@ -50,6 +53,7 @@ Install and configure MariaDB
```
## Development
### Test syntax with yamllint
* install `python` and `python-pip`

View file

@ -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_password: secret
mariadb_master: no

View file

@ -1,4 +1,7 @@
---
- import_tasks: repo.yml
when: mariadb_use_official_repository|bool
- name: install package
package:
name: '{{ packages }}'
@ -14,7 +17,7 @@
- name: copy configuration file
template:
src: my.cnf.j2
dest: /etc/mysql/mariadb.cnf
dest: /etc/mysql/my.cnf
owner: root
group: root
mode: 0644

11
tasks/repo.yml Normal file
View 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

View file

@ -23,7 +23,7 @@ describe file('/opt/mariadb') do
it { should be_grouped_into 'root' }
end
describe file('/etc/mysql/mariadb.cnf') do
describe file('/etc/mysql/my.cnf') do
it { should be_file }
it { should be_mode 644 }
it { should be_owned_by 'root' }