From dd7c4c5ec25bf5d963de97d567d487b45d3b5ebd Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Fri, 24 Mar 2023 13:51:07 +0100 Subject: [PATCH 1/2] Consistency changes --- .ansible-lint | 2 +- .github/workflows/ci.yml | 9 ++++----- Dockerfile | 13 ++++++++----- meta/main.yml | 2 +- molecule/default/collections.yml | 6 ++++++ molecule/default/molecule.yml | 4 +++- requirements.yml | 3 +++ 7 files changed, 26 insertions(+), 13 deletions(-) create mode 100644 molecule/default/collections.yml create mode 100644 requirements.yml diff --git a/.ansible-lint b/.ansible-lint index 5861551..b04781e 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,5 +1,5 @@ --- warn_list: - role-name + - name[play] - name[casing] - - '405' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7d526c..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 @@ -73,7 +72,7 @@ jobs: molecule test env: ANSIBLE_FORCE_COLOR: '1' - ANSIBLE_VERBOSITY: '3' + ANSIBLE_VERBOSITY: '2' MOLECULE_DEBUG: '1' MOLECULE_DISTRO: "${{ matrix.distro }}" PY_COLORS: '1' 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 95a9f98..0464fef 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -7,7 +7,7 @@ galaxy_info: company: Oefenweb.nl B.V. description: Set up Packer by HashiCorp 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/molecule/default/molecule.yml b/molecule/default/molecule.yml index fbb7120..8841165 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -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: 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: [] From d493b3ae502492be4862aaeb611ce82da8101f10 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Fri, 24 Mar 2023 13:55:32 +0100 Subject: [PATCH 2/2] Cs fixes --- tasks/main.yml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tasks/main.yml b/tasks/main.yml index c692fb4..a0d46b8 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ # tasks file --- - name: install dependencies - apt: + ansible.builtin.apt: name: "{{ packer_io_dependencies }}" state: "{{ apt_install_state | default('latest') }}" update_cache: true @@ -12,7 +12,7 @@ - packer-io-dependencies - name: create (download) directory - file: + ansible.builtin.file: path: "{{ packer_io_downloads_path }}" state: directory owner: root @@ -24,7 +24,7 @@ - packer-io-download - name: download - get_url: + ansible.builtin.get_url: url: "https://releases.hashicorp.com/packer/{{ packer_io_version }}/packer_{{ packer_io_version }}_linux_{{ packer_io_machine_map[ansible_machine] }}.zip" dest: "{{ packer_io_downloads_path }}/packer_{{ packer_io_version }}_linux_{{ packer_io_machine_map[ansible_machine] }}.zip" owner: root @@ -36,7 +36,7 @@ - packer-io-download - name: create (install) directory - file: + ansible.builtin.file: path: "{{ packer_io_install_path }}" state: directory owner: root @@ -48,7 +48,7 @@ - packer-io-install - name: install - unarchive: + ansible.builtin.unarchive: src: "{{ packer_io_downloads_path }}/packer_{{ packer_io_version }}_linux_{{ packer_io_machine_map[ansible_machine] }}.zip" dest: "{{ packer_io_install_path }}" creates: "{{ packer_io_install_path }}/packer" @@ -59,7 +59,7 @@ - packer-io-install - name: verify - command: > + ansible.builtin.command: > {{ packer_io_install_path }}/packer --version register: _verify_version failed_when: "packer_io_version not in _verify_version.stdout"