Updated ansible for integration tests

This commit is contained in:
Trial97
2021-05-19 19:21:39 +03:00
committed by Dan Christian Bogos
parent 1175f5fdc6
commit ebdd3a0216
11 changed files with 61 additions and 16 deletions

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -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 }}"

View File

@@ -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 }}"

View File

@@ -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
state: present
- name: Enable mongod service and ensure it is not masked
become: yes
systemd:
name: mongod
state: started
enabled: yes
masked: no

View File

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

View File

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