From f7d2c0a209276a3d2be24c050ca9e1989d2582b0 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Thu, 7 Jul 2022 11:42:17 +0200 Subject: [PATCH 1/2] Consistency changes --- Dockerfile | 13 ++++++++----- meta/main.yml | 5 ++--- molecule/default/collections.yml | 6 ++++++ requirements.yml | 3 +++ tasks/configure.yml | 2 +- tasks/install.yml | 2 +- tasks/jobs.yml | 2 +- tasks/main.yml | 10 +++++----- tasks/repository.yml | 8 ++++---- tasks/scripts.yml | 2 +- vars/main.yml | 4 ++-- 11 files changed, 34 insertions(+), 23 deletions(-) create mode 100644 molecule/default/collections.yml create mode 100644 requirements.yml diff --git a/Dockerfile b/Dockerfile index b179278..6ebe0c4 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,17 +1,20 @@ -FROM ubuntu:16.04 +FROM ubuntu:18.04 MAINTAINER Mischa ter Smitten +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 diff --git a/meta/main.yml b/meta/main.yml index b08a565..e512658 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,13 +1,12 @@ # meta file --- galaxy_info: - namespace: oefenweb + author: oefenweb role_name: percona_toolkit - author: Mischa ter Smitten company: Oefenweb.nl B.V. description: Manage percona-toolkit in Debian-like systems license: MIT - min_ansible_version: 2.9.0 + min_ansible_version: 2.10.0 platforms: - name: Ubuntu versions: diff --git a/molecule/default/collections.yml b/molecule/default/collections.yml new file mode 100644 index 0000000..c3d7e2a --- /dev/null +++ b/molecule/default/collections.yml @@ -0,0 +1,6 @@ +--- +collections: + - name: community.docker + version: '>=1.2.0,<2' + - name: community.general + version: '>=2,<3' diff --git a/requirements.yml b/requirements.yml new file mode 100644 index 0000000..3d5f1cd --- /dev/null +++ b/requirements.yml @@ -0,0 +1,3 @@ +# requirements file +--- +collections: [] diff --git a/tasks/configure.yml b/tasks/configure.yml index a000da1..39af857 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -1,7 +1,7 @@ # tasks file --- - name: configure | generate scripts - template: + ansible.builtin.template: src: "{{ item.lstrip('/') }}.j2" dest: "{{ item }}" owner: root diff --git a/tasks/install.yml b/tasks/install.yml index 203ec19..19b4f26 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -1,7 +1,7 @@ # tasks file --- - name: install | dependencies - apt: + ansible.builtin.apt: name: "{{ percona_toolkit_dependencies }}" state: "{{ apt_install_state | default('latest') }}" tags: diff --git a/tasks/jobs.yml b/tasks/jobs.yml index 26a5f97..928ec56 100644 --- a/tasks/jobs.yml +++ b/tasks/jobs.yml @@ -1,7 +1,7 @@ # tasks file --- - name: configure (cron) jobs - cron: + ansible.builtin.cron: name: "{{ item.name }}" job: "{{ item.job }}" state: "{{ item.state | default('present') }}" diff --git a/tasks/main.yml b/tasks/main.yml index 7d81df3..a8a42eb 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,30 +1,30 @@ # tasks file --- -- include: repository.yml +- ansible.builtin.include: repository.yml tags: - configuration - percona-toolkit - percona-toolkit-repository -- include: install.yml +- ansible.builtin.include: install.yml tags: - configuration - percona-toolkit - percona-toolkit-install -- include: configure.yml +- ansible.builtin.include: configure.yml tags: - configuration - percona-toolkit - percona-toolkit-configure -- include: scripts.yml +- ansible.builtin.include: scripts.yml tags: - configuration - percona-toolkit - percona-toolkit-scripts -- include: jobs.yml +- ansible.builtin.include: jobs.yml tags: - configuration - percona-toolkit diff --git a/tasks/repository.yml b/tasks/repository.yml index fcd944c..7b3c3f3 100644 --- a/tasks/repository.yml +++ b/tasks/repository.yml @@ -1,7 +1,7 @@ # tasks file --- - name: repository | install | dependencies (pre) - apt: + ansible.builtin.apt: name: "{{ percona_toolkit_dependencies_pre }}" state: "{{ apt_install_state | default('latest') }}" update_cache: true @@ -11,7 +11,7 @@ - percona-toolkit-repository-install-dependencies - name: repository | add public key - apt_key: + ansible.builtin.apt_key: id: 9334A25F8507EFA5 keyserver: keyserver.ubuntu.com state: present @@ -19,7 +19,7 @@ - percona-toolkit-repository-public-key - name: repository | add - apt_repository: + ansible.builtin.apt_repository: repo: "{{ item.type }} {{ item.url }} {{ item.component }}" state: present update_cache: true @@ -28,7 +28,7 @@ - percona-toolkit-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 diff --git a/tasks/scripts.yml b/tasks/scripts.yml index a7a560f..bcfaa58 100644 --- a/tasks/scripts.yml +++ b/tasks/scripts.yml @@ -1,7 +1,7 @@ # tasks file --- - name: scripts | copy files - copy: + ansible.builtin.copy: src: "{{ item.src }}" dest: "{{ item.dest }}" owner: "{{ item.owner | default('root') }}" diff --git a/vars/main.yml b/vars/main.yml index c8ed060..77706e6 100644 --- a/vars/main.yml +++ b/vars/main.yml @@ -2,10 +2,10 @@ --- percona_toolkit_repositories: - type: deb - url: "http://repo.percona.com/apt {{ ansible_distribution_release }}" + url: "http://repo.percona.com/tools/apt {{ ansible_distribution_release }}" component: main - type: deb-src - url: "http://repo.percona.com/apt {{ ansible_distribution_release }}" + url: "http://repo.percona.com/tools/apt {{ ansible_distribution_release }}" component: main percona_toolkit_dependencies_pre: From d9a5413b1b1d8069678d002e8aa9b2be5a89f69c Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Thu, 7 Jul 2022 11:50:50 +0200 Subject: [PATCH 2/2] Consistency changes --- .github/workflows/ci.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7c00f3c..5e5c0cf 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: | @@ -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