zuul-jobs/roles/ensure-twine/tasks/main.yaml
Ian Wienand 8c6512107c
Standarise block/when ordering
Newer ansbile-lint finds "when" or "become" statements that are at the
end of blocks.  Ordering these before the block seems like a very
logical thing to do, as we read from top-to-bottom so it's good to see
if the block will execute or not.

This is a no-op, and just moves the places the newer linter found.

Change-Id: If4d1dc4343ea2575c64510e1829c3fe02d6c273f
2022-11-07 10:37:53 +11:00

23 lines
651 B
YAML

- name: Check for twine install
shell: |
command -v {{ twine_executable }} ~/.local/bin/twine || exit 1
args:
executable: /bin/bash
failed_when: false
register: register_twine
- name: Set pypi_twine_executable
set_fact:
pypi_twine_executable: "{{ register_twine.stdout_lines[0] }}"
when: register_twine.rc == 0
- name: Ensure twine is installed
when: register_twine.rc != 0
block:
- name: Ensure twine is installed
command: "{{ twine_python }} -m pip install twine!=1.12.0 requests-toolbelt!=0.9.0 --user"
- name: Set pypi_twine_executable
set_fact:
pypi_twine_executable: ~/.local/bin/twine