Skip to content
Extraits de code Groupes Projets
Valider 782951df rédigé par Fanch's avatar Fanch
Parcourir les fichiers

add first working version

parent
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
Ansible Archlinux Mariadb
============================
A role to set basic mariadb config
Tested and Used on ArchLinux but it Should work on any Linux
Dependencies
------------
[Requirements](molecule/default/requirements.yml)
Variables
---------
[Role Variables](defaults/main.yml)
Example Playbook
----------------
[Test Playbook](molecule/default/converge.yml)
License
-------
[License](LICENSE)
Todo
----
- Should use my own registry for molecule docker archlinux image
- Should manage mariadb upgrade
---
# defaults file for mariadb
mariadb_packages: ['mariadb']
mariadb_disable_tcp: true
---
# handlers file for mariadb
- name: Restart Service
ansible.builtin.service:
name: mariadb
state: restarted
galaxy_info:
author: Fanch The System
name: mariadb
description: Run mariadb on Archlinux
license: Apache 2.0
min_ansible_version: 2.9
platforms:
- name: Archlinux
versions:
- all
collections: []
dependencies: []
---
- name: Converge
hosts: all
tasks:
- name: "Include mariadb"
include_role:
name: "mariadb"
---
dependency:
name: galaxy
lint: |
yamllint .
ansible-lint
driver:
name: docker
platforms:
- name: archlinux-test
image: fanchthesystem/archlinux-systemd
privileged: true
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
command: "/sbin/init"
provisioner:
name: ansible
verifier:
name: ansible
---
# This is an example playbook to execute Ansible tests.
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: Example assertion
assert:
that: true
---
- name: Disable Network Access (use only socket)
lineinfile:
path: /etc/my.cnf.d/server.cnf
state: present
insertafter: '^\[mysqld\]'
regexp: '^skip-networking'
line: 'skip-networking'
notify: Restart Service
when: mariadb_disable_tcp
---
- name: Enable Mariadb
ansible.builtin.service:
name: mariadb
state: started
enabled: yes
---
- name: Init Database Cluster
command: |
mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql \
--skip-test-db \
--auth-root-authentication-method=socket
args:
creates: "/var/lib/mysql/*"
# mysql_secure_installation should not be need after 10.4
# https://mariadb.com/kb/en/authentication-from-mariadb-104/
# it look like --auth-root-authentication-method=socket is not the default
# and it imply the not existing option --skip-auth-anonymous-user
# SHOW DATABASES;
# SELECT Host,User,Password,plugin,authentication_string FROM mysql.user;
# SHOW GRANTS FOR ''@'localhost';
---
- name: Install Packages
ansible.builtin.package:
name: "{{ mariadb_packages }}"
state: present
---
# tasks file for mariadb
- name: Install Mariadb
include_tasks: install.yml
- name: Init Database
include_tasks: initdb.yml
- name: Local Config
include_tasks: conf.yml
- name: Enable Service
include_tasks: enable.yml
---
# vars file for mariadb
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter