|
@@ -0,0 +1,118 @@
|
|
|
+---
|
|
|
+- hosts: all
|
|
|
+ become: yes
|
|
|
+ become_user: root
|
|
|
+ become_method: sudo
|
|
|
+ gather_facts: yes
|
|
|
+
|
|
|
+ vars:
|
|
|
+ ruby_version: "2.1.3"
|
|
|
+ rvm_path: "/usr/local/rvm/gems/ruby-{{ ruby_version }}/bin:/usr/local/rvm/gems/ruby-{{ ruby_version }}@global/bin:/usr/local/rvm/"
|
|
|
+ raft_repo: "https://github.com/yossigo/redisraft"
|
|
|
+ raft_branch: "cluster"
|
|
|
+ mypkgs:
|
|
|
+ - git
|
|
|
+ - gcc
|
|
|
+ - make
|
|
|
+ - rpm-build
|
|
|
+ - autoconf
|
|
|
+ - automake
|
|
|
+ - libedit
|
|
|
+ - openssl-devel
|
|
|
+ - epel-release
|
|
|
+ - libbsd-devel
|
|
|
+ - libbsd
|
|
|
+ - curl
|
|
|
+ - gnupg2
|
|
|
+
|
|
|
+ pre_tasks:
|
|
|
+
|
|
|
+ - name: RedHat Dev Tools
|
|
|
+ yum:
|
|
|
+ name: "@Development tools"
|
|
|
+ state: present
|
|
|
+
|
|
|
+ - name: RedHat Packages
|
|
|
+ package:
|
|
|
+ name: "{{ mypkgs }}"
|
|
|
+
|
|
|
+ - name: Get cmake version
|
|
|
+ unarchive:
|
|
|
+ src: "https://cmake.org/files/v3.19/cmake-3.19.1.tar.gz"
|
|
|
+ dest: /usr/local/share/
|
|
|
+ remote_src: yes
|
|
|
+
|
|
|
+ - name: Bootstrap cmake
|
|
|
+ command: "./bootstrap"
|
|
|
+ args:
|
|
|
+ chdir: /usr/local/share/cmake-3.19.1
|
|
|
+ creates: /usr/local/share/cmake-3.19.1/Makefile
|
|
|
+
|
|
|
+ - name: Cmake - Build install
|
|
|
+ make:
|
|
|
+ chdir: /usr/local/share/cmake-3.19.1
|
|
|
+ target: install
|
|
|
+
|
|
|
+ - name: Link cmake
|
|
|
+ file:
|
|
|
+ src: /usr/local/bin/cmake
|
|
|
+ dest: /usr/bin/cmake
|
|
|
+ state: link
|
|
|
+
|
|
|
+ tasks:
|
|
|
+
|
|
|
+ - name: raft - clone the github repo
|
|
|
+ git:
|
|
|
+ repo: "{{raft_repo}}"
|
|
|
+ dest: /home/redis/redisraft
|
|
|
+ version: "{{raft_branch}}"
|
|
|
+ recursive: yes
|
|
|
+ update: yes
|
|
|
+ force: yes
|
|
|
+
|
|
|
+ - name: raft - make
|
|
|
+ make:
|
|
|
+ chdir: /home/redis/redisraft
|
|
|
+
|
|
|
+ - name: checkout redis git repo
|
|
|
+ git:
|
|
|
+ repo: 'https://github.com/redis/redis'
|
|
|
+ dest: /home/redis/redis
|
|
|
+
|
|
|
+ - name: redis - Build the default target
|
|
|
+ make:
|
|
|
+ chdir: /home/redis/redis
|
|
|
+
|
|
|
+
|
|
|
+ - name: append rvm path to environment
|
|
|
+ lineinfile: dest=/etc/environment state=present backrefs=yes regexp='PATH=(["]*)((?!.*?{{rvm_path}}).*?)(["]*)$' line="PATH=\1\2:{{rvm_path}}\3"
|
|
|
+
|
|
|
+ - name: ensure that GPG key for RVM is installed
|
|
|
+ command: gpg2 --keyserver hkp://keys.gnupg.net --recv-keys D39DC0E3
|
|
|
+ args:
|
|
|
+ creates: /root/.gnupg/secring.gpg
|
|
|
+
|
|
|
+ - name: ensure that RVM is installed
|
|
|
+ shell: curl -L get.rvm.io | bash -s stable
|
|
|
+ args:
|
|
|
+ creates: /usr/local/rvm
|
|
|
+
|
|
|
+ - name: ensure that ruby is installed
|
|
|
+ command: "rvm install {{ ruby_version }}"
|
|
|
+ args:
|
|
|
+ creates: "/usr/local/rvm/gems/ruby-{{ ruby_version }}"
|
|
|
+ environment:
|
|
|
+ PATH: "{{ rvm_path }}:{{ ansible_env.PATH }}"
|
|
|
+
|
|
|
+ - name: set default version of ruby with rvm
|
|
|
+ command: "rvm alias create default ruby-{{ ruby_version }}"
|
|
|
+ args:
|
|
|
+ creates: /usr/local/rvm/config/alias
|
|
|
+ environment:
|
|
|
+ PATH: "{{ rvm_path }}:{{ ansible_env.PATH }}"
|
|
|
+
|
|
|
+ - name: Install FPM
|
|
|
+ community.general.gem:
|
|
|
+ name: fpm
|
|
|
+ state: present
|
|
|
+
|