mirror of
https://github.com/ZwareBear/JFrog-Cloud-Installers.git
synced 2026-01-21 06:06:56 -06:00
[ansible] JFrog Platform 7.18.6 (#110)
This commit is contained in:
committed by
GitHub
parent
12d4e96727
commit
224ece535d
@@ -1,26 +0,0 @@
|
||||
# Distribution
|
||||
The Distribution role will install distribution software onto the host. An Artifactory server and Postgress database is required.
|
||||
|
||||
### Role Variables
|
||||
* _distribution_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: distribution_servers
|
||||
roles:
|
||||
- distribution
|
||||
```
|
||||
|
||||
## Upgrades
|
||||
The distribution 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: distributionservers
|
||||
vars:
|
||||
distribution_version: "{{ lookup('env', 'distribution_version_upgrade') }}"
|
||||
distribution_upgrade_only: true
|
||||
roles:
|
||||
- distribution
|
||||
```
|
||||
@@ -1,43 +0,0 @@
|
||||
---
|
||||
# defaults file for distribution
|
||||
# indicates were this collection was downlaoded from (galaxy, automation_hub, standalone)
|
||||
ansible_marketplace: standalone
|
||||
|
||||
# whether to enable HA
|
||||
distribution_ha_enabled: false
|
||||
|
||||
distribution_ha_node_type : master
|
||||
|
||||
# The location where distribution should install.
|
||||
jfrog_home_directory: /opt/jfrog
|
||||
|
||||
# The remote distribution download file
|
||||
distribution_tar: https://releases.jfrog.io/artifactory/jfrog-distribution/distribution-linux/{{ distribution_version }}/jfrog-distribution-{{ distribution_version }}-linux.tar.gz
|
||||
|
||||
#The distribution install directory
|
||||
distribution_untar_home: "{{ jfrog_home_directory }}/jfrog-distribution-{{ distribution_version }}-linux"
|
||||
distribution_home: "{{ jfrog_home_directory }}/distribution"
|
||||
|
||||
distribution_install_script_path: "{{ distribution_home }}/app/bin"
|
||||
distribution_thirdparty_path: "{{ distribution_home }}/app/third-party"
|
||||
distribution_archive_service_cmd: "{{ distribution_install_script_path }}/installService.sh"
|
||||
|
||||
#distribution users and groups
|
||||
distribution_user: distribution
|
||||
distribution_group: distribution
|
||||
|
||||
distribution_uid: 1040
|
||||
distribution_gid: 1040
|
||||
|
||||
distribution_daemon: distribution
|
||||
|
||||
flow_type: archive
|
||||
|
||||
# Redis details
|
||||
distribution_redis_url: "redis://localhost:6379"
|
||||
distribution_redis_password: password
|
||||
|
||||
# if this is an upgrade
|
||||
distribution_upgrade_only: false
|
||||
|
||||
distribution_system_yaml_template: system.yaml.j2
|
||||
@@ -1,7 +0,0 @@
|
||||
---
|
||||
# handlers file for distribution
|
||||
- name: restart distribution
|
||||
become: yes
|
||||
systemd:
|
||||
name: "{{ distribution_daemon }}"
|
||||
state: restarted
|
||||
@@ -1,16 +0,0 @@
|
||||
galaxy_info:
|
||||
author: "JFrog Maintainers Team <installers@jfrog.com>"
|
||||
description: "The distribution role will install distribution 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:
|
||||
- distribution
|
||||
- jfrog
|
||||
|
||||
dependencies: []
|
||||
@@ -1,44 +0,0 @@
|
||||
- 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
|
||||
@@ -1,155 +0,0 @@
|
||||
---
|
||||
- debug:
|
||||
msg: "Performing installation of Distribution version - {{ distribution_version }}"
|
||||
|
||||
- name: Install expect dependency
|
||||
yum:
|
||||
name: expect
|
||||
state: present
|
||||
become: yes
|
||||
when: ansible_os_family == 'Redhat'
|
||||
|
||||
- name: Install expect dependency
|
||||
apt:
|
||||
name: expect
|
||||
state: present
|
||||
update_cache: yes
|
||||
become: yes
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Ensure group jfdistribution exist
|
||||
become: yes
|
||||
group:
|
||||
name: "{{ distribution_group }}"
|
||||
gid: "{{ distribution_gid }}"
|
||||
state: present
|
||||
|
||||
- name: Ensure user distribution exist
|
||||
become: yes
|
||||
user:
|
||||
uid: "{{ distribution_uid }}"
|
||||
name: "{{ distribution_user }}"
|
||||
group: "{{ distribution_group }}"
|
||||
create_home: yes
|
||||
home: "{{ distribution_home }}"
|
||||
shell: /bin/bash
|
||||
state: present
|
||||
|
||||
- name: Download distribution
|
||||
become: yes
|
||||
unarchive:
|
||||
src: "{{ distribution_tar }}"
|
||||
dest: "{{ jfrog_home_directory }}"
|
||||
remote_src: yes
|
||||
owner: "{{ distribution_user }}"
|
||||
group: "{{ distribution_group }}"
|
||||
creates: "{{ distribution_untar_home }}"
|
||||
register: downloaddistribution
|
||||
until: downloaddistribution is succeeded
|
||||
retries: 3
|
||||
|
||||
- name: Check if app directory exists
|
||||
become: yes
|
||||
stat:
|
||||
path: "{{ distribution_home }}/app"
|
||||
register: app_dir_check
|
||||
|
||||
- name: Copy untar directory to distribution home
|
||||
become: yes
|
||||
command: "cp -r {{ distribution_untar_home }}/. {{ distribution_home }}"
|
||||
when: not app_dir_check.stat.exists
|
||||
|
||||
- name: Create required directories
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
owner: "{{ distribution_user }}"
|
||||
group: "{{ distribution_group }}"
|
||||
loop:
|
||||
- "{{ distribution_home }}/var/etc"
|
||||
- "{{ distribution_home }}/var/etc/security/"
|
||||
- "{{ distribution_home }}/var/etc/info/"
|
||||
- "{{ distribution_home }}/var/etc/redis/"
|
||||
|
||||
- name: Configure master key
|
||||
become: yes
|
||||
copy:
|
||||
dest: "{{ distribution_home }}/var/etc/security/master.key"
|
||||
content: |
|
||||
{{ master_key }}
|
||||
owner: "{{ distribution_user }}"
|
||||
group: "{{ distribution_group }}"
|
||||
mode: 0640
|
||||
|
||||
- name: Check if install.sh wrapper script exist
|
||||
become: yes
|
||||
stat:
|
||||
path: "{{ distribution_install_script_path }}/install.sh"
|
||||
register: install_wrapper_script
|
||||
|
||||
- name: Include interactive installer scripts
|
||||
include_vars: script/archive.yml
|
||||
|
||||
- name: Install Distribution
|
||||
include_tasks: expect.yml
|
||||
vars:
|
||||
exp_executable_cmd: "./install.sh -u {{ distribution_user }} -g {{ distribution_group }}"
|
||||
exp_dir: "{{ distribution_install_script_path }}"
|
||||
exp_scenarios: "{{ distribution_installer_scenario['main'] }}"
|
||||
args:
|
||||
apply:
|
||||
environment:
|
||||
YQ_PATH: "{{ distribution_thirdparty_path }}/yq"
|
||||
when: install_wrapper_script.stat.exists
|
||||
|
||||
- name: Configure redis config
|
||||
become: yes
|
||||
template:
|
||||
src: "redis.conf.j2"
|
||||
dest: "{{ distribution_home }}/var/etc/redis/redis.conf"
|
||||
notify: restart distribution
|
||||
|
||||
- name: Configure systemyaml
|
||||
become: yes
|
||||
template:
|
||||
src: "{{ distribution_system_yaml_template }}"
|
||||
dest: "{{ distribution_home }}/var/etc/system.yaml"
|
||||
notify: restart distribution
|
||||
|
||||
- name: Configure installer info
|
||||
become: yes
|
||||
template:
|
||||
src: installer-info.json.j2
|
||||
dest: "{{ distribution_home }}/var/etc/info/installer-info.json"
|
||||
notify: restart distribution
|
||||
|
||||
- name: Update distribution permissions
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ distribution_home }}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
owner: "{{ distribution_user }}"
|
||||
group: "{{ distribution_group }}"
|
||||
mode: '0755'
|
||||
|
||||
- name: Install Distribution as a service
|
||||
become: yes
|
||||
shell: |
|
||||
{{ distribution_archive_service_cmd }}
|
||||
args:
|
||||
chdir: "{{ distribution_install_script_path }}"
|
||||
register: check_service_status_result
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Restart distribution
|
||||
meta: flush_handlers
|
||||
|
||||
- name : Wait for distribution 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
|
||||
@@ -1,6 +0,0 @@
|
||||
- name: perform installation
|
||||
include_tasks: "install.yml"
|
||||
when: not distribution_upgrade_only
|
||||
- name: perform upgrade
|
||||
include_tasks: "upgrade.yml"
|
||||
when: distribution_upgrade_only
|
||||
@@ -1,111 +0,0 @@
|
||||
---
|
||||
- debug:
|
||||
msg: "Performing upgrade of Distribution version to {{ distribution_version }} "
|
||||
|
||||
- name: Stop distribution
|
||||
become: yes
|
||||
systemd:
|
||||
name: "{{ distribution_daemon }}"
|
||||
state: stopped
|
||||
|
||||
- name: Download distribution for upgrade
|
||||
become: yes
|
||||
unarchive:
|
||||
src: "{{ distribution_tar }}"
|
||||
dest: "{{ jfrog_home_directory }}"
|
||||
remote_src: yes
|
||||
owner: "{{ distribution_user }}"
|
||||
group: "{{ distribution_group }}"
|
||||
creates: "{{ distribution_untar_home }}"
|
||||
register: downloaddistribution
|
||||
until: downloaddistribution is succeeded
|
||||
retries: 3
|
||||
|
||||
- name: Delete distribution app
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ distribution_home }}/app"
|
||||
state: absent
|
||||
|
||||
- name: Copy new app to distribution app
|
||||
become: yes
|
||||
command: "cp -r {{ distribution_untar_home }}/app/. {{ distribution_home }}/app"
|
||||
|
||||
- name: Check if install.sh wrapper script exist
|
||||
become: yes
|
||||
stat:
|
||||
path: "{{ distribution_install_script_path }}/install.sh"
|
||||
register: install_wrapper_script
|
||||
|
||||
- name: Include interactive installer scripts
|
||||
include_vars: script/archive.yml
|
||||
|
||||
- name: Install Distribution
|
||||
include_tasks: expect.yml
|
||||
vars:
|
||||
exp_executable_cmd: "./install.sh -u {{ distribution_user }} -g {{ distribution_group }}"
|
||||
exp_dir: "{{ distribution_install_script_path }}"
|
||||
exp_scenarios: "{{ distribution_installer_scenario['main'] }}"
|
||||
args:
|
||||
apply:
|
||||
environment:
|
||||
YQ_PATH: "{{ distribution_thirdparty_path }}/yq"
|
||||
when: install_wrapper_script.stat.exists
|
||||
|
||||
- name: Ensure {{ distribution_home }}/var/etc/redis exists
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ distribution_home }}/var/etc/redis/"
|
||||
state: directory
|
||||
owner: "{{ distribution_user }}"
|
||||
group: "{{ distribution_group }}"
|
||||
|
||||
- name: Configure redis config
|
||||
become: yes
|
||||
template:
|
||||
src: "redis.conf.j2"
|
||||
dest: "{{ distribution_home }}/var/etc/redis/redis.conf"
|
||||
notify: restart distribution
|
||||
|
||||
- name: Configure installer info
|
||||
become: yes
|
||||
template:
|
||||
src: installer-info.json.j2
|
||||
dest: "{{ distribution_home }}/var/etc/info/installer-info.json"
|
||||
notify: restart distribution
|
||||
|
||||
- name: Configure systemyaml
|
||||
become: yes
|
||||
template:
|
||||
src: "{{ distribution_system_yaml_template }}"
|
||||
dest: "{{ distribution_home }}/var/etc/system.yaml"
|
||||
notify: restart distribution
|
||||
|
||||
- name: Update Distribution base dir owner and group
|
||||
become: yes
|
||||
file:
|
||||
path: "{{ distribution_home }}"
|
||||
state: directory
|
||||
recurse: yes
|
||||
owner: "{{ distribution_user }}"
|
||||
group: "{{ distribution_group }}"
|
||||
mode: '0755'
|
||||
|
||||
- name: Install Distribution as a service
|
||||
become: yes
|
||||
shell: |
|
||||
{{ distribution_archive_service_cmd }}
|
||||
args:
|
||||
chdir: "{{ distribution_install_script_path }}"
|
||||
register: check_service_status_result
|
||||
ignore_errors: yes
|
||||
|
||||
- name: Restart distribution
|
||||
meta: flush_handlers
|
||||
|
||||
- name : Wait for distribution 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
|
||||
@@ -1,9 +0,0 @@
|
||||
{{ ansible_managed | comment }}
|
||||
{
|
||||
"productId": "Ansible_Distribution/{{ platform_collection_version }}-{{ distribution_version }}",
|
||||
"features": [
|
||||
{
|
||||
"featureId": "Channel/{{ ansible_marketplace }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
{{ ansible_managed | comment }}
|
||||
# Redis configuration file
|
||||
|
||||
# data directory for redis
|
||||
dir {{ distribution_home }}/var/data/redis
|
||||
|
||||
# log directory for redis
|
||||
logfile {{ distribution_home }}/var/log/redis/redis.log
|
||||
|
||||
# pid file location for redis
|
||||
pidfile {{ distribution_home }}/app/run/redis.pid
|
||||
|
||||
# password for redis
|
||||
# if changed, the same should be set as value for shared.redis.password in JF_PRODUCT_HOME/var/etc/system.yaml
|
||||
requirepass {{ distribution_redis_password }}
|
||||
@@ -1,20 +0,0 @@
|
||||
configVersion: 1
|
||||
shared:
|
||||
jfrogUrl: {{ jfrog_url }}
|
||||
node:
|
||||
ip: {{ ansible_host }}
|
||||
id: {{ ansible_date_time.iso8601_micro | to_uuid }}
|
||||
database:
|
||||
type: "{{ distribution_db_type }}"
|
||||
driver: "{{ distribution_db_driver }}"
|
||||
url: "{{ distribution_db_url }}"
|
||||
username: "{{ distribution_db_user }}"
|
||||
password: "{{ distribution_db_password }}"
|
||||
redis:
|
||||
connectionString: "{{ distribution_redis_url }}"
|
||||
password: "{{ distribution_redis_password }}"
|
||||
security:
|
||||
joinKey: {{ join_key }}
|
||||
router:
|
||||
entrypoints:
|
||||
internalPort: 8046
|
||||
@@ -1,2 +0,0 @@
|
||||
---
|
||||
|
||||
@@ -1,42 +0,0 @@
|
||||
distribution_installer_scenario:
|
||||
main:
|
||||
- {
|
||||
"expecting": "(data|installation) directory \\(",
|
||||
"sending": "{{ distribution_home }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "join key.*:",
|
||||
"sending": "{{ join_key }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "jfrog url:",
|
||||
"sending": "{{ jfrog_url }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "do you want to continue",
|
||||
"sending": "y"
|
||||
}
|
||||
- {
|
||||
"expecting": "please specify the ip address of this machine",
|
||||
"sending": "{% if distribution_ha_node_type is defined and distribution_ha_node_type == 'master' %}{{ ansible_host }}{% else %}{{ ansible_host }}{% endif %}"
|
||||
}
|
||||
- {
|
||||
"expecting": "are you adding an additional node",
|
||||
"sending": "{% if distribution_ha_node_type is defined and distribution_ha_node_type == 'master' %}n{% else %}y{% endif %}"
|
||||
}
|
||||
- {
|
||||
"expecting": "do you want to install postgresql",
|
||||
"sending": "n"
|
||||
}
|
||||
- {
|
||||
"expecting": "postgresql url.*example",
|
||||
"sending": "{{ distribution_db_url }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "(postgresql|database)?\\s?username.*",
|
||||
"sending": "{{ distribution_db_user }}"
|
||||
}
|
||||
- {
|
||||
"expecting": "(confirm\\s?)?(postgresql|database)?\\s?password.*:",
|
||||
"sending": "{{ distribution_db_password }}"
|
||||
}
|
||||
Reference in New Issue
Block a user