From 3c846bddae0e6d5c8a54badeacf5de087e4e5489 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 18 Jan 2023 16:59:11 +0100 Subject: [PATCH 1/2] Consistency changes --- .github/workflows/ci.yml | 7 +++---- Dockerfile | 13 ++++++++----- meta/main.yml | 5 ++--- molecule/default/collections.yml | 6 ++++++ requirements.yml | 3 +++ tasks/main.yml | 6 ++++-- 6 files changed, 26 insertions(+), 14 deletions(-) create mode 100644 molecule/default/collections.yml create mode 100644 requirements.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 292e437..1f7278a 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 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 6c31cd4..a594420 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,13 +1,12 @@ # meta file --- galaxy_info: - namespace: oefenweb + author: oefenweb role_name: mariadb_client - author: Mischa ter Smitten company: Oefenweb.nl B.V. description: Set up mariadb-server client 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/main.yml b/tasks/main.yml index 9db9ba6..3fcd9c6 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,12 +1,14 @@ # tasks file --- -- include: install.yml +- name: install + ansible.builtin.import_tasks: install.yml tags: - configuration - mariadb-client - mariadb-client-install -- include: configure.yml +- name: configure + ansible.builtin.import_tasks: configure.yml tags: - configuration - mariadb-client From 78f1a23aa23a41094ec0c8eb1a285a81d9a397ff Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 18 Jan 2023 17:13:33 +0100 Subject: [PATCH 2/2] Cs fixes --- README.md | 2 +- tasks/configure.yml | 4 ++-- tasks/install.yml | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index e11d9da..a32570c 100644 --- a/README.md +++ b/README.md @@ -68,7 +68,7 @@ None mariadb_client_my_cnf_files: - dest: '~root/.my.cnf' owner: root - group: root + ansible.builtin.group: root mode: '0600' login_host: localhost login_port: 3306 diff --git a/tasks/configure.yml b/tasks/configure.yml index eb15f36..fffbd64 100644 --- a/tasks/configure.yml +++ b/tasks/configure.yml @@ -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') }}" @@ -12,7 +12,7 @@ - mariadb-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 }}" diff --git a/tasks/install.yml b/tasks/install.yml index 58bbf9e..ad5034f 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -1,7 +1,7 @@ # tasks file --- -- name: install | dependencies - apt: +- name: install | dependencies # noqa args[module] + ansible.builtin.apt: name: "{{ mariadb_client_dependencies }}" state: "{{ apt_install_state | default('latest') }}" update_cache: true @@ -9,8 +9,8 @@ tags: - mariadb-client-install-dependencies -- name: install | additional - apt: +- name: install | additional # noqa args[module] + ansible.builtin.apt: name: "{{ mariadb_client_install }}" state: "{{ apt_install_state | default('latest') }}" tags: