Skip to content

Commit 88eab7e

Browse files
authored
WIP: Drop Ansible 1.x support (DavidWittman#183)
* Update README to remove Ansible 1.x support * Remove 1.x from .travis.yml testing * Fix downloading for 2.x only * Add Ansible 1.x check * Update comment for `else omit` in dependencies * Add 2.1.6 back to testing matrix
1 parent 2e25a3a commit 88eab7e

File tree

5 files changed

+14
-46
lines changed

5 files changed

+14
-46
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@ language: python
33
python: "2.7"
44

55
env:
6-
- ANSIBLE_VERSION=1.9.4
7-
- ANSIBLE_VERSION=2.1.3
6+
- ANSIBLE_VERSION=2.1.6
7+
- ANSIBLE_VERSION=2.3.3
88
- ANSIBLE_VERSION=latest
99

1010
before_install:

README.md

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
[![Build Status](https://travis-ci.org/DavidWittman/ansible-redis.svg?branch=master)](https://travis-ci.org/DavidWittman/ansible-redis) [![Ansible Galaxy](https://img.shields.io/badge/galaxy-DavidWittman.redis-blue.svg?style=flat)](https://galaxy.ansible.com/detail#/role/730)
44

55
- Ansible 2.1+
6-
- Ansible 1.9.x is currently supported, but it will be deprecated soon
76
- Compatible with most versions of Ubuntu/Debian and RHEL/CentOS 6.x
87

98
## Contents
@@ -151,23 +150,7 @@ Along with the variables listed above, Sentinel has a number of its own configur
151150

152151
### Verifying checksums
153152

154-
Set the `redis_verify_checksum` variable to true to use the checksum verification option for `get_url`. Note that this will only verify checksums when Redis is downloaded from a URL, not when one is provided in a tarball with `redis_tarball`. Due to differences in the `get_url` module in Ansible 1.x and Ansible 2.x, this feature behaves differently depending on the version of Ansible which you are using.
155-
156-
#### Ansible 1.x
157-
158-
In Ansible 1.x, the `get_url` module only supports verifying sha256 checksums, which are not provided by default. If you wish to set `redis_verify_checksum`, you must also define a sha256 checksum with the `redis_checksum` variable.
159-
160-
``` yaml
161-
- name: install redis on ansible 1.x and verify checksums
162-
hosts: all
163-
roles:
164-
- role: DavidWittman.redis
165-
redis_version: 3.0.7
166-
redis_verify_checksum: true
167-
redis_checksum: b2a791c4ea3bb7268795c45c6321ea5abcc24457178373e6a6e3be6372737f23
168-
```
169-
170-
#### Ansible 2.x
153+
Set the `redis_verify_checksum` variable to true to use the checksum verification option for `get_url`. Note that this will only verify checksums when Redis is downloaded from a URL, not when one is provided in a tarball with `redis_tarball`.
171154

172155
When using Ansible 2.x, this role will verify the sha1 checksum of the download against checksums defined in the `redis_checksums` variable in `vars/main.yml`. If your version is not defined in here or you wish to override the checksum with one of your own, simply set the `redis_checksum` variable. As in the example below, you will need to prefix the checksum with the type of hash which you are using.
173156

tasks/check_vars.yml

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,20 @@
11
---
2-
# Checksums for Ansible 1.x must be sha256
3-
- name: check for checksum (ansible 1.x)
2+
3+
- name: check for ansible 1.x
44
fail:
55
msg: >
6-
A sha256 checksum must be provided for Ansible 1.x when
7-
redis_verify_checksum is set to true.
6+
This role no longer supports Ansible 1.x. The last known good tag
7+
for Ansible 1.x support in this role is 1.2.5.
88
when:
99
- ansible_version.major < 2
10-
- redis_verify_checksum|bool
11-
- redis_checksum is not defined or redis_checksum|length != 64
1210

13-
- name: check for checksum (ansible 2.x)
11+
- name: check for checksum
1412
fail:
1513
msg: >
1614
There is no sha1 checksum defined for version {{ redis_version }} in
1715
vars/main.yml. Set redis_checksum manually or submit a PR to add this
1816
version.
1917
when:
20-
- ansible_version.major >= 2
2118
- redis_verify_checksum|bool
2219
- redis_checksum is not defined
2320
- redis_version not in redis_checksums

tasks/dependencies.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
- gcc
1010
- make
1111
- libc6-dev
12-
# This should be `else omit`, but it fails on Ansible 1.x, so just duplicate gcc
12+
# This should be `else omit`, but that doesn't quite work, so duplicate gcc
1313
- "{{ 'libc6-dev-i386' if redis_make_32bit|bool else 'gcc' }}"
1414
when: ansible_os_family == "Debian"
1515

@@ -47,7 +47,7 @@
4747
with_items:
4848
- gcc
4949
- make
50-
# This should be `else omit`, but it fails on Ansible 1.x, so just duplicate gcc
50+
# These should be `else omit`, but that doesn't quite work, so duplicate gcc
5151
- "{{ 'gcc-32bit' if redis_make_32bit|bool else 'gcc' }}"
5252
- "{{ 'libgcc_s1-32bit' if redis_make_32bit|bool else 'gcc' }}"
5353
when: ansible_os_family == 'Suse'

tasks/download.yml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,21 @@
11
---
22

3-
# get_url on Ansible 1.x only supports sha256 checksumming, so we're only
4-
# using `redis_checksums` on Ansible 2.x because they're sha1.
3+
# Redis uses a mix of sha1 and sha256 checksums.
4+
# Determine the type of checksum based on its length and prefix the variable appropriately
55
- name: set redis checksum
66
set_fact:
77
redis_checksum: "{{ 'sha1' if redis_checksums[redis_version]|length == 40 else 'sha256' }}:{{ redis_checksums[redis_version] }}"
88
when:
99
- redis_verify_checksum|bool
1010
- redis_checksum is not defined
1111
- redis_version in redis_checksums
12-
- ansible_version.major >= 2
1312

14-
- name: download redis (ansible 1.x)
15-
get_url:
16-
url: "{{ redis_download_url }}"
17-
dest: /usr/local/src/redis-{{ redis_version }}.tar.gz
18-
sha256sum: "{{ redis_checksum|default(omit) }}"
19-
when:
20-
- not redis_tarball
21-
- ansible_version.major < 2
22-
23-
- name: download redis (ansible 2.x)
13+
- name: download redis
2414
get_url:
2515
url: "{{ redis_download_url }}"
2616
dest: /usr/local/src/redis-{{ redis_version }}.tar.gz
2717
checksum: "{{ redis_checksum|default(omit) }}"
28-
when:
29-
- not redis_tarball
30-
- ansible_version.major >= 2
18+
when: not redis_tarball
3119

3220
- name: upload redis
3321
copy:

0 commit comments

Comments
 (0)