123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165 |
- ---
- - hosts: all
- become: yes
- become_user: root
- become_method: sudo
- gather_facts: yes
- vars:
- consul_server_nodes:
- - 10.161.8.1
- - 10.161.16.94
- - 10.161.13.176
- pre_tasks:
- - name: Update Apt Cache
- apt: update_cache=yes cache_valid_time=86400
- when: ansible_os_family == "Debian"
- - name: Ubuntu Packages
- apt: >
- pkg={{item}}
- state=present
- with_items:
- - build-essential
- - autoconf
- - automake
- - libbsd-dev
- - libltdl-dev
- - libltdl7
- - libtool
- - libevent-openssl-2.1-6
- - libpcre3-dev
- - libevent-dev
- - pkg-config
- - zlib1g-dev
- - libssl-dev
- tasks:
- - name: create redis user
- user:
- name: redis
- uid: 4001
- shell: /bin/bash
- state: present
- - name: checkout redis git repo
- git:
- repo: 'https://github.com/antirez/redis'
- dest: /home/redis/redis
- version: 6.0
- - name: Build the default target
- make:
- chdir: /home/redis/redis
- - name: Run 'install' target as root
- make:
- chdir: /home/redis/redis
- target: install
- become: yes
- - name: checkout memtier_benchmark git repo
- git:
- repo: 'https://github.com/RedisLabs/memtier_benchmark'
- dest: /home/redis/memtier_benchmark
- version: 1.2.17
- - name: Run the autoconf
- command: autoreconf -ivf
- args:
- chdir: /home/redis/memtier_benchmark
- creates: /home/redis/memtier_benchmark/configure
- - name: Run the configure script first
- command: ./configure
- args:
- chdir: /home/redis/memtier_benchmark
- creates: /home/redis/memtier_benchmark/Makefile
- - name: Build the default target
- make:
- chdir: /home/redis/memtier_benchmark
- - name: Run 'memtier_benchmark install' target as root
- make:
- chdir: /home/redis/memtier_benchmark
- target: install
- become: yes
- - name: checkout twemproxy git repo
- git:
- repo: 'https://github.com/twitter/twemproxy'
- dest: /home/redis/twemproxy
- version: master
- - name: Run the autoconf in twemproxy
- command: autoreconf -ivf
- args:
- chdir: /home/redis/twemproxy
- creates: /home/redis/twemproxy/configure
- - name: Run the twemproxy configure
- command: ./configure
- args:
- chdir: /home/redis/twemproxy
- creates: /home/redis/twemproxy/Makefile
- - name: Build the twemporxy target
- make:
- chdir: /home/redis/twemproxy
- - name: Run 'twemproxy install' target as root
- make:
- chdir: /home/redis/twemproxy
- target: install
- become: yes
- roles:
- - ntp
- # - { role: consul-template,
- # consul_template_consul_server: 10.161.8.1,
- # consul_template_use_upstart: false }
- post_tasks:
- - name: create the redis dir
- file:
- path: /redis
- owner: redis
- group: redis
- mode: '0755'
- state: directory
- - name: Twemproxy-Template Systemd
- template:
- src: systemd_twemproxy-template.j2
- dest: /lib/systemd/system/twemproxy-template.service
- owner: root
- group: root
- mode: 0644
- - name: Twemproxy Systemd
- template:
- src: systemd_twemproxy.j2
- dest: /lib/systemd/system/twemproxy.service
- owner: root
- group: root
- mode: 0644
- - name: copy the nutcracker template file
- copy:
- src: twemproxy.ctmpl
- dest: /etc/nutcracker.ctmpl
- owner: redis
- group: redis
- mode: '0644'
- - name: create a temporary twemproxy config file
- shell: "echo \"cpredis:\n listen: 0.0.0.0:2112\n servers:\n - localhost:19901:1\" > /etc/nutcracker.yml"
- args:
- creates: /etc/nutcracker.yml
- - name: Enable Twemproxy Service
- systemd:
- name: twemproxy.service
- enabled: yes
- state: started
- - name: Enable Twemproxy-Template Service
- systemd:
- name: twemproxy-template.service
- enabled: yes
- state: started
|