From ebdd3a021672f4fab24cd31e020ebcbac35d9278 Mon Sep 17 00:00:00 2001 From: Trial97 Date: Wed, 19 May 2021 19:21:39 +0300 Subject: [PATCH] Updated ansible for integration tests --- data/ansible/calls/asterisk/main.yaml | 2 +- data/ansible/calls/freeswitch/main.yaml | 2 +- data/ansible/calls/kamailio/main.yaml | 2 +- data/ansible/deb_packages/main.yaml | 2 +- data/ansible/docker/main.yaml | 2 +- data/ansible/drone/main.yaml | 2 +- data/ansible/integration_tests/kafka.yaml | 7 +++++++ data/ansible/integration_tests/main.yaml | 21 ++++++++++++++++++-- data/ansible/integration_tests/mongo.yaml | 19 ++++++++++++++---- data/ansible/integration_tests/rabbitmq.yaml | 16 ++++++++++++--- data/ansible/rpm_packages/main.yaml | 2 +- 11 files changed, 61 insertions(+), 16 deletions(-) diff --git a/data/ansible/calls/asterisk/main.yaml b/data/ansible/calls/asterisk/main.yaml index 4a9ea2852..e6f8b1dc7 100644 --- a/data/ansible/calls/asterisk/main.yaml +++ b/data/ansible/calls/asterisk/main.yaml @@ -5,7 +5,7 @@ ##################### Golang Vars ############################# ############################################################### # Go language SDK version number - golang_version: '1.16.1' + golang_version: '1.16.3' go_version_target: "go version go{{ golang_version }} linux/amd64" # Mirror to download the Go language SDK redistributable package from golang_mirror: 'https://storage.googleapis.com/golang' diff --git a/data/ansible/calls/freeswitch/main.yaml b/data/ansible/calls/freeswitch/main.yaml index a93487a1c..45f5db074 100644 --- a/data/ansible/calls/freeswitch/main.yaml +++ b/data/ansible/calls/freeswitch/main.yaml @@ -5,7 +5,7 @@ ##################### Golang Vars ############################# ############################################################### # Go language SDK version number - golang_version: '1.16.1' + golang_version: '1.16.3' go_version_target: "go version go{{ golang_version }} linux/amd64" # Mirror to download the Go language SDK redistributable package from golang_mirror: 'https://storage.googleapis.com/golang' diff --git a/data/ansible/calls/kamailio/main.yaml b/data/ansible/calls/kamailio/main.yaml index c9729c5e9..0420619a9 100644 --- a/data/ansible/calls/kamailio/main.yaml +++ b/data/ansible/calls/kamailio/main.yaml @@ -5,7 +5,7 @@ ##################### Golang Vars ############################# ############################################################### # Go language SDK version number - golang_version: '1.16.1' + golang_version: '1.16.3' go_version_target: "go version go{{ golang_version }} linux/amd64" # Mirror to download the Go language SDK redistributable package from golang_mirror: 'https://storage.googleapis.com/golang' diff --git a/data/ansible/deb_packages/main.yaml b/data/ansible/deb_packages/main.yaml index 372b32654..e487ff754 100644 --- a/data/ansible/deb_packages/main.yaml +++ b/data/ansible/deb_packages/main.yaml @@ -29,7 +29,7 @@ ##################### Golang Vars ############################# ############################################################### # Go language SDK version number - golang_version: '1.16.1' + golang_version: '1.16.3' go_version_target: "go version go{{ golang_version }} linux/amd64" # Mirror to download the Go language SDK redistributable package from golang_mirror: 'https://storage.googleapis.com/golang' diff --git a/data/ansible/docker/main.yaml b/data/ansible/docker/main.yaml index 24f9139c6..5aae0a5d9 100644 --- a/data/ansible/docker/main.yaml +++ b/data/ansible/docker/main.yaml @@ -17,7 +17,7 @@ ##################### Golang Vars ############################# ############################################################### # Go language SDK version number - golang_version: '1.16.1' + golang_version: '1.16.3' go_version_target: "go version go{{ golang_version }} linux/amd64" # Mirror to download the Go language SDK redistributable package from golang_mirror: 'https://storage.googleapis.com/golang' diff --git a/data/ansible/drone/main.yaml b/data/ansible/drone/main.yaml index 6d07135bc..5a03ad531 100644 --- a/data/ansible/drone/main.yaml +++ b/data/ansible/drone/main.yaml @@ -17,7 +17,7 @@ ##################### Golang Vars ############################# ############################################################### # Go language SDK version number - golang_version: '1.16.1' + golang_version: '1.16.3' go_version_target: "go version go{{ golang_version }} linux/amd64" # Mirror to download the Go language SDK redistributable package from golang_mirror: 'https://storage.googleapis.com/golang' diff --git a/data/ansible/integration_tests/kafka.yaml b/data/ansible/integration_tests/kafka.yaml index 89aaa33a2..4967610d6 100644 --- a/data/ansible/integration_tests/kafka.yaml +++ b/data/ansible/integration_tests/kafka.yaml @@ -1,20 +1,24 @@ --- - name: Ensure group "kafka" exists + become: yes group: name: "{{ kafka_user }}" state: present - name: Add the user 'kafka' + become: yes user: name: "{{ kafka_user }}" # password: "{{ kafka_user_password }}" groups: "sudo,{{ kafka_user }}" - name: Install the java + become: yes apt: name: default-jdk - name: Ensure download folder + become: yes file: state: directory mode: 'u=rwx,go=rx' @@ -23,11 +27,13 @@ path: "{{ kafka_download_folder }}" - name: Fetch kafka binary package + become: yes get_url: dest: "{{ kafka_download_folder }}/{{ kafka_base_name }}.tgz" url: "{{ kafka_url }}" - name: Uncompress the kafka tar + become: yes unarchive: copy: no creates: "/home/{{ kafka_user }}/{{ kafka_base_name }}" @@ -38,6 +44,7 @@ group: "{{ kafka_user }}" - name: Link kafka to the right version + become: yes file: path: "{{ kafka_install_folder }}/kafka" src: "{{ kafka_install_folder }}/{{ kafka_base_name }}" diff --git a/data/ansible/integration_tests/main.yaml b/data/ansible/integration_tests/main.yaml index 772d5e26c..b0639f96a 100644 --- a/data/ansible/integration_tests/main.yaml +++ b/data/ansible/integration_tests/main.yaml @@ -1,11 +1,11 @@ --- -- hosts: all +- hosts: local vars: ############################################################### ##################### Golang Vars ############################# ############################################################### # Go language SDK version number - golang_version: '1.16.1' + golang_version: '1.16.3' go_version_target: "go version go{{ golang_version }} linux/amd64" # Mirror to download the Go language SDK redistributable package from golang_mirror: 'https://storage.googleapis.com/golang' @@ -42,15 +42,18 @@ ########################################################################################################################### # install dependencies - name: Install build-essential + become: yes apt: name: build-essential state: present - name: Install the git + become: yes apt: name: git - name: Install the redis + become: yes apt: name: redis-server @@ -59,14 +62,17 @@ # name: mongodb-server - name: Install the mysql + become: yes apt: name: mariadb-server - name: Install the postgresql + become: yes apt: name: postgresql - name: Install the postgresql-contrib + become: yes apt: name: postgresql-contrib @@ -117,10 +123,13 @@ - name: build cgrates command: 'sh {{ cgrates_dir }}/build.sh' + environment: + PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}" args: chdir: '{{ cgrates_dir }}' - name: symbol link + become: yes file: src: "{{ cgrates_dir }}/data" dest: "/usr/share/cgrates" @@ -130,16 +139,24 @@ ########################################################################################################################### # post install - name: post install mysql + become: yes command: 'sh {{ cgrates_dir }}/data/storage/mysql/setup_cgr_db.sh root CGRateS.org localhost' args: chdir: '{{ cgrates_dir }}/data/storage/mysql/' - name: post install postgres2 + become: yes command: 'sh {{ cgrates_dir }}/data/storage/postgres/create_db_with_users.sh' args: chdir: '{{ cgrates_dir }}/data/storage/postgres/' - name: post install mongo + become: yes command: 'sh {{ cgrates_dir }}/data/storage/mongo/setup_cgr_db.sh' args: chdir: '{{ cgrates_dir }}/data/storage/mongo/' + + - name: set versions + command: 'cgr-migrator -exec=*set_versions -config_path=/usr/share/cgrates/conf/samples/tutmysql' + environment: + PATH: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}" \ No newline at end of file diff --git a/data/ansible/integration_tests/mongo.yaml b/data/ansible/integration_tests/mongo.yaml index c6879c612..b6ca5fa80 100644 --- a/data/ansible/integration_tests/mongo.yaml +++ b/data/ansible/integration_tests/mongo.yaml @@ -1,16 +1,27 @@ --- - name: Add an apt key for MongoDB + become: yes apt_key: - url: https://www.mongodb.org/static/pgp/server-4.0.asc + url: https://www.mongodb.org/static/pgp/server-4.4.asc state: present - name: Add apt repository for MongoDB + become: yes apt_repository: - repo: "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/4.0 main" - filename: mongodb-org-4.0 + repo: "deb http://repo.mongodb.org/apt/debian {{ ansible_distribution_release }}/mongodb-org/4.4 main" + filename: mongodb-org-4.4 update_cache: yes - name: Install MongoDB + become: yes apt: name: "mongodb-org" - state: present \ No newline at end of file + state: present + +- name: Enable mongod service and ensure it is not masked + become: yes + systemd: + name: mongod + state: started + enabled: yes + masked: no \ No newline at end of file diff --git a/data/ansible/integration_tests/rabbitmq.yaml b/data/ansible/integration_tests/rabbitmq.yaml index 886fa4a74..affdb64e9 100644 --- a/data/ansible/integration_tests/rabbitmq.yaml +++ b/data/ansible/integration_tests/rabbitmq.yaml @@ -1,26 +1,36 @@ --- - name: Add an apt key by id for rabbitmq + become: yes apt_key: - url: https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc + url: "{{ item }}" state: present + with_items: + - https://github.com/rabbitmq/signing-keys/releases/download/2.0/rabbitmq-release-signing-key.asc + - https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/gpg.E495BB49CC4BBE5B.key + - https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/gpg.9F4587F226208342.key + - name: Install the apt-transport-https + become: yes apt: name: apt-transport-https - name: Add apt repository for erlang + become: yes apt_repository: - repo: "deb https://dl.bintray.com/rabbitmq-erlang/debian {{ ansible_distribution_release }} erlang-21.x" + repo: "deb https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-erlang/deb/debian {{ ansible_distribution_release }} main" filename: rabbitmq_erlang update_cache: no - name: Add apt repository for rabbitmq + become: yes apt_repository: - repo: "deb https://dl.bintray.com/rabbitmq/debian {{ ansible_distribution_release }} main" + repo: "deb https://dl.cloudsmith.io/public/rabbitmq/rabbitmq-server/deb/debian {{ ansible_distribution_release }} main" filename: rabbitmq_main update_cache: yes - name: Install RabbitMQ + become: yes apt: name: "rabbitmq-server" state: present \ No newline at end of file diff --git a/data/ansible/rpm_packages/main.yaml b/data/ansible/rpm_packages/main.yaml index 13ba69933..28b8f7a5f 100644 --- a/data/ansible/rpm_packages/main.yaml +++ b/data/ansible/rpm_packages/main.yaml @@ -16,7 +16,7 @@ ##################### Golang Vars ############################# ############################################################### # Go language SDK version number - golang_version: '1.16.1' + golang_version: '1.16.3' go_version_target: "go version go{{ golang_version }} linux/amd64" # Mirror to download the Go language SDK redistributable package from golang_mirror: 'https://storage.googleapis.com/golang'