This repository was archived by the owner on May 8, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change 85
85
with_items : " {{ pyenv_virtualenvs }}"
86
86
when : pyenv_enable_virtualenvs
87
87
88
- - name : " Set pyenv global {{ pyenv_global }}"
89
- ansible.builtin.shell : . {{ pyenvrc_path }}/.pyenvrc && pyenv global {{ pyenv_global | join(' ') }} && pyenv rehash
90
- args :
91
- creates : " {{ pyenv_path }}/version"
88
+ - name : Update the pyenv globals
92
89
when : pyenv_global is defined
90
+ vars :
91
+ pyenv_global_versions_path : " {{ pyenv_path }}/version"
92
+ block :
93
+ - name : " Does pyenv globals file exist?"
94
+ ansible.builtin.stat :
95
+ path : " {{ pyenv_global_versions_path }}"
96
+ register : _pyenv_globals_file
97
+ - name : " Read the pyenv global versions"
98
+ ansible.builtin.slurp :
99
+ src : " {{ pyenv_global_versions_path }}"
100
+ register : _pyenv_globals_file_content
101
+ when : _pyenv_globals_file.stat.exists
102
+ - name : " Set pyenv global {{ pyenv_global }}"
103
+ ansible.builtin.shell : . {{ pyenvrc_path }}/.pyenvrc && pyenv global {{ pyenv_global | join(' ') }} && pyenv rehash
104
+ changed_when : true
105
+ when :
106
+ - _pyenv_globals_file.stat.exists
107
+ - (_pyenv_globals_file_content.content | b64decode | split('\n') | select() | list) != pyenv_global
You can’t perform that action at this time.
0 commit comments