Skip to content

Commit

Permalink
change virtualenv_interpreter to virtualenv_python
Browse files Browse the repository at this point in the history
  • Loading branch information
mafalb committed Jan 16, 2024
1 parent 15d9c69 commit 4867f9f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:

- name: install ansible
run: |
ansible-playbook -D playbooks/install-ansible.yml -e '{"virtualenv_packages":["_ansible==${{ matrix.ansible_version }}", "ansible-lint${{ matrix.ansible_lint_specifier }}", "_ansible_test", "flake8"]}' -e virtualenv_interpreter=python${{ matrix.python_version }} -t all,debug
ansible-playbook -D playbooks/install-ansible.yml -e '{"virtualenv_packages":["_ansible==${{ matrix.ansible_version }}", "ansible-lint${{ matrix.ansible_lint_specifier }}", "_ansible_test", "flake8"]}' -e virtualenv_python=python${{ matrix.python_version }} -t all,debug
env:
ANSIBLE_COLLECTIONS_PATHS: ../../..

Expand Down
2 changes: 1 addition & 1 deletion playbooks/install-ansible.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@
roles:
- role: mafalb.ansible.virtualenv
virtualenv_packages: "{{ virtualenv_packages }}"
virtualenv_interpreter: "{{ virtualenv_interpreter if virtualenv_interpreter is defined else omit }}"
virtualenv_python: "{{ virtualenv_python if virtualenv_python is defined else omit }}"
4 changes: 2 additions & 2 deletions playbooks/install-molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# this is used if molecule_ansible_version is argument
- role: mafalb.ansible.virtualenv
virtualenv: ~/.virtualenvs/molecule # noqa var-naming[no-role-prefix]
virtualenv_interpreter: "{{ molecule_python_version|default('python3') }}"
virtualenv_python: "{{ molecule_python_version|default('python3') }}"
virtualenv_packages:
- _ansible=={{ molecule_ansible_version }}
- ansible-lint
Expand All @@ -20,7 +20,7 @@
# this is used if molecule_ansible_version is not argument
- role: mafalb.ansible.virtualenv
virtualenv: ~/.virtualenvs/molecule # noqa var-naming[no-role-prefix]
virtualenv_interpreter: "{{ molecule_python_version|default('python3') }}"
virtualenv_python: "{{ molecule_python_version|default('python3') }}"
virtualenv_packages:
- _ansible
- ansible-lint
Expand Down
3 changes: 3 additions & 0 deletions roles/python/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
|RHEL 8|python2|python3|python3|
|Fedora|python2|python3|python3|

https://bugzilla.redhat.com/show_bug.cgi?id=1932650
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=2093589

## Basic Usage

```yaml
Expand Down
8 changes: 4 additions & 4 deletions roles/virtualenv/tasks/main/present.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,17 @@
ansible.builtin.debug:
var: __virtualenv

- name: Debug virtualenv_interpreter
- name: Debug virtualenv_python
ansible.builtin.debug:
var: virtualenv_interpreter
var: virtualenv_python

- name: Debug __virtualenv_interpreter
ansible.builtin.debug:
var: __virtualenv_interpreter

- name: Get info about targeted python interpreter
mafalb.ansible.python_info:
executable: "{{ virtualenv_interpreter | default(ansible_python.executable) }}"
executable: "{{ virtualenv_python | default(ansible_python.executable) }}"
register: __reg_targeted_python

- name: Debug targeted python interpreter
Expand All @@ -31,7 +31,7 @@
- name: Get OS specific variables
with_first_found:
# the following does not work. it is possible that the virtualenv does already exist.
# in that case, if no virtualenv_interpreter is given as argument, it could be
# in that case, if no virtualenv_python is given as argument, it could be
# that the used interpreter in the existing virtualenv is different from the ansible python.
#
# - "{{ ansible_distribution }}-{{ ansible_distribution_major_version }}-\
Expand Down

0 comments on commit 4867f9f

Please sign in to comment.