Showing
3 changed files
with
21 additions
and
12 deletions
No preview for this file type
@@ -13,6 +13,10 @@ | @@ -13,6 +13,10 @@ | ||
13 | stat: path=/Data/local/redis/bin/redis-server | 13 | stat: path=/Data/local/redis/bin/redis-server |
14 | register: redis_binary | 14 | register: redis_binary |
15 | 15 | ||
16 | +- name: Check if twemproxy already installed | ||
17 | + stat: path=/Data/local/twemproxy/sbin/nutcracker | ||
18 | + register: nutcracker_binary | ||
19 | + | ||
16 | - name: Upload redis source package | 20 | - name: Upload redis source package |
17 | copy: | 21 | copy: |
18 | src: "redis-3.2.12.tar.gz" | 22 | src: "redis-3.2.12.tar.gz" |
@@ -20,6 +24,13 @@ | @@ -20,6 +24,13 @@ | ||
20 | mode: 0755 | 24 | mode: 0755 |
21 | when: redis_binary.stat.exists == False | 25 | when: redis_binary.stat.exists == False |
22 | 26 | ||
27 | +- name: Upload twemproxy source package | ||
28 | + copy: | ||
29 | + src: "nutcracker-0.4.1.tar.gz" | ||
30 | + dest: "/root/nutcracker-0.4.1.tar.gz" | ||
31 | + mode: 0755 | ||
32 | + when: nutcracker_binary.stat.exists == False | ||
33 | + | ||
23 | - name: Decompress and install redis | 34 | - name: Decompress and install redis |
24 | shell: cd /root/ && mkdir -p /Data/local/ && tar -zxvf redis-3.2.12.tar.gz && cd redis-3.2.12 && make && make PREFIX=/Data/local/redis install && mkdir -p /Data/local/redis/conf /Data/logs/redis/ /Data/local/redis/data | 35 | shell: cd /root/ && mkdir -p /Data/local/ && tar -zxvf redis-3.2.12.tar.gz && cd redis-3.2.12 && make && make PREFIX=/Data/local/redis install && mkdir -p /Data/local/redis/conf /Data/logs/redis/ /Data/local/redis/data |
25 | when: redis_binary.stat.exists == False | 36 | when: redis_binary.stat.exists == False |
@@ -37,19 +48,15 @@ | @@ -37,19 +48,15 @@ | ||
37 | state: installed | 48 | state: installed |
38 | update_cache: yes | 49 | update_cache: yes |
39 | 50 | ||
40 | -- name: Check if twemproxy already installed | ||
41 | - stat: path=/Data/local/twemproxy/sbin/nutcracker | ||
42 | - register: nutcracker_binary | ||
43 | - | ||
44 | -- name: Download latest twemproxy | ||
45 | - git: | ||
46 | - repo: https://github.com/twitter/twemproxy.git | ||
47 | - dest: /root/twemproxy | ||
48 | - accept_hostkey: true | ||
49 | - when: nutcracker_binary.stat.exists == False | 51 | +#- name: Download latest twemproxy |
52 | +# git: | ||
53 | +# repo: https://github.com/twitter/twemproxy.git | ||
54 | +# dest: /root/twemproxy | ||
55 | +# accept_hostkey: true | ||
56 | +# when: nutcracker_binary.stat.exists == False | ||
50 | 57 | ||
51 | - name: Install twemproxy | 58 | - name: Install twemproxy |
52 | - shell: cd /root/twemproxy && autoreconf268 -ivf && ./configure --prefix=/Data/local/twemproxy && make && make install && mkdir -p /Data/local/twemproxy/conf | 59 | + shell: cd /root/ && tar -zxvf nutcracker-0.4.1.tar.gz && cd nutcracker-0.4.1 && autoreconf268 -ivf && ./configure --prefix=/Data/local/twemproxy && make && make install && mkdir -p /Data/local/twemproxy/conf |
53 | when: nutcracker_binary.stat.exists == False | 60 | when: nutcracker_binary.stat.exists == False |
54 | 61 | ||
55 | - name: Update twemproxy configuration file | 62 | - name: Update twemproxy configuration file |
@@ -7,6 +7,8 @@ alpha: | @@ -7,6 +7,8 @@ alpha: | ||
7 | server_retry_timeout: 2000 | 7 | server_retry_timeout: 2000 |
8 | server_failure_limit: 2 | 8 | server_failure_limit: 2 |
9 | servers: | 9 | servers: |
10 | +{% set num = 1 %} | ||
10 | {% for host in play_hosts %} | 11 | {% for host in play_hosts %} |
11 | - - {{ host }}:6379:1 | 12 | + - {{ host }}:6379:1 {{ group_names[0] }}{{ num }} |
13 | +{% set num = num+1 %} | ||
12 | {% endfor %} | 14 | {% endfor %} |
-
Please register or login to post a comment