mirror of
https://github.com/cgrates/cgrates.git
synced 2026-02-14 12:49:54 +05:00
Update ansible scripts to work on centOs
This commit is contained in:
committed by
Dan Christian Bogos
parent
7b01fb3918
commit
accc156fdf
@@ -21,7 +21,7 @@
|
||||
|
||||
- name: When starting fresh we need to make sure we have rng-tools
|
||||
become: true
|
||||
apt:
|
||||
yum:
|
||||
name: rng-tools
|
||||
state: present
|
||||
ignore_errors: true
|
||||
@@ -32,6 +32,7 @@
|
||||
path: /etc/default/rng-tools
|
||||
line: HRNGDEVICE=/dev/urandom
|
||||
insertafter: last
|
||||
create: yes
|
||||
|
||||
- name: generate randomness
|
||||
become: true
|
||||
|
||||
@@ -1,16 +1,3 @@
|
||||
---
|
||||
- name: Check and set python version on YUM server
|
||||
hosts: yum
|
||||
remote_user: '{{ gouser }}'
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: symlink /usr/bin/python -> /usr/bin/python3
|
||||
raw: |
|
||||
if [ -f /usr/bin/python3 ] && [ ! -f /usr/bin/python ]; then
|
||||
ln --symbolic /usr/bin/python3 /usr/bin/python;
|
||||
fi
|
||||
become: true
|
||||
|
||||
- name: Check and set python version on PKG server
|
||||
hosts: pkg
|
||||
remote_user: '{{ gouser }}'
|
||||
@@ -63,17 +50,6 @@
|
||||
|
||||
customPath: "{{ lookup('env','PATH') }}:{{ golang_gopath }}/bin:/usr/local/go/bin:{{ ansible_env.PATH }}"
|
||||
|
||||
dependencies:
|
||||
- build-essential
|
||||
- git
|
||||
- devscripts
|
||||
- nginx
|
||||
- rpm
|
||||
- createrepo
|
||||
- wget
|
||||
- sshpass
|
||||
- gnupg2
|
||||
|
||||
remote_user: '{{ gouser }}'
|
||||
tasks:
|
||||
- name: set cgrates cgrates_distribution
|
||||
@@ -82,13 +58,26 @@
|
||||
###########################################################################################################################
|
||||
###########################################################################################################################
|
||||
# install dependencies
|
||||
- name: Add epel-relase repo so we can install sshpass
|
||||
become: true
|
||||
shell: "yum install epel-release -y"
|
||||
|
||||
- name: Install dependencies
|
||||
become: yes
|
||||
apt: name={{ dependencies }} state=present
|
||||
yum:
|
||||
name:
|
||||
- git
|
||||
- nginx
|
||||
- rpm
|
||||
- rpm-sign
|
||||
- createrepo
|
||||
- wget
|
||||
- gnupg2
|
||||
- sshpass
|
||||
state: present
|
||||
###########################################################################################################################
|
||||
###########################################################################################################################
|
||||
# Prepare for configuration
|
||||
# get yum version
|
||||
- name: set cgrates distribution
|
||||
set_fact:
|
||||
cgrates_distribution: "{{ cgrates_branch }}"
|
||||
@@ -111,7 +100,7 @@
|
||||
|
||||
- name: Check if NGINX needs to be configured
|
||||
become: true
|
||||
shell: "ls /etc/nginx/sites-enabled | grep 'yum.cgrates.org.vhost'"
|
||||
shell: "ls /etc/nginx/conf.d/ | grep 'yum.cgrates.org.vhost.conf'"
|
||||
ignore_errors: true
|
||||
register: nginxConfig
|
||||
|
||||
@@ -216,13 +205,6 @@
|
||||
args:
|
||||
chdir: '{{ cgrates_dir }}'
|
||||
|
||||
- name: symbol link
|
||||
become: yes
|
||||
file:
|
||||
src: "{{ cgrates_dir }}/data"
|
||||
dest: "/usr/share/cgrates"
|
||||
state: link
|
||||
|
||||
- name: get git tag
|
||||
shell: "git tag -l --points-at HEAD"
|
||||
args:
|
||||
@@ -297,7 +279,7 @@
|
||||
register: yumFiles
|
||||
when : cgrates_branch == "master" or gitTagVar.stdout_lines|length > 0
|
||||
|
||||
# Clean the folder
|
||||
#Clean the folder
|
||||
- name: Clean the incoming folder
|
||||
become: yes
|
||||
shell: "sudo rm -rf /var/packages/yum/{{ cgrates_distribution }}/*"
|
||||
@@ -308,7 +290,7 @@
|
||||
command: mv cgr_build/RPMS/x86_64/{{ item }} /var/packages/yum/{{ cgrates_distribution }}/
|
||||
with_items: "{{ rmpFileName.stdout_lines }}"
|
||||
when: (cgrates_branch == "master" or gitTagVar.stdout_lines|length > 0) and rmpFileName.stdout_lines|length > 0
|
||||
|
||||
|
||||
- name: Include the package with createrepo
|
||||
become: yes
|
||||
shell: createrepo /var/packages/yum/{{ cgrates_distribution }}
|
||||
@@ -321,7 +303,7 @@
|
||||
state: absent
|
||||
with_items: "{{ rmpFileName.stdout_lines }}"
|
||||
when: cgrates_branch != "master" and gitTagVar.stdout_lines|length == 0
|
||||
|
||||
|
||||
- hosts: pkg
|
||||
remote_user: '{{ gouser }}'
|
||||
tasks:
|
||||
|
||||
@@ -3,17 +3,12 @@
|
||||
become: true
|
||||
template:
|
||||
src: nginx.conf.j2
|
||||
dest: "/etc/nginx/sites-available/yum.cgrates.org.vhost"
|
||||
dest: "/etc/nginx/conf.d/yum.cgrates.org.vhost.conf"
|
||||
mode: '0600'
|
||||
owner: "{{ rootUser }}"
|
||||
|
||||
- name: Create a symlink for yum.cgrates.org
|
||||
become: true
|
||||
file:
|
||||
src: "/etc/nginx/sites-available/yum.cgrates.org.vhost"
|
||||
dest: "/etc/nginx/sites-enabled/yum.cgrates.org.vhost"
|
||||
state: link
|
||||
|
||||
|
||||
- name: Restart the nginx so the change take effects
|
||||
become: true
|
||||
shell: "/etc/init.d/nginx reload"
|
||||
shell: "sudo systemctl restart nginx"
|
||||
|
||||
Reference in New Issue
Block a user