Browse Source

not working yet

Chris Mague 4 years ago
parent
commit
fc7d4853e4
4 changed files with 134 additions and 0 deletions
  1. 13 0
      packaging/Vagrantfile
  2. 2 0
      packaging/tests/inventory
  3. 1 0
      packaging/tests/roles/CPRedis
  4. 118 0
      packaging/tests/test.yml

+ 13 - 0
packaging/Vagrantfile

@@ -0,0 +1,13 @@
+# -*- mode: ruby -*-
+# vi: set ft=ruby :
+
+Vagrant.configure("2") do |config|
+  config.vm.box = "bento/centos-7.7"
+
+  config.vm.provision "ansible" do |ansible|
+    ansible.playbook           = "tests/test.yml"
+    ansible.become             = "true"
+    ansible.compatibility_mode = "2.0"
+  end
+
+end

+ 2 - 0
packaging/tests/inventory

@@ -0,0 +1,2 @@
+localhost
+

+ 1 - 0
packaging/tests/roles/CPRedis

@@ -0,0 +1 @@
+../../../../cpredis

+ 118 - 0
packaging/tests/test.yml

@@ -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
+