diff --git a/.ansible-lint b/.ansible-lint index aee7b5d..9ab2733 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -1,4 +1,5 @@ -exclude_paths: ~/.ansible +--- +exclude_paths: [~/.ansible] skip_list: - '306' diff --git a/.github/workflows/constraints.txt b/.github/workflows/constraints.txt index 6b6076d..613948d 100644 --- a/.github/workflows/constraints.txt +++ b/.github/workflows/constraints.txt @@ -1,4 +1,4 @@ pip==22.3.1 ansible==7.1.0 yamllint==1.28.0 -ansible-lint==6.9.1 +ansible-lint==6.10.2 diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b38ad2b..9e17ed0 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -19,7 +19,7 @@ repos: - id: yamllint args: ["-c=.yamllint", "."] - repo: https://github.com/ansible-community/ansible-lint.git - rev: v6.4.0 + rev: v6.10.2 hooks: - id: ansible-lint files: \.(yaml|yml)$ diff --git a/README.md b/README.md index 2a9d651..e2dfb8b 100644 --- a/README.md +++ b/README.md @@ -20,6 +20,9 @@ None. Here is the list of all variables and their default values: +- `pyenv_version: "HEAD"` - check https://github.com/pyenv/pyenv/releases +- `pyenv_virtualenv_version: "HEAD"` - check https://github.com/pyenv/pyenv-virtualenv/releases +- `pyenv_update_version: "HEAD"` - usually do not have releases but one can specify a commit hash - `pyenv_env: "user"` (should be either `"user"` or `"system"`) - `pyenv_path: "{% if pyenv_env == 'user' %}{{ ansible_env.HOME }}/pyenv{% else %}/usr/local/pyenv{% endif %}"` - `pyenv_owner: "{{ ansible_env.USER }}"` @@ -42,6 +45,9 @@ None. - hosts: servers roles: - role: staticdev.pyenv + pyenv_version: "v2.3.9" + pyenv_virtualenv_version: "v1.1.5" + pyenv_update_version: "810db78" pyenv_path: "{{ home }}/pyenv" pyenv_owner: "{{ instance_owner }}" pyenv_global: diff --git a/defaults/main.yml b/defaults/main.yml index 3d28254..b6ba5af 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,8 @@ --- # defaults file for pyenv +pyenv_version: "HEAD" +pyenv_virtualenv_version: "HEAD" +pyenv_update_version: "HEAD" pyenv_env: "user" pyenv_path: "{% if pyenv_env == 'user' %}{{ ansible_env.HOME }}/pyenv{% else %}/usr/local/pyenv{% endif %}" pyenv_owner: "{{ ansible_env.USER }}" @@ -46,7 +49,7 @@ pyenv_redhat_packages: - make - git - gcc - - "{{ ( (ansible_facts.distribution_major_version | default(0) | int) < 8) | ternary('libselinux-python','python3-libselinux') }}" + - "{{ ((ansible_facts.distribution_major_version | default(0) | int) < 8) | ternary('libselinux-python', 'python3-libselinux') }}" - zlib-devel - openssl-devel - bzip2-devel diff --git a/meta/main.yml b/meta/main.yml index e24ec7e..c4c2973 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -22,10 +22,11 @@ galaxy_info: # - jammy - focal - categories: + galaxy_tags: - development - pyenv - python - system - workstation + dependencies: [] diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index 7abdc6e..80064c0 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -7,3 +7,7 @@ - name: "Include staticdev.pyenv" ansible.builtin.include_role: name: "staticdev.pyenv" + vars: + pyenv_version: "v2.3.9" + pyenv_virtualenv_version: "v1.1.5" + pyenv_update_version: "810db78" diff --git a/molecule/multi-version/converge.yml b/molecule/multi-version/converge.yml index 000fe9b..d0f1fdc 100644 --- a/molecule/multi-version/converge.yml +++ b/molecule/multi-version/converge.yml @@ -8,6 +8,9 @@ ansible.builtin.include_role: name: "staticdev.pyenv" vars: + pyenv_version: "v2.3.9" + pyenv_virtualenv_version: "v1.1.5" + pyenv_update_version: "810db78" pyenv_global: - 3.11.0 - 3.10.6 diff --git a/tasks/install.yml b/tasks/install.yml index d5cd6dc..e51f76c 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -3,12 +3,14 @@ ansible.builtin.git: repo: https://github.com/pyenv/pyenv.git dest: "{{ pyenv_path }}" + version: "{{ pyenv_version }}" update: "{{ pyenv_update_git_install }}" - name: Install PyEnv-virtualenv plugin ansible.builtin.git: repo: https://github.com/yyuu/pyenv-virtualenv.git dest: "{{ pyenv_path }}/plugins/pyenv-virtualenv" + version: "{{ pyenv_virtualenv_version }}" update: "{{ pyenv_update_git_install }}" when: pyenv_enable_virtualenvs @@ -16,6 +18,7 @@ ansible.builtin.git: repo: https://github.com/pyenv/pyenv-update.git dest: "{{ pyenv_path }}/plugins/pyenv-update" + version: "{{ pyenv_update_version }}" update: "{{ pyenv_update_git_install }}" when: pyenv_update diff --git a/tasks/main.yml b/tasks/main.yml index ca34474..b2ccf7a 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,21 +1,27 @@ --- -- import_tasks: custom_facts.yml +- name: Load custom facts. + ansible.builtin.import_tasks: custom_facts.yml become: true -- import_tasks: Darwin.yml +- name: Run Darwin specific tasks. + ansible.builtin.import_tasks: Darwin.yml when: ansible_os_family == "Darwin" -- import_tasks: Debian.yml +- name: Run Debian specific tasks. + ansible.builtin.import_tasks: Debian.yml when: ansible_os_family == "Debian" -- import_tasks: RedHat.yml +- name: Run RedHat specific tasks. + ansible.builtin.import_tasks: RedHat.yml when: ansible_os_family == "RedHat" -- import_tasks: install.yml +- name: Install pyenv on user level. + ansible.builtin.import_tasks: install.yml become: true become_user: "{{ pyenv_owner }}" when: pyenv_env == "user" -- import_tasks: install.yml +- name: Install pyenv on system level. + ansible.builtin.import_tasks: install.yml become: true when: pyenv_env == "system"