From 7ac5fa50da70ae8ab4c6fceb4bc01b1324dc4777 Mon Sep 17 00:00:00 2001 From: staticdev Date: Sat, 8 Oct 2022 17:03:49 +0200 Subject: [PATCH] Fix buildin ansible module calls --- molecule/default/converge.yml | 2 +- molecule/multi-version/converge.yml | 2 +- pyproject.toml | 2 +- tasks/Debian.yml | 4 ++-- tasks/custom_facts.yml | 8 ++++---- tasks/install.yml | 22 +++++++++++----------- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 8fb98d6..7abdc6e 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -5,5 +5,5 @@ tasks: - name: "Include staticdev.pyenv" - include_role: + ansible.builtin.include_role: name: "staticdev.pyenv" diff --git a/molecule/multi-version/converge.yml b/molecule/multi-version/converge.yml index 575d83f..a1a2e49 100644 --- a/molecule/multi-version/converge.yml +++ b/molecule/multi-version/converge.yml @@ -5,7 +5,7 @@ tasks: - name: "Include staticdev.pyenv" - include_role: + ansible.builtin.include_role: name: "staticdev.pyenv" vars: pyenv_global: diff --git a/pyproject.toml b/pyproject.toml index f5e4a24..3f35471 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "ansible-role-pyenv" -version = "2.6.1" +version = "2.6.2" description = "Ansible role to install pyenv." authors = ["staticdev "] license = "MIT" diff --git a/tasks/Debian.yml b/tasks/Debian.yml index ecce783..8253ee0 100644 --- a/tasks/Debian.yml +++ b/tasks/Debian.yml @@ -1,12 +1,12 @@ --- - name: Ensure apt cache is up to date - apt: + ansible.builtin.apt: update_cache: true cache_valid_time: 3600 become: true - name: Install development packages necessary for building Python - apt: + ansible.builtin.apt: pkg: "{{ pyenv_debian_packages }}" state: present become: true diff --git a/tasks/custom_facts.yml b/tasks/custom_facts.yml index e8be198..df27dea 100644 --- a/tasks/custom_facts.yml +++ b/tasks/custom_facts.yml @@ -1,11 +1,11 @@ --- - name: Create folder for custom facts - file: + ansible.builtin.file: path: /etc/ansible/facts.d state: directory - name: Copy over check-configure-options.py - template: + ansible.builtin.template: src: templates/check-configure-options.py.j2 dest: /etc/ansible/facts.d/check-configure-options.py owner: "{{ pyenv_owner }}" @@ -13,7 +13,7 @@ mode: "0755" - name: Copy over python_check fact file - template: + ansible.builtin.template: src: templates/pyenv_python_installations.fact.j2 dest: /etc/ansible/facts.d/pyenv_python_installations.fact owner: "{{ pyenv_owner }}" @@ -21,5 +21,5 @@ mode: "0755" - name: Reload setup to gather custom facts - setup: + ansible.builtin.setup: filter: ansible_local diff --git a/tasks/install.yml b/tasks/install.yml index 5acf0df..3a22e8e 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -1,57 +1,57 @@ --- - name: Install PyEnv - git: + ansible.builtin.git: repo: https://github.com/pyenv/pyenv.git dest: "{{ pyenv_path }}" update: "{{ pyenv_update_git_install }}" - name: Install PyEnv-virtualenv plugin - git: + ansible.builtin.git: repo: https://github.com/yyuu/pyenv-virtualenv.git dest: "{{ pyenv_path }}/plugins/pyenv-virtualenv" update: "{{ pyenv_update_git_install }}" - name: Install PyEnv-update plugin - git: + ansible.builtin.git: repo: https://github.com/pyenv/pyenv-update.git dest: "{{ pyenv_path }}/plugins/pyenv-update" update: "{{ pyenv_update_git_install }}" when: pyenv_update - name: Install .pyenvrc - template: + ansible.builtin.template: src: ".pyenvrc.j2" dest: "{{ pyenv_path }}/.pyenvrc" owner: "{{ pyenv_owner }}" mode: "0644" - name: "Load pyenv env variables in {{ pyenv_setting_path }}" - lineinfile: dest="{{ pyenv_setting_path }}" + ansible.builtin.lineinfile: dest="{{ pyenv_setting_path }}" regexp="\.pyenvrc$" line="source {{ pyenv_path }}/.pyenvrc" state=present create=yes - name: "Add pyenv autocomplete in {{ pyenv_setting_path }}" - lineinfile: dest="{{ pyenv_setting_path }}" + ansible.builtin.lineinfile: dest="{{ pyenv_setting_path }}" regexp="pyenv\.bash$" line="source {{ pyenv_path }}/completions/pyenv.bash" state=present when: pyenv_enable_autocompletion - name: Update Pyenv interpreter list - shell: . {{ pyenv_path }}/.pyenvrc && pyenv update + ansible.builtin.shell: . {{ pyenv_path }}/.pyenvrc && pyenv update when: pyenv_update - name: Uninstall existing Python interpreters w/ wrong compilation flags - shell: ". {{ pyenv_path }}/.pyenvrc && pyenv uninstall -f {{ item }}" + ansible.builtin.shell: ". {{ pyenv_path }}/.pyenvrc && pyenv uninstall -f {{ item }}" args: removes: "{{ pyenv_path }}/versions/{{ item }}/bin/python" loop: "{{ ansible_local['pyenv_python_installations']['to_reinstall'] | default([]) }}" when: pyenv_uninstall_python_w_wrong_configure_opts - name: "Install Python interpreters {{ pyenv_python_versions }}" - shell: ". {{ pyenv_path }}/.pyenvrc && pyenv install {{ item }}" + ansible.builtin.shell: ". {{ pyenv_path }}/.pyenvrc && pyenv install {{ item }}" environment: PYTHON_CONFIGURE_OPTS: "{{ pyenv_python_configure_opts }}" args: @@ -59,13 +59,13 @@ with_items: "{{ pyenv_python_versions }}" - name: Create virtual environments - shell: + ansible.builtin.shell: . {{ pyenv_path }}/.pyenvrc && pyenv virtualenv {{ item.py_version }} {{ item.venv_name }} creates="{{ pyenv_path }}/versions/{{ item.py_version }}/envs/{{ item.venv_name }}/bin/python" with_items: "{{ pyenv_virtualenvs }}" - name: "Set pyenv global {{ pyenv_global }}" - shell: . {{ pyenv_path }}/.pyenvrc && pyenv global {{ pyenv_global | join(' ') }} && pyenv rehash + ansible.builtin.shell: . {{ pyenv_path }}/.pyenvrc && pyenv global {{ pyenv_global | join(' ') }} && pyenv rehash args: creates: "{{ pyenv_path }}/version" when: pyenv_global is defined