Skip to content

Commit

Permalink
Merge pull request #13 from Oefenweb/pr-11
Browse files Browse the repository at this point in the history
Add support Percona Client 8.0
  • Loading branch information
tersmitten authored Mar 22, 2023
2 parents 396e558 + a40a427 commit 7789066
Show file tree
Hide file tree
Showing 13 changed files with 58 additions and 26 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
---
warn_list:
- role-name
- name[play]
- name[casing]
7 changes: 3 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@ jobs:
python-version: '3.x'

- name: Install test dependencies
run: pip install ansible-lint[community,yamllint]
run: |
pip install ansible-lint
ansible-galaxy install -r requirements.yml
- name: Lint code
run: |
Expand All @@ -43,11 +45,8 @@ jobs:
matrix:
include:
- distro: debian8
ansible-version: '<2.10'
- distro: debian9
- distro: debian10
- distro: ubuntu1604
ansible-version: '>=2.9, <2.10'
- distro: ubuntu1604
ansible-version: '>=2.10, <2.11'
- distro: ubuntu1604
Expand Down
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
FROM ubuntu:16.04
FROM ubuntu:18.04
MAINTAINER Mischa ter Smitten <[email protected]>

ENV LANG C.UTF-8
ENV LC_ALL C.UTF-8

# python
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python-minimal python-dev curl && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python3-minimal python3-dev curl && \
apt-get clean
RUN curl -sL https://bootstrap.pypa.io/pip/2.7/get-pip.py | python -
RUN curl -sL https://bootstrap.pypa.io/pip/3.6/get-pip.py | python3 -
RUN rm -rf $HOME/.cache

# ansible
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc libffi-dev libssl-dev && \
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y python3-apt && \
apt-get clean
RUN pip install ansible==2.9.15
RUN pip3 install ansible==2.10.7
RUN rm -rf $HOME/.cache

# provision
Expand Down
2 changes: 1 addition & 1 deletion meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ galaxy_info:
company: Oefenweb.nl B.V.
description: Set up percona-server client in Debian-like systems
license: MIT
min_ansible_version: 2.9.0
min_ansible_version: 2.10.0
platforms:
- name: Ubuntu
versions:
Expand Down
6 changes: 6 additions & 0 deletions molecule/default/collections.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
collections:
- name: community.docker
version: '>=1.2.0,<2'
- name: community.general
version: '>=2,<3'
4 changes: 3 additions & 1 deletion molecule/default/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ platforms:
image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1604}-ansible:latest"
command: ${MOLECULE_DOCKER_COMMAND:-""}
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
- /sys/fs/cgroup:/sys/fs/cgroup:rw
- /var/lib/containerd
cgroupns_mode: host
privileged: true
pre_build_image: true
provisioner:
Expand Down
3 changes: 3 additions & 0 deletions requirements.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# requirements file
---
collections: []
4 changes: 2 additions & 2 deletions tasks/configure.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: configure | copy certificate files
copy:
ansible.builtin.copy:
src: "{{ item.value.src }}"
dest: "{{ item.value.dest }}"
owner: "{{ item.value.owner | default('root') }}"
Expand All @@ -12,7 +12,7 @@
- percona-client-configure-copy-certificate-files

- name: configure | update (user) configuration file(s)
template:
ansible.builtin.template:
src: root/.my.cnf.j2
dest: "{{ item.dest | default('~' + item.owner + '/.my.cnf') }}"
owner: "{{ item.owner }}"
Expand Down
4 changes: 2 additions & 2 deletions tasks/install.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# tasks file
---
- name: install | dependencies
apt:
ansible.builtin.apt:
name: "{{ percona_client_dependencies }}"
state: "{{ apt_install_state | default('latest') }}"
tags:
- percona-client-install-dependencies

- name: install | additional
apt:
ansible.builtin.apt:
name: "{{ percona_client_install }}"
state: "{{ apt_install_state | default('latest') }}"
tags:
Expand Down
12 changes: 8 additions & 4 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
# tasks file
---
- include: version-support.yml
- name: version support
ansible.builtin.import_tasks: version-support.yml
tags:
- configuration
- percona-client
- percona-client-version-support

- include: repository.yml
- name: repository
ansible.builtin.import_tasks: repository.yml
tags:
- configuration
- percona-client
- percona-client-repository

- include: install.yml
- name: install
ansible.builtin.import_tasks: install.yml
tags:
- configuration
- percona-client
- percona-client-install

- include: configure.yml
- name: configure
ansible.builtin.import_tasks: configure.yml
tags:
- configuration
- percona-client
Expand Down
8 changes: 4 additions & 4 deletions tasks/repository.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: repository | install | dependencies (pre)
apt:
ansible.builtin.apt:
name: "{{ percona_client_dependencies_pre }}"
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
Expand All @@ -11,15 +11,15 @@
- percona-client-repository-install-dependencies

- name: repository | add public key
apt_key:
ansible.builtin.apt_key:
id: 9334A25F8507EFA5
keyserver: keyserver.ubuntu.com
state: present
tags:
- percona-client-repository-public-key

- name: repository | add
apt_repository:
ansible.builtin.apt_repository:
repo: "{{ item.type }} {{ item.url }} {{ item.component }}"
state: present
update_cache: true
Expand All @@ -28,7 +28,7 @@
- percona-client-repository-add

- name: repository | apt-pin packages
copy:
ansible.builtin.copy:
src: etc/apt/preferences.d/00percona.pref
dest: /etc/apt/preferences.d/00percona.pref
owner: root
Expand Down
2 changes: 1 addition & 1 deletion tasks/version-support.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# tasks file
---
- name: version support | check
fail:
ansible.builtin.fail:
msg: "Percona client version {{ percona_client_version }} is not supported"
when: percona_client_version | string not in percona_client_versions_supported
tags:
Expand Down
18 changes: 16 additions & 2 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,32 @@ percona_client_versions_supported:
- '5.5'
- '5.6'
- '5.7'
- '8.0'

percona_client_repositories:
percona_client_repositories_5:
- type: deb
url: "http://repo.percona.com/apt {{ ansible_distribution_release }}"
component: main
- type: deb-src
url: "http://repo.percona.com/apt {{ ansible_distribution_release }}"
component: main

percona_client_repositories_8:
- type: deb
url: "http://repo.percona.com/ps-80/apt {{ ansible_distribution_release }}"
component: main
- type: deb-src
url: "http://repo.percona.com/ps-80/apt {{ ansible_distribution_release }}"
component: main

percona_client_repositories: "{{ percona_client_repositories_8 if percona_client_version is version('8.0', '==') else percona_client_repositories_5 }}"

percona_client_version_deb_prefix: "-{{ percona_client_version }}"
percona_client_version_deb: "{{ '' if percona_client_version is version('8.0', '==') else percona_client_version_deb_prefix }}"

percona_client_dependencies_pre:
- software-properties-common
- dirmngr

percona_client_dependencies:
- "percona-server-client-{{ percona_client_version }}"
- "percona-server-client{{ percona_client_version_deb }}"

0 comments on commit 7789066

Please sign in to comment.