diff --git a/.ansible-lint b/.ansible-lint index c3fbd80..6e03ce5 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,5 +1,6 @@ --- warn_list: - role-name + - name[play] - name[casing] - - '306' + - no-handler 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/molecule/default/converge.yml b/molecule/default/converge.yml index 44670e5..8cf3207 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -4,7 +4,7 @@ become: true pre_tasks: - name: include variables - include_vars: "{{ item }}" + ansible.builtin.include_vars: "{{ item }}" with_first_found: - "{{ playbook_dir }}/../../tests/vars/_{{ ansible_distribution_release }}.yml" - "{{ playbook_dir }}/../../tests/vars/_{{ ansible_distribution | lower }}.yml" diff --git a/tasks/main.yml b/tasks/main.yml index 9b3590a..befd406 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,7 +1,7 @@ # tasks file --- - name: install dependencies - apt: + ansible.builtin.apt: name: "{{ pip_dependencies }}" state: "{{ apt_install_state | default('latest') }}" update_cache: true @@ -12,7 +12,7 @@ - pip-dependencies - name: create (download) directory - file: + ansible.builtin.file: path: "{{ pip_download_path }}" state: directory owner: root @@ -23,8 +23,8 @@ - pip - pip-directory -- name: get python version - shell: > +- name: get python version # noqa risky-shell-pipe + ansible.builtin.shell: > python{{ pip_python_version_major | string }} --version 2>&1 | awk '{print $2}' register: _python_version changed_when: false @@ -33,69 +33,68 @@ - pip - pip-get-python-version -- block: - +- name: get download url + tags: + - configuration + - pip + - pip-get-download-url + block: - name: get download url (2.6) - set_fact: + ansible.builtin.set_fact: pip_download_url: 'https://bootstrap.pypa.io/pip/2.6/get-pip.py' when: - _python_version.stdout is version('2.6', '>=') - _python_version.stdout is version('2.7', '<') - name: get download url (2.7) - set_fact: + ansible.builtin.set_fact: pip_download_url: 'https://bootstrap.pypa.io/pip/2.7/get-pip.py' when: - _python_version.stdout is version('2.7', '>=') - _python_version.stdout is version('2.8', '<') - name: get download url (3.2) - set_fact: + ansible.builtin.set_fact: pip_download_url: 'https://bootstrap.pypa.io/pip/3.2/get-pip.py' when: - _python_version.stdout is version('3.2', '>=') - _python_version.stdout is version('3.3', '<') - name: get download url (3.3) - set_fact: + ansible.builtin.set_fact: pip_download_url: 'https://bootstrap.pypa.io/pip/3.3/get-pip.py' when: - _python_version.stdout is version('3.3', '>=') - _python_version.stdout is version('3.4', '<') - name: get download url (3.4) - set_fact: + ansible.builtin.set_fact: pip_download_url: 'https://bootstrap.pypa.io/pip/3.4/get-pip.py' when: - _python_version.stdout is version('3.4', '>=') - _python_version.stdout is version('3.5', '<') - name: get download url (3.5) - set_fact: + ansible.builtin.set_fact: pip_download_url: 'https://bootstrap.pypa.io/pip/3.5/get-pip.py' when: - _python_version.stdout is version('3.5', '>=') - _python_version.stdout is version('3.6', '<') - name: get download url (3.6) - set_fact: + ansible.builtin.set_fact: pip_download_url: 'https://bootstrap.pypa.io/pip/3.6/get-pip.py' when: - _python_version.stdout is version('3.6', '>=') - _python_version.stdout is version('3.7', '<') - name: get download url (latest) - set_fact: + ansible.builtin.set_fact: pip_download_url: 'https://bootstrap.pypa.io/pip/get-pip.py' when: _python_version.stdout is version('3.7', '>=') - tags: - - configuration - - pip - - pip-get-download-url - - name: download (latest) pip - get_url: + ansible.builtin.get_url: url: "{{ pip_download_url }}" dest: "{{ pip_download_path }}/{{ pip_download_url | basename }}-{{ pip_python_version_major | string }}" owner: root @@ -109,9 +108,10 @@ - pip-pip-download - name: install (latest) pip (setuptools and wheel) - command: > + ansible.builtin.command: > python{{ pip_python_version_major | string }} {{ _download_latest.dest }} when: _download_latest is changed + changed_when: true tags: - configuration - pip diff --git a/tests/test.yml b/tests/test.yml index 49906b9..a5dc7da 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -5,7 +5,7 @@ become: true pre_tasks: - name: include variables - include_vars: "{{ item }}" + ansible.builtin.include_vars: "{{ item }}" with_first_found: - "{{ playbook_dir }}/vars/_{{ ansible_distribution_release }}.yml" - "{{ playbook_dir }}/vars/_{{ ansible_distribution | lower }}.yml" diff --git a/tests/vagrant.yml b/tests/vagrant.yml index 958d7ea..0e6f156 100644 --- a/tests/vagrant.yml +++ b/tests/vagrant.yml @@ -5,7 +5,7 @@ become: true pre_tasks: - name: include variables - include_vars: "{{ item }}" + ansible.builtin.include_vars: "{{ item }}" with_first_found: - "{{ playbook_dir }}/vars/_{{ ansible_distribution_release }}.yml" - "{{ playbook_dir }}/vars/_{{ ansible_distribution | lower }}.yml"