summaryrefslogtreecommitdiff
path: root/test/integration/targets/old_style_cache_plugins/setup_redis_cache.yml
blob: b7cd4831b415853d4a7affa7a37dfddf78a65c05 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
---
- hosts: localhost
  vars:
    make: "{{ ( ansible_distribution != 'FreeBSD' ) | ternary('make', 'gmake') }}"
  tasks:
    - name: name ensure make is available
      command: "which {{ make }}"
      register: has_make
      ignore_errors: yes

    - command: apk add --no-cache make
      when: "has_make is failed and ansible_distribution == 'Alpine'"
      become: yes

    - package:
        name: "{{ make }}"
        state: present
      become: yes
      when: "has_make is failed and ansible_distribution != 'Alpine'"

    - name: get the latest stable redis server release
      get_url:
        url: https://download.redis.io/redis-stable.tar.gz
        dest: ./
        timeout: 60

    - name: unzip download
      unarchive:
        src: redis-stable.tar.gz
        dest: ./

    - command: "{{ make }}"
      args:
        chdir: redis-stable

    - name: copy the executable into the path
      copy:
        src: "redis-stable/src/{{ item }}"
        dest: /usr/local/bin/
        mode: 755
      become: yes
      loop:
        - redis-server
        - redis-cli

    - name: start the redis server in the background
      command: redis-server --daemonize yes

    - name: install dependency for the cache plugin
      pip:
        name: redis>2.4.5
        state: present