From 492e35466972b10d0984698dd7d026598a2c3812 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Fri, 8 Jul 2022 11:30:27 +0200 Subject: [PATCH 1/2] Consistency changes --- .github/workflows/ci.yml | 7 +++---- Dockerfile | 13 ++++++++----- handlers/main.yml | 2 +- meta/main.yml | 5 ++--- molecule/default/collections.yml | 6 ++++++ requirements.yml | 3 +++ tasks/main.yml | 10 +++++----- tests/tasks/pre.yml | 6 +++--- tests/test.yml | 4 ++-- tests/vagrant.yml | 4 ++-- 10 files changed, 35 insertions(+), 25 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 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 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/handlers/main.yml b/handlers/main.yml index 161144a..5017084 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -1,5 +1,5 @@ # handlers file --- - name: update ca-certificates - command: > + ansible.builtin.command: > update-ca-certificates diff --git a/meta/main.yml b/meta/main.yml index 96330c6..778c990 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,13 +1,12 @@ # meta file --- galaxy_info: - namespace: oefenweb + author: oefenweb role_name: ca_certificates - author: Mischa ter Smitten company: Oefenweb.nl B.V. description: Manage ca-certificates 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 6fb8758..7705ba5 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ # tasks file --- - name: install dependencies - apt: + ansible.builtin.apt: name: "{{ ca_certificates_dependencies }}" state: "{{ apt_install_state | default('latest') }}" update_cache: true @@ -13,7 +13,7 @@ - ca-certificates-install-dependencies - name: stat directories - stat: + ansible.builtin.stat: path: "{{ ca_certificates_base_dir }}/{{ item.dest | dirname }}" register: _stat_directories with_items: "{{ ca_certificates_certificate_map }}" @@ -24,7 +24,7 @@ - ca-certificates-directories-stat - name: create directories - file: + ansible.builtin.file: path: "{{ ca_certificates_base_dir }}/{{ item.item.dest | dirname }}" state: directory owner: root @@ -39,7 +39,7 @@ - ca-certificates-directories-create - name: copy ca files - copy: + ansible.builtin.copy: src: "{{ item.src }}" dest: "{{ ca_certificates_base_dir }}/{{ item.dest }}" owner: "{{ item.owner | default('root') }}" @@ -54,7 +54,7 @@ - ca-certificates-files-copy - name: trust ca files - lineinfile: + ansible.builtin.lineinfile: dest: "{{ ca_certificates_trust_file }}" line: "{{ item.dest }}" with_items: "{{ ca_certificates_certificate_map }}" diff --git a/tests/tasks/pre.yml b/tests/tasks/pre.yml index 4707966..d3029d2 100644 --- a/tests/tasks/pre.yml +++ b/tests/tasks/pre.yml @@ -1,7 +1,7 @@ # pre test file --- - name: install dependencies - apt: + ansible.builtin.apt: name: - openssl state: "{{ apt_install_state | default('latest') }}" @@ -11,13 +11,13 @@ - block: - name: generate key - command: > + ansible.builtin.command: > openssl genrsa -out {{ ca_certificates_certificate_key_file }} 2048 args: creates: "{{ ca_certificates_certificate_key_file }}" - name: generate crt - shell: > + ansible.builtin.shell: > openssl req \ -subj '/C=NL/ST=NH/L=Amsterdam/O=Oefenweb.nl B.V./OU=Systeembeheer/CN=oefenweb.nl/emailAddress=root@oefenweb.nl/' \ -x509 -new -nodes \ diff --git a/tests/test.yml b/tests/test.yml index d3837dc..e48bab7 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -5,8 +5,8 @@ become: true pre_tasks: - name: include vars - include_vars: "{{ playbook_dir }}/vars/main.yml" + ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml" - name: include tasks - include: "{{ playbook_dir }}/tasks/pre.yml" + ansible.builtin.include: "{{ playbook_dir }}/tasks/pre.yml" roles: - ../../ diff --git a/tests/vagrant.yml b/tests/vagrant.yml index dce3560..967036e 100644 --- a/tests/vagrant.yml +++ b/tests/vagrant.yml @@ -5,8 +5,8 @@ become: true pre_tasks: - name: include vars - include_vars: "{{ playbook_dir }}/vars/main.yml" + ansible.builtin.include_vars: "{{ playbook_dir }}/vars/main.yml" - name: include tasks - include: "{{ playbook_dir }}/tasks/pre.yml" + ansible.builtin.include: "{{ playbook_dir }}/tasks/pre.yml" roles: - ../../ From 4a7b187874db01eed3233491e33c92cab2f2057d Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Fri, 8 Jul 2022 16:28:52 +0200 Subject: [PATCH 2/2] Cs fix --- tests/tasks/pre.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tests/tasks/pre.yml b/tests/tasks/pre.yml index d3029d2..3c2bb94 100644 --- a/tests/tasks/pre.yml +++ b/tests/tasks/pre.yml @@ -8,7 +8,8 @@ update_cache: true cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}" -- block: +- name: generate + block: - name: generate key ansible.builtin.command: >