From ec95d45adaed607304e6de2a332ceb616288873c Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Fri, 18 Aug 2023 10:12:09 +0200 Subject: [PATCH] WIP --- .ansible-lint | 3 +-- .github/workflows/ci.yml | 9 ++++----- tasks/main.yml | 16 ++++++++-------- tests/vagrant.yml | 10 +++++----- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 3c58286..b04781e 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,6 +1,5 @@ --- warn_list: - role-name + - name[play] - name[casing] - - '208' - - '306' diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 292e437..7e2bc34 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 @@ -66,7 +65,7 @@ jobs: python-version: '3.x' - name: Install test dependencies - run: pip install 'ansible${{ matrix.ansible-version }}' molecule[docker] docker + run: pip install 'ansible${{ matrix.ansible-version }}' molecule-plugins[docker] docker - name: Run Molecule tests run: | diff --git a/tasks/main.yml b/tasks/main.yml index 80b3ea3..2532e4b 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ # tasks file --- - name: update cache - apt: + ansible.builtin.apt: update_cache: true cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}" when: openjdk_versions | length @@ -12,7 +12,7 @@ # See: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=863199 - name: ensure man directory - file: + ansible.builtin.file: path: /usr/share/man/man1 state: directory recurse: true @@ -25,7 +25,7 @@ - openjdk-install - name: install (default) - apt: + ansible.builtin.apt: name: "{{ item.version }}-jdk" state: "{{ apt_install_state | default('latest') }}" dpkg_options: "{{ item.dpkg_options | default([]) | join(',') | default(omit, true) }}" @@ -37,7 +37,7 @@ - openjdk-install - name: install (specific) - apt: + ansible.builtin.apt: name: "openjdk-{{ item.version }}-jdk" state: "{{ apt_install_state | default('latest') }}" dpkg_options: "{{ item.dpkg_options | default([]) | join(',') | default(omit, true) }}" @@ -48,8 +48,8 @@ - openjdk - openjdk-install -- name: get alternatives - shell: > +- name: get alternatives # noqa risky-shell-pipe + ansible.builtin.shell: > update-java-alternatives -l | grep "java-.*{{ item.version }}.*-openjdk-$(dpkg --print-architecture)" | awk '{print $1}' with_items: "{{ openjdk_versions }}" register: _get_alternatives @@ -62,7 +62,7 @@ - openjdk-install-alternatives-get - name: set alternatives - command: > + ansible.builtin.command: > update-java-alternatives -s {{ item.stdout }} with_items: "{{ _get_alternatives.results | default([]) }}" when: @@ -77,7 +77,7 @@ - openjdk-install-alternatives-set - name: verify - command: > + ansible.builtin.command: > java -version when: openjdk_versions | length register: _verify_version diff --git a/tests/vagrant.yml b/tests/vagrant.yml index 765b1d1..a4ea15a 100644 --- a/tests/vagrant.yml +++ b/tests/vagrant.yml @@ -8,9 +8,9 @@ vars: openjdk_versions: - version: 8 -# - version: 9 -# set_as_default: true -# dpkg_options: "{{ openjdk_dpkg_options_force_overwrite }}" + # - version: 9 + # set_as_default: true + # dpkg_options: "{{ openjdk_dpkg_options_force_overwrite }}" - version: 11 -# - version: 13 -# - version: 14 + # - version: 13 + # - version: 14