Skip to content

Commit

Permalink
Fix lint issues
Browse files Browse the repository at this point in the history
Also cleans the code a bit
  • Loading branch information
Zialus committed Jan 1, 2021
1 parent cf92577 commit 101984d
Show file tree
Hide file tree
Showing 4 changed files with 56 additions and 108 deletions.
6 changes: 6 additions & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
skip_list:
# Skip the pipefail rule (306) due to controversy / there-be-dragons
# https://github.com/ansible/ansible-lint/issues/497
# https://github.com/ansible/ansible/issues/12903
- '306'
- '106'
6 changes: 6 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
extends: default

rules:
line-length:
level: warning
136 changes: 36 additions & 100 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,105 +4,41 @@ galaxy_info:
description: An ansible role that ensures pip is installed at the version you specify.
license: WTFPL
min_ansible_version: 1.9
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#

platforms:
- name: EL
versions:
- all
- 5
- 6
- name: GenericUNIX
versions:
- all
- any
- name: Fedora
versions:
- all
- 16
- 17
- 18
- 19
- 20
- name: opensuse
versions:
- all
- 12.1
- 12.2
- 12.3
- 13.1
- 13.2
- name: GenericBSD
versions:
- all
- any
- name: FreeBSD
versions:
- all
- 8.0
- 8.1
- 8.2
- 8.3
- 8.4
- 9.0
- 9.1
- 9.1
- 9.2
- name: Ubuntu
versions:
- all
- lucid
- maverick
- natty
- oneiric
- precise
- quantal
- raring
- saucy
- trusty
- name: SLES
versions:
- all
- 10SP3
- 10SP4
- 11
- 11SP1
- 11SP2
- 11SP3
- name: GenericLinux
versions:
- all
- any
- name: Debian
versions:
- all
- etch
- lenny
- squeeze
- wheezy
# Below are all categories currently available. Just as with
# the platforms above, uncomment those that apply to your role.
#
categories:
#- cloud
#- cloud:ec2
#- cloud:gce
#- cloud:rax
#- database
#- database:nosql
#- database:sql
#- development
#- monitoring
#- networking
#- packaging
- system
#- web
dependencies: []
# List your role dependencies here, one per line. Only
# dependencies available via galaxy should be listed here.
# Be sure to remove the '[]' above if you add dependencies
# to this list.
- name: EL
versions:
- all
- name: GenericUNIX
versions:
- all
- name: Fedora
versions:
- all
- name: opensuse
versions:
- all
- name: GenericBSD
versions:
- all
- name: FreeBSD
versions:
- all
- name: Ubuntu
versions:
- all
- name: SLES
versions:
- all
- name: GenericLinux
versions:
- all
- name: Debian
versions:
- all

galaxy_tags:
- packaging
- system

dependencies: []
16 changes: 8 additions & 8 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
- name: Check to see if pip is already installed.
command: "{{ pip }} --version"
ignore_errors: true
changed_when: false # read-only task
check_mode: no
changed_when: false
check_mode: false
register: pip_is_installed

- name: Download pip.
Expand All @@ -16,8 +16,8 @@
when: pip_is_installed.rc != 0

- name: Install pip.
command: "{{ python }} {{ pip_download_dest }}/get-pip.py{{ ' --proxy=' + pip_proxy if pip_proxy != '' else '' }}"
become: yes
command: "{{ python }} {{ pip_download_dest }}/get-pip.py {{ '--proxy=' + pip_proxy if pip_proxy else '' }}"
become: true
when: pip_is_installed.rc != 0

- name: Delete get-pip.py.
Expand All @@ -32,17 +32,17 @@
shell: "{{ pip }} --version | awk '{print $2}'"
register: pip_installed_version
changed_when: false
check_mode: no
check_mode: false
when: pip_version or (pip_version | lower) != "latest"

- name: Install required version of pip.
command: "{{ pip }} install pip=={{ pip_version }}"
become: yes
become: true
when: pip_version and pip_installed_version.stdout is version_compare(pip_version, '!=') and (pip_version | lower) != "latest"

- name: Upgrade to latest version of pip.
command: "{{ pip }} {{ '--proxy=' + pip_proxy + ' ' if pip_proxy != '' else '' }}install -U pip"
command: "{{ pip }} install -U pip {{ '--proxy=' + pip_proxy if pip_proxy else '' }}"
register: pip_latest_output
become: yes
become: true
changed_when: pip_latest_output.stdout.find('Requirement already up-to-date') == -1
when: not pip_version or (pip_version | lower) == "latest"

0 comments on commit 101984d

Please sign in to comment.