From abf5284b76783440ef159b9c65402e2dbbe16586 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 23 Aug 2023 14:02:32 +0200 Subject: [PATCH 1/4] WIP --- .ansible-lint | 2 +- .github/workflows/ci.yml | 9 ++++----- tasks/main.yml | 13 ++++++------- 3 files changed, 11 insertions(+), 13 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index c3fbd80..b04781e 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,5 +1,5 @@ --- warn_list: - role-name + - name[play] - name[casing] - - '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 9b3590a..0a97d7f 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -33,8 +33,12 @@ - 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: pip_download_url: 'https://bootstrap.pypa.io/pip/2.6/get-pip.py' @@ -89,11 +93,6 @@ 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: url: "{{ pip_download_url }}" From 5c3eb56e0a573bd1b3ccf51f153aea6ee15813b5 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 23 Aug 2023 14:03:24 +0200 Subject: [PATCH 2/4] WIP --- molecule/default/converge.yml | 2 +- tasks/main.yml | 26 +++++++++++++------------- tests/test.yml | 2 +- tests/vagrant.yml | 2 +- 4 files changed, 16 insertions(+), 16 deletions(-) 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 0a97d7f..0e6837c 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 @@ -24,7 +24,7 @@ - pip-directory - name: get python version - shell: > + ansible.builtin.shell: > python{{ pip_python_version_major | string }} --version 2>&1 | awk '{print $2}' register: _python_version changed_when: false @@ -40,61 +40,61 @@ - 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', '>=') - 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 @@ -108,7 +108,7 @@ - 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 tags: 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" From 103a13d816b22a1e650381582a3f704d3f21f098 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 23 Aug 2023 14:09:50 +0200 Subject: [PATCH 3/4] WIP --- tasks/main.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/tasks/main.yml b/tasks/main.yml index 0e6837c..befd406 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -23,7 +23,7 @@ - pip - pip-directory -- name: get python version +- 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 @@ -111,6 +111,7 @@ ansible.builtin.command: > python{{ pip_python_version_major | string }} {{ _download_latest.dest }} when: _download_latest is changed + changed_when: true tags: - configuration - pip From 0e20a99fe79d2afe9f2c19c89705730161f3fc13 Mon Sep 17 00:00:00 2001 From: Mischa ter Smitten Date: Wed, 23 Aug 2023 14:16:42 +0200 Subject: [PATCH 4/4] Add ignore --- .ansible-lint | 1 + 1 file changed, 1 insertion(+) diff --git a/.ansible-lint b/.ansible-lint index b04781e..6e03ce5 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -3,3 +3,4 @@ warn_list: - role-name - name[play] - name[casing] + - no-handler