mirror of
https://github.com/ZwareBear/JFrog-Cloud-Installers.git
synced 2026-01-21 11:06:56 -06:00
[ansible] JFrog Platform 7.18.6
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
# Xray
|
||||
The xray role will install Xray software onto the host. An Artifactory server and Postgress database is required.
|
||||
|
||||
### Role Variables
|
||||
* _xray_upgrade_only_: Perform an software upgrade only. Default is false.
|
||||
|
||||
Additional variables can be found in [defaults/main.yml](./defaults/main.yml).
|
||||
## Example Playbook
|
||||
```
|
||||
---
|
||||
- hosts: xray_servers
|
||||
roles:
|
||||
- xray
|
||||
```
|
||||
|
||||
## Upgrades
|
||||
The Xray role supports software upgrades. To use a role to perform a software upgrade only, use the _xray_upgrade_only_ variables and specify the version. See the following example.
|
||||
|
||||
```
|
||||
- hosts: xray_servers
|
||||
vars:
|
||||
xray_version: "{{ lookup('env', 'xray_version_upgrade') }}"
|
||||
xray_upgrade_only: true
|
||||
roles:
|
||||
- xray
|
||||
```
|
||||
@@ -0,0 +1,104 @@
|
||||
---
|
||||
# defaults file for xray
|
||||
# indicates were this collection was downlaoded from (galaxy, automation_hub, standalone)
|
||||
ansible_marketplace: standalone
|
||||
|
||||
# whether to enable HA
|
||||
xray_ha_enabled: false
|
||||
|
||||
xray_ha_node_type : master
|
||||
|
||||
# The location where xray should install.
|
||||
jfrog_home_directory: /opt/jfrog
|
||||
|
||||
# The remote xray download file
|
||||
xray_tar: https://releases.jfrog.io/artifactory/jfrog-xray/xray-linux/{{ xray_version }}/jfrog-xray-{{ xray_version }}-linux.tar.gz
|
||||
|
||||
#The xray install directory
|
||||
xray_untar_home: "{{ jfrog_home_directory }}/jfrog-xray-{{ xray_version }}-linux"
|
||||
xray_home: "{{ jfrog_home_directory }}/xray"
|
||||
|
||||
xray_install_script_path: "{{ xray_home }}/app/bin"
|
||||
xray_thirdparty_path: "{{ xray_home }}/app/third-party"
|
||||
xray_archive_service_cmd: "{{ xray_install_script_path }}/installService.sh"
|
||||
|
||||
#xray users and groups
|
||||
xray_user: xray
|
||||
xray_group: xray
|
||||
|
||||
xray_uid: 1035
|
||||
xray_gid: 1035
|
||||
|
||||
xray_daemon: xray
|
||||
|
||||
flow_type: archive
|
||||
|
||||
#rabbitmq user
|
||||
xray_rabbitmq_user: guest
|
||||
xray_rabbitmq_password: guest
|
||||
xray_rabbitmq_url: "amqp://localhost:5672/"
|
||||
xray_rabbitmq_default_cookie: "XRAY_RABBITMQ_COOKIE"
|
||||
|
||||
# if this is an upgrade
|
||||
xray_upgrade_only: false
|
||||
|
||||
xray_system_yaml_template: system.yaml.j2
|
||||
|
||||
linux_distro: "{{ ansible_distribution | lower }}{{ansible_distribution_major_version}}"
|
||||
|
||||
xray_db_util_search_filter:
|
||||
ubuntu16:
|
||||
db5: 'db5.3-util.*ubuntu.*amd64\.deb'
|
||||
db: 'db-util.*ubuntu.*all.deb'
|
||||
ubuntu18:
|
||||
db5: 'db5.3-util.*ubuntu.*amd64\.deb'
|
||||
db: 'db-util.*ubuntu.*all.deb'
|
||||
ubuntu20:
|
||||
db5: 'db5.3-util.*ubuntu.*amd64\.deb'
|
||||
db: 'db-util.*ubuntu.*all.deb'
|
||||
debian8:
|
||||
db5: 'db5.3-util.*deb8.*amd64\.deb'
|
||||
db: 'db-util_([0-9]{1,3}\.?){3}_all\.deb'
|
||||
debian9:
|
||||
db5: 'db5.3-util.*deb9.*amd64\.deb'
|
||||
db: 'db-util_([0-9]{1,3}\.?){3}_all\.deb'
|
||||
debian10:
|
||||
db5: 'TBD'
|
||||
db: 'db-util_([0-9]{1,3}\.?){3}.*nmu1_all\.deb'
|
||||
|
||||
|
||||
yum_python_interpreter: >-
|
||||
{%- if linux_distro is not defined -%}
|
||||
/usr/bin/python3
|
||||
{%- elif linux_distro in ['centos7', 'rhel7'] -%}
|
||||
/usr/bin/python
|
||||
{%- else -%}
|
||||
/usr/bin/python3
|
||||
{%- endif -%}
|
||||
|
||||
# Provide systemyaml content below with 2-space indentation
|
||||
xray_systemyaml: |-
|
||||
configVersion: 1
|
||||
shared:
|
||||
jfrogUrl: {{ jfrog_url }}
|
||||
node:
|
||||
ip: {{ ansible_host }}
|
||||
id: {{ ansible_hostname }}
|
||||
database:
|
||||
type: "{{ xray_db_type }}"
|
||||
driver: "{{ xray_db_driver }}"
|
||||
url: "{{ xray_db_url }}"
|
||||
username: "{{ xray_db_user }}"
|
||||
password: "{{ xray_db_password }}"
|
||||
rabbitMq:
|
||||
autoStop: true
|
||||
erlangCookie:
|
||||
value: "{{ xray_rabbitmq_default_cookie }}"
|
||||
url: "{{ xray_rabbitmq_url }}"
|
||||
username: "{{ xray_rabbitmq_user }}"
|
||||
password: "{{xray_rabbitmq_password }}"
|
||||
security:
|
||||
joinKey: {{ join_key }}
|
||||
router:
|
||||
entrypoints:
|
||||
internalPort: 8046
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
# handlers file for xray
|
||||
- name: restart xray
|
||||
become: yes
|
||||
systemd:
|
||||
name: "{{ xray_daemon }}"
|
||||
state: restarted
|
||||
@@ -0,0 +1,16 @@
|
||||
galaxy_info:
|
||||
author: "JFrog Maintainers Team <installers@jfrog.com>"
|
||||
description: "The xray role will install Xray software onto the host. An Artifactory server and Postgress database is required."
|
||||
company: JFrog
|
||||
|
||||
issue_tracker_url: "https://github.com/jfrog/JFrog-Cloud-Installers/issues"
|
||||
|
||||
license: license (Apache-2.0)
|
||||
|
||||
min_ansible_version: 2.9
|
||||
|
||||
galaxy_tags:
|
||||
- xray
|
||||
- jfrog
|
||||
|
||||
dependencies: []
|
||||
@@ -0,0 +1,44 @@
|
||||
- name: Prepare expect scenario script
|
||||
set_fact:
|
||||
expect_scenario: |
|
||||
set timeout 300
|
||||
spawn {{ exp_executable_cmd }}
|
||||
expect_before timeout { exit 1 }
|
||||
set CYCLE_END 0
|
||||
set count 0
|
||||
|
||||
while { $CYCLE_END == 0 } {
|
||||
expect {
|
||||
{% for each_request in exp_scenarios %}
|
||||
-nocase -re {{ '{' }}{{ each_request.expecting }}.*} {
|
||||
send "{{ each_request.sending }}\n"
|
||||
}
|
||||
{% endfor %}
|
||||
eof {
|
||||
set CYCLE_END 1
|
||||
}
|
||||
}
|
||||
set count "[expr $count + 1]"
|
||||
if { $count > 16} {
|
||||
exit 128
|
||||
}
|
||||
}
|
||||
|
||||
expect eof
|
||||
lassign [wait] pid spawnid os_error_flag value
|
||||
|
||||
if {$os_error_flag == 0} {
|
||||
puts "INSTALLER_EXIT_STATUS-$value"
|
||||
} else {
|
||||
puts "INSTALLER_EXIT_STATUS-$value"
|
||||
}
|
||||
|
||||
- name: Interactive with expect
|
||||
become: yes
|
||||
ignore_errors: yes
|
||||
shell: |
|
||||
{{ expect_scenario }}
|
||||
args:
|
||||
executable: /usr/bin/expect
|
||||
chdir: "{{ exp_dir }}"
|
||||
register: exp_result
|
||||
@@ -0,0 +1,165 @@
|
||||
---
|
||||
- debug:
|
||||
msg: "Performing installation of Xray version : {{ xray_version }}"
|
||||
|
||||
- debug:
|
||||
msg: "ansible_os_family: {{ ansible_os_family }}"
|
||||
|
||||
- name: Install expect dependency
|
||||
become: yes
|
||||
yum:
|
||||
name: expect
|
||||
state: present
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Install expect dependency
|
||||
become: yes
|
||||
apt:
|
||||
name: expect
|
||||
state: present
|
||||
update_cache: yes
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Ensure group xray exist
|
||||
become: yes
|
||||
group:
|
||||
name: "{{ xray_group }}"
|
||||
gid: "{{ xray_gid }}"
|
||||
state: present
|
||||
|
||||
- name: Ensure user xray exist
|
||||
become: yes
|
||||
user:
|
||||
uid: "{{ xray_uid }}"
|
||||
name: "{{ xray_user }}"
|
||||
group: "{{ xray_group }}"
|
||||
create_home: yes
|
||||
home: "{{ xray_home }}"
|
||||
shell: /bin/bash
|
||||
state: present
|
||||
|
||||
- name: Download xray
|
||||
become: yes
|
||||
unarchive:
|
||||
src: "{{ xray_tar }}"
|
||||
dest: "{{ jfrog_home_directory }}"
|
||||
remote_src: yes
|
||||
owner: "{{ xray_user }}"
|
||||
group: "{{ xray_group }}"
|
||||
creates: "{{ xray_untar_home }}"
|
||||
register: downloadxray
|
||||
until: downloadxray is succeeded
|
||||
retries: 3
|
||||
|
||||
- name: Check if app directory exists
|
||||
become: yes
|
||||
stat:
|
||||
path: "{{ xray_home }}/app"
|
||||
register: app_dir_check
|
||||
|
||||
- name: Copy untar directory to xray home
|
||||
become: yes
|
||||
command: "cp -r {{ xray_untar_home }}/. {{ xray_home }}"
|
||||
when: not app_dir_check.stat.exists
|
||||
|
||||
- name: Create required directories
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
owner: "{{ xray_user }}"
|
||||
group: "{{ xray_group }}"
|
||||
loop:
|
||||
- "{{ xray_home }}/var/etc"
|
||||
- "{{ xray_home }}/var/etc/info/"
|
||||
- "{{ xray_home }}/var/etc/security/"
|
||||
|
||||
- name: Configure master key
|
||||
become: yes
|
||||
copy:
|
||||
dest: "{{ xray_home }}/var/etc/security/master.key"
|
||||
content: |
|
||||
{{ master_key }}
|
||||
owner: "{{ xray_user }}"
|
||||
group: "{{ xray_group }}"
|
||||
mode: 0640
|
||||
|
||||
- name: Setup rabbitmq
|
||||
import_tasks: rabbitmq/setup/RedHat.yml
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Setup rabbitmq
|
||||
import_tasks: rabbitmq/setup/Debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Check if install.sh wrapper script exist
|
||||
become: yes
|
||||
stat:
|
||||
path: "{{ xray_install_script_path }}/install.sh"
|
||||
register: install_wrapper_script
|
||||
|
||||
- name: Include interactive installer scripts
|
||||
include_vars: script/archive.yml
|
||||
|
||||
- name: Install xray
|
||||
include_tasks: expect.yml
|
||||
vars:
|
||||
exp_executable_cmd: "./install.sh -u {{ xray_user }} -g {{ xray_group }}"
|
||||
exp_dir: "{{ xray_install_script_path }}"
|
||||
exp_scenarios: "{{ xray_installer_scenario['main'] }}"
|
||||
args:
|
||||
apply:
|
||||
environment:
|
||||
YQ_PATH: "{{ xray_thirdparty_path }}/yq"
|
||||
when: install_wrapper_script.stat.exists
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Configure rabbitmq config
|
||||
become: yes
|
||||
template:
|
||||
src: "rabbitmq.conf.j2"
|
||||
dest: "{{ xray_home }}/app/bin/rabbitmq/rabbitmq.conf"
|
||||
notify: restart xray
|
||||
|
||||
- name: Configure systemyaml
|
||||
become: yes
|
||||
template:
|
||||
src: "{{ xray_system_yaml_template }}"
|
||||
dest: "{{ xray_home }}/var/etc/system.yaml"
|
||||
notify: restart xray
|
||||
|
||||
- name: Configure installer info
|
||||
become: yes
|
||||
template:
|
||||
src: installer-info.json.j2
|
||||
dest: "{{ xray_home }}/var/etc/info/installer-info.json"
|
||||
notify: restart xray
|
||||
|
||||
- name: Ensure permissions are correct
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ jfrog_home_directory }}"
|
||||
state: directory
|
||||
owner: "{{ xray_user }}"
|
||||
group: "{{ xray_group }}"
|
||||
recurse: yes
|
||||
|
||||
- name: Install xray as a service
|
||||
become: yes
|
||||
shell: |
|
||||
{{ xray_archive_service_cmd }}
|
||||
args:
|
||||
chdir: "{{ xray_install_script_path }}"
|
||||
register: check_service_status_result
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Restart xray
|
||||
meta: flush_handlers
|
||||
|
||||
- name : Wait for xray to be fully deployed
|
||||
uri: url=http://127.0.0.1:8082/router/api/v1/system/health timeout=130
|
||||
register: result
|
||||
until: result.status == 200
|
||||
retries: 25
|
||||
delay: 5
|
||||
@@ -0,0 +1,6 @@
|
||||
- name: perform installation
|
||||
include_tasks: "install.yml"
|
||||
when: not xray_upgrade_only
|
||||
- name: perform upgrade
|
||||
include_tasks: "upgrade.yml"
|
||||
when: xray_upgrade_only
|
||||
@@ -0,0 +1,63 @@
|
||||
- name: Check rabbitmq cluster_keepalive_interval option
|
||||
become: yes
|
||||
ignore_errors: yes
|
||||
shell: |
|
||||
./rabbitmqctl --erlang-cookie {{ xray_rabbitmq_default_cookie }} eval \
|
||||
'application:get_env(rabbit, cluster_keepalive_interval).' \
|
||||
| tr -d '}{' | cut -d ',' -f2
|
||||
args:
|
||||
chdir: "{{ xray_home }}/app/third-party/rabbitmq/sbin/"
|
||||
environment:
|
||||
LC_ALL: en_US.UTF-8
|
||||
LC_CTYPE: en_US.UTF-8
|
||||
register: cluster_keepalive_interval_value
|
||||
|
||||
- name: Check rabbitmq handshake_timeout option
|
||||
become: yes
|
||||
ignore_errors: yes
|
||||
shell: |
|
||||
./rabbitmqctl --erlang-cookie {{ xray_rabbitmq_default_cookie }} eval \
|
||||
'application:get_env(rabbit, handshake_timeout).' \
|
||||
| tr -d '}{' | cut -d ',' -f2
|
||||
args:
|
||||
chdir: "{{ xray_home }}/app/third-party/rabbitmq/sbin/"
|
||||
environment:
|
||||
LC_ALL: en_US.UTF-8
|
||||
LC_CTYPE: en_US.UTF-8
|
||||
register: handshake_timeout_value
|
||||
|
||||
- name: Check rabbitmq vm_memory_high_watermark.relative option
|
||||
become: yes
|
||||
ignore_errors: yes
|
||||
shell: |
|
||||
./rabbitmqctl --erlang-cookie {{ xray_rabbitmq_default_cookie }} eval \
|
||||
'application:get_env(rabbit, vm_memory_high_watermark).' \
|
||||
| tr -d '}{' | cut -d ',' -f2
|
||||
args:
|
||||
chdir: "{{ xray_home }}/app/third-party/rabbitmq/sbin/"
|
||||
environment:
|
||||
LC_ALL: en_US.UTF-8
|
||||
LC_CTYPE: en_US.UTF-8
|
||||
register: vm_memory_high_watermark_relative_value
|
||||
|
||||
- name: Store result
|
||||
include_role:
|
||||
name: report
|
||||
vars:
|
||||
stop_testing_if_fail: false
|
||||
test_description: "{{ test_ext_description }}Check rabbitmq custom options values. INST-775"
|
||||
test_host: "{{ inventory_hostname }}"
|
||||
test_result: >-
|
||||
{{
|
||||
vm_memory_high_watermark_relative_value.stdout == rabbitmq_custom_values['vm_memory_high_watermark']
|
||||
and cluster_keepalive_interval_value.stdout == rabbitmq_custom_values['cluster_keepalive_interval']
|
||||
and handshake_timeout_value.stdout == rabbitmq_custom_values['handshake_timeout']
|
||||
}}
|
||||
report_action: "store-result"
|
||||
log_result: >-
|
||||
{{
|
||||
{}
|
||||
| combine({'handshake_timeout': {'real': handshake_timeout_value.stdout, 'expected': rabbitmq_custom_values.handshake_timeout}})
|
||||
| combine({'vm_memory_high_watermark': {'real': vm_memory_high_watermark_relative_value.stdout, 'expected': rabbitmq_custom_values.vm_memory_high_watermark}})
|
||||
| combine({'cluster_keepalive_interval': {'real': cluster_keepalive_interval_value.stdout, 'expected': rabbitmq_custom_values.cluster_keepalive_interval}})
|
||||
}}
|
||||
@@ -0,0 +1,102 @@
|
||||
- name: Find libssl package
|
||||
find:
|
||||
paths: "{{ xray_home }}/app/third-party/rabbitmq/"
|
||||
patterns: "^libssl.+\\.deb$"
|
||||
use_regex: yes
|
||||
file_type: file
|
||||
register: check_libssl_package_result
|
||||
|
||||
- name: Set libssl package file name
|
||||
set_fact:
|
||||
xray_libssl_package: "{{ check_libssl_package_result.files[0].path }}"
|
||||
when: check_libssl_package_result.matched > 0
|
||||
|
||||
- name: Install libssl package
|
||||
become: yes
|
||||
apt:
|
||||
deb: "{{ xray_libssl_package }}"
|
||||
register: install_libssl_package_result
|
||||
when:
|
||||
- ansible_distribution_release == 'xenial'
|
||||
- check_libssl_package_result.matched > 0
|
||||
|
||||
- name: Find socat package
|
||||
find:
|
||||
paths: "{{ xray_home }}/app/third-party/rabbitmq/"
|
||||
patterns: "^socat.+\\.deb$"
|
||||
use_regex: yes
|
||||
file_type: file
|
||||
register: check_socat_package_result
|
||||
|
||||
- name: Set socat package file name
|
||||
set_fact:
|
||||
xray_socat_package: "{{ check_socat_package_result.files[0].path }}"
|
||||
when: check_socat_package_result.matched > 0
|
||||
|
||||
- name: Install socat package
|
||||
become: yes
|
||||
ignore_errors: yes
|
||||
apt:
|
||||
deb: "{{ xray_socat_package }}"
|
||||
register: install_socat_package_result
|
||||
when: check_socat_package_result.matched > 0
|
||||
|
||||
- name: Find erlang package
|
||||
find:
|
||||
paths: "{{ xray_home }}/app/third-party/rabbitmq/"
|
||||
patterns: "^(esl-)?erlang.+{{ ansible_distribution_release }}.+\\.deb$"
|
||||
use_regex: yes
|
||||
file_type: file
|
||||
register: check_erlang_package_result
|
||||
|
||||
- name: Set erlang package file name
|
||||
set_fact:
|
||||
xray_erlang_package: "{{ check_erlang_package_result.files[0].path }}"
|
||||
when: check_erlang_package_result.matched > 0
|
||||
|
||||
- name: Install erlang package
|
||||
become: yes
|
||||
apt:
|
||||
deb: "{{ xray_erlang_package }}"
|
||||
register: install_erlang_package_result
|
||||
when: check_erlang_package_result.matched > 0
|
||||
|
||||
- name: Find db5-util package
|
||||
find:
|
||||
paths: "{{ xray_home }}/app/third-party/misc/"
|
||||
patterns: ["{{ xray_db_util_search_filter[linux_distro]['db5'] }}"]
|
||||
use_regex: yes
|
||||
file_type: file
|
||||
register: check_db5_util_package_result
|
||||
|
||||
- name: Set db5-util package file name
|
||||
set_fact:
|
||||
xray_db5_util_package: "{{ check_db5_util_package_result.files[0].path }}"
|
||||
when: check_db5_util_package_result.matched > 0
|
||||
|
||||
- name: Install db5-util package
|
||||
become: yes
|
||||
apt:
|
||||
deb: "{{ xray_db5_util_package }}"
|
||||
register: install_db5_util_package_result
|
||||
when: check_db5_util_package_result.matched > 0
|
||||
|
||||
- name: Find db-util package
|
||||
find:
|
||||
paths: "{{ xray_home }}/app/third-party/misc/"
|
||||
patterns: ["{{ xray_db_util_search_filter[linux_distro]['db'] }}"]
|
||||
use_regex: yes
|
||||
file_type: file
|
||||
register: check_db_util_package_result
|
||||
|
||||
- name: Set db-util package file name
|
||||
set_fact:
|
||||
xray_db_util_package: "{{ check_db_util_package_result.files[0].path }}"
|
||||
when: check_db_util_package_result.matched > 0
|
||||
|
||||
- name: Install db-util package
|
||||
become: yes
|
||||
apt:
|
||||
deb: "{{ xray_db_util_package }}"
|
||||
register: install_db_util_package_result
|
||||
when: check_db_util_package_result.matched > 0
|
||||
@@ -0,0 +1,59 @@
|
||||
- name: Set package prefix
|
||||
set_fact:
|
||||
rhel_package_prefix: >-
|
||||
{%- if linux_distro in ['centos7','rhel7'] -%}
|
||||
el7
|
||||
{%- elif linux_distro in ['centos8','rhel8'] -%}
|
||||
el8
|
||||
{%- endif -%}
|
||||
|
||||
- debug:
|
||||
msg: "rhel_package_prefix: {{ rhel_package_prefix }}"
|
||||
|
||||
- name: Find socat package
|
||||
become: yes
|
||||
find:
|
||||
paths: "{{ xray_home }}/app/third-party/rabbitmq/"
|
||||
patterns: "^socat.+{{ rhel_package_prefix }}.+\\.rpm$"
|
||||
use_regex: yes
|
||||
file_type: file
|
||||
register: check_socat_package_result
|
||||
|
||||
- name: Set socat package file name
|
||||
set_fact:
|
||||
xray_socat_package: "{{ check_socat_package_result.files[0].path }}"
|
||||
when: check_socat_package_result.matched > 0
|
||||
|
||||
- name: Install socat package
|
||||
become: yes
|
||||
yum:
|
||||
name: "{{ xray_socat_package }}"
|
||||
state: present
|
||||
vars:
|
||||
ansible_python_interpreter: "{{ yum_python_interpreter }}"
|
||||
register: install_socat_package_result
|
||||
when: check_socat_package_result.matched > 0
|
||||
|
||||
- name: Find erlang package
|
||||
become: yes
|
||||
find:
|
||||
paths: "{{ xray_home }}/app/third-party/rabbitmq/"
|
||||
patterns: "^(esl-)?erlang.+{{ rhel_package_prefix }}.+\\.rpm$"
|
||||
use_regex: yes
|
||||
file_type: file
|
||||
register: check_erlang_package_result
|
||||
|
||||
- name: Set erlang package file name
|
||||
set_fact:
|
||||
xray_erlang_package: "{{ check_erlang_package_result.files[0].path }}"
|
||||
when: check_erlang_package_result.matched > 0
|
||||
|
||||
- name: Install erlang package
|
||||
become: yes
|
||||
yum:
|
||||
name: "{{ xray_erlang_package }}"
|
||||
state: present
|
||||
vars:
|
||||
ansible_python_interpreter: "{{ yum_python_interpreter }}"
|
||||
register: install_erlang_package_result
|
||||
when: check_erlang_package_result.matched > 0
|
||||
@@ -0,0 +1,12 @@
|
||||
- name: Get rabbitmq ha cluster status
|
||||
become: yes
|
||||
ignore_errors: yes
|
||||
shell: |
|
||||
./rabbitmqctl --erlang-cookie {{ xray_rabbitmq_default_cookie }} \
|
||||
--formatter json cluster_status | jq .
|
||||
args:
|
||||
chdir: "{{ xray_home }}/app/third-party/rabbitmq/sbin/"
|
||||
environment:
|
||||
LC_ALL: en_US.UTF-8
|
||||
LC_CTYPE: en_US.UTF-8
|
||||
register: ha_rabbitmq_cluster_status
|
||||
@@ -0,0 +1,20 @@
|
||||
- name: Find erlang package
|
||||
find:
|
||||
paths: "{{ xray_home }}/app/third-party/rabbitmq/"
|
||||
patterns: "^(esl-)?erlang.+{{ ansible_distribution_release }}.+\\.deb$"
|
||||
use_regex: yes
|
||||
file_type: file
|
||||
register: check_erlang_package_result
|
||||
|
||||
- name: Set erlang package file name
|
||||
set_fact:
|
||||
xray_erlang_package: "{{ check_erlang_package_result.files[0].path }}"
|
||||
when: check_erlang_package_result.matched > 0
|
||||
|
||||
- name: Install erlang package
|
||||
become: yes
|
||||
apt:
|
||||
deb: "{{ xray_erlang_package }}"
|
||||
state: present
|
||||
register: install_erlang_package_result
|
||||
when: check_erlang_package_result.matched > 0
|
||||
@@ -0,0 +1,32 @@
|
||||
- name: Set package prefix
|
||||
set_fact:
|
||||
rhel_package_prefix: >-
|
||||
{%- if linux_distro in ['centos7','rhel7'] -%}
|
||||
el7
|
||||
{%- elif linux_distro in ['centos8','rhel8'] -%}
|
||||
el8
|
||||
{%- endif -%}
|
||||
|
||||
- name: Find erlang package
|
||||
become: yes
|
||||
find:
|
||||
paths: "{{ xray_home }}/app/third-party/rabbitmq/"
|
||||
patterns: "^(esl-)?erlang.+{{ rhel_package_prefix }}.+\\.rpm$"
|
||||
use_regex: yes
|
||||
file_type: file
|
||||
register: check_erlang_package_result
|
||||
|
||||
- name: Set erlang package file name
|
||||
set_fact:
|
||||
xray_erlang_package: "{{ check_erlang_package_result.files[0].path }}"
|
||||
when: check_erlang_package_result.matched > 0
|
||||
|
||||
- name: Install erlang package
|
||||
become: yes
|
||||
yum:
|
||||
name: "{{ xray_erlang_package }}"
|
||||
state: present
|
||||
vars:
|
||||
ansible_python_interpreter: "{{ yum_python_interpreter }}"
|
||||
register: install_erlang_package_result
|
||||
when: check_erlang_package_result.matched > 0
|
||||
@@ -0,0 +1,112 @@
|
||||
---
|
||||
- debug:
|
||||
msg: "Performing upgrade of Xray version to {{ xray_version }}..."
|
||||
|
||||
- name: stop xray
|
||||
become: yes
|
||||
systemd:
|
||||
name: "{{ xray_daemon }}"
|
||||
state: stopped
|
||||
|
||||
- name: download xray for upgrade
|
||||
become: yes
|
||||
unarchive:
|
||||
src: "{{ xray_tar }}"
|
||||
dest: "{{ jfrog_home_directory }}"
|
||||
remote_src: yes
|
||||
owner: "{{ xray_user }}"
|
||||
group: "{{ xray_group }}"
|
||||
creates: "{{ xray_untar_home }}"
|
||||
|
||||
register: downloadxray
|
||||
until: downloadxray is succeeded
|
||||
retries: 3
|
||||
|
||||
- name: Delete xray app
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ xray_home }}/app"
|
||||
state: absent
|
||||
|
||||
- name: Copy new app to xray app
|
||||
become: yes
|
||||
command: "cp -r {{ xray_untar_home }}/app/. {{ xray_home }}/app"
|
||||
|
||||
- name: Upgrade rabbitmq
|
||||
import_tasks: rabbitmq/upgrade/RedHat.yml
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- name: Upgrade rabbitmq
|
||||
import_tasks: rabbitmq/upgrade/Debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Check if install.sh wrapper script exist
|
||||
become: yes
|
||||
stat:
|
||||
path: "{{ xray_install_script_path }}/install.sh"
|
||||
register: install_wrapper_script
|
||||
|
||||
- name: Include interactive installer scripts
|
||||
include_vars: script/archive.yml
|
||||
|
||||
- name: Install xray
|
||||
include_tasks: expect.yml
|
||||
vars:
|
||||
exp_executable_cmd: "./install.sh -u {{ xray_user }} -g {{ xray_group }}"
|
||||
exp_dir: "{{ xray_install_script_path }}"
|
||||
exp_scenarios: "{{ xray_installer_scenario['main'] }}"
|
||||
args:
|
||||
apply:
|
||||
environment:
|
||||
YQ_PATH: "{{ xray_thirdparty_path }}/yq"
|
||||
when: install_wrapper_script.stat.exists
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Configure rabbitmq config
|
||||
become: yes
|
||||
template:
|
||||
src: "rabbitmq.conf.j2"
|
||||
dest: "{{ xray_home }}/app/bin/rabbitmq/rabbitmq.conf"
|
||||
notify: restart xray
|
||||
|
||||
- name: Configure systemyaml
|
||||
become: yes
|
||||
template:
|
||||
src: "{{ xray_system_yaml_template }}"
|
||||
dest: "{{ xray_home }}/var/etc/system.yaml"
|
||||
notify: restart xray
|
||||
|
||||
- name: configure installer info
|
||||
become: yes
|
||||
template:
|
||||
src: installer-info.json.j2
|
||||
dest: "{{ xray_home }}/var/etc/info/installer-info.json"
|
||||
notify: restart xray
|
||||
|
||||
- name: Ensure permissions are correct
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ jfrog_home_directory }}"
|
||||
state: directory
|
||||
owner: "{{ xray_user }}"
|
||||
group: "{{ xray_group }}"
|
||||
recurse: yes
|
||||
|
||||
- name: Install xray as a service
|
||||
become: yes
|
||||
shell: |
|
||||
{{ xray_archive_service_cmd }}
|
||||
args:
|
||||
chdir: "{{ xray_install_script_path }}"
|
||||
register: check_service_status_result
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Restart xray
|
||||
meta: flush_handlers
|
||||
|
||||
- name : wait for xray to be fully deployed
|
||||
uri: url=http://127.0.0.1:8082/router/api/v1/system/health timeout=130
|
||||
register: result
|
||||
until: result.status == 200
|
||||
retries: 25
|
||||
delay: 5
|
||||
@@ -0,0 +1,9 @@
|
||||
{{ ansible_managed | comment }}
|
||||
{
|
||||
"productId": "Ansible_Xray/{{ platform_collection_version }}-{{ xray_version }}",
|
||||
"features": [
|
||||
{
|
||||
"featureId": "Channel/{{ ansible_marketplace }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
loopback_users.guest = false
|
||||
listeners.tcp.default = 5672
|
||||
hipe_compile = false
|
||||
management.listener.port = 15672
|
||||
management.listener.ssl = false
|
||||
cluster_partition_handling = autoheal
|
||||
default_user = {{ xray_rabbitmq_user }}
|
||||
|
||||
default_pass = {{ xray_rabbitmq_password }}
|
||||
@@ -0,0 +1,3 @@
|
||||
{% if (xray_systemyaml) and (xray_systemyaml|length > 0) %}
|
||||
{{ xray_systemyaml }}
|
||||
{% endif %}
|
||||
@@ -0,0 +1,2 @@
|
||||
---
|
||||
# vars file for xray
|
||||
@@ -0,0 +1,54 @@
|
||||
xray_installer_scenario:
|
||||
main:
|
||||
- {
|
||||
"expecting": "have you disconnected artifactory xray pairings",
|
||||
"sending": "y"
|
||||
}
|
||||
- {
|
||||
"expecting": "(data|installation) directory \\(",
|
||||
"sending": "{{ xray_home }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "jfrog url( \\(.+\\))?:(?!.*Skipping prompt)",
|
||||
"sending": "{{ jfrog_url }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "join key:(?!.*Skipping prompt)",
|
||||
"sending": "{{ join_key }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "please specify the ip address of this machine(?!.*Skipping prompt)",
|
||||
"sending": "{% if xray_ha_node_type is defined and xray_ha_node_type == 'master' %}{{ ansible_host }}{% else %}{{ ansible_host }}{% endif %}"
|
||||
}
|
||||
- {
|
||||
"expecting": "are you adding an additional node",
|
||||
"sending": "{% if xray_ha_node_type is defined and xray_ha_node_type == 'master' %}n{% else %}y{% endif %}"
|
||||
}
|
||||
- {
|
||||
"expecting": "do you want to install postgresql",
|
||||
"sending": "n"
|
||||
}
|
||||
- {
|
||||
"expecting": "(postgresql|database) url",
|
||||
"sending": "{{ xray_db_url }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "(postgresql|database) password",
|
||||
"sending": "{{ xray_db_password }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "(postgresql|database) username",
|
||||
"sending": "{{ xray_db_user }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "confirm database password",
|
||||
"sending": "{{ xray_db_password }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "rabbitmq active node name:",
|
||||
"sending": "{{ ansible_machine_id }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "rabbitmq active node ip:",
|
||||
"sending": "{{ ansible_host }}"
|
||||
}
|
||||
Reference in New Issue
Block a user