Merge pull request #28 from jefferyfry/master

Updated/added READMEs. Changes to playbooks. Added license file, syst…
This commit is contained in:
Jeff Fry
2020-05-25 18:12:04 -07:00
committed by GitHub
13 changed files with 94 additions and 55 deletions

35
Ansible/README.md Normal file
View File

@@ -0,0 +1,35 @@
# JFrog Ansible Collection
This Ansible directory consists of the following directories that support the JFrog Ansible collection.
* [collection directory](collection) - This directory contains the Ansible collection package that has the Ansible roles for Artifactory and Xray. See the collection [README](collection/README.md) for details on the available roles and variables.
* [infra directory](infra) - This directory contains example infrastructure templates that can be used for testing and as example deployments.
* [project directory](project) - This directory contains example playbooks for various architectures from single Artifactory (RT) deployments to high-availability setups.
* [test directory](test) - This directory contains Gradle tests that can be used to verify a deployment. It also has Ansible playbooks for creating infrastructure, provisioning software and testing with Gradle.
## Getting Started
1. Install this collection or the roles in your Ansible path using your ansible.cfg file. The following is an example:
```
# Installs collections into [current dir]/ansible_collections/namespace/collection_name
collections_paths = ~/.ansible/collections:/usr/share/ansible/collections:collection
# Installs roles into [current dir]/roles/namespace.rolename
roles_path = Ansible/collection/jfrog/ansible/roles
```
2. Ansible uses SSH to connect to hosts. Ensure that your SSH private key is on your client and the public keys are installed on your Ansible hosts. If you are using a bastion host, you can add the following Ansible variable to allow proxying through the bastion host.
```
ansible_ssh_common_args: '-o ProxyCommand="ssh -o StrictHostKeyChecking=no -A user@host -W %h:%p"'
eg.
ansible_ssh_common_args: '-o ProxyCommand="ssh -o StrictHostKeyChecking=no -A ubuntu@{{ azureDeployment.deployment.outputs.lbIp.value }} -W %h:%p"'
```
3. Create your inventory file. Use one of the examples from the [project directory](project) to construct an inventory file (hosts.yml) with the host addresses and variables.
4. Create your playbook. Use one of the examples from the [project directory](project) to construct a playbook using the JFrog Ansible roles. These roles will be applied to your inventory and provision software.
5. Then execute with the following command to provision the JFrog software with Ansible. Variables can also be passed in at the command-line.
```
ansible-playbook -i hosts.yml playbook.yml --extra-vars "master_key=$(openssl rand -hex 16) join_key=$(openssl rand -hex 16)"
```

View File

@@ -32,10 +32,13 @@ The following Vars must be configured.
* db_user: The database user to configure. eg. "artifactory" * db_user: The database user to configure. eg. "artifactory"
* db_password: The database password to configure. "Art1fact0ry" * db_password: The database password to configure. "Art1fact0ry"
* server_name: This is the server name. eg. "artifactory.54.175.51.178.xip.io" * server_name: This is the server name. eg. "artifactory.54.175.51.178.xip.io"
* system_file: Your own system YAML file can be specified and used. If specified, this file will be used rather than constructing a file from the parameters above.
* binary_store_file: Your own binary store file can be used. If specified, the default cluster-file-system will not be used.
### primary vars ### primary vars
* artifactory_is_primary: For the primary node this must be set to **true**. * artifactory_is_primary: For the primary node this must be set to **true**.
* artifactory_license1 - 5: These are the cluster licenses. * artifactory_license1 - 5: These are the cluster licenses.
* artifactory_license_file: Your own license file can be used. If specified, a license file constructed from the licenses above will not be used.
### secondary vars ### secondary vars
* artifactory_is_primary: For the secondary node(s) this must be set to **false**. * artifactory_is_primary: For the secondary node(s) this must be set to **false**.

View File

@@ -6,7 +6,7 @@ ansible_marketplace: standalone
# The version of Artifactory to install # The version of Artifactory to install
artifactory_version: 7.4.1 artifactory_version: 7.4.1
# licenses # licenses file - specify a licenses file or specify up to 5 licenses
artifactory_license1: artifactory_license1:
artifactory_license2: artifactory_license2:
artifactory_license3: artifactory_license3:
@@ -26,9 +26,6 @@ artifactory_download_directory: /opt/jfrog
artifactory_file_store_dir: /data artifactory_file_store_dir: /data
# Pick the Artifactory flavour to install, can be also cpp-ce, jcr, pro. # Pick the Artifactory flavour to install, can be also cpp-ce, jcr, pro.
# note that for "pro" version, the artifactory_zip URL would need to be overridden to e.g.:
# https://dl.bintray.com/jfrog/artifactory-pro/org/artifactory/pro/jfrog-artifactory-pro/{{ artifactory_version }}/jfrog-artifactory-pro-{{ artifactory_version }}.zip
# https://dl.bintray.com/jfrog/artifactory-pro/org/artifactory/pro/jfrog-artifactory-pro/{{ artifactory_version }}/jfrog-artifactory-pro-{{ artifactory_version }}-linux.tar.gz
artifactory_flavour: pro artifactory_flavour: pro
extra_java_opts: -server -Xms2g -Xmx14g -Xss256k -XX:+UseG1GC extra_java_opts: -server -Xms2g -Xmx14g -Xss256k -XX:+UseG1GC

View File

@@ -52,11 +52,19 @@
group: "{{ artifactory_group }}" group: "{{ artifactory_group }}"
become: yes become: yes
- name: use specified system yaml
copy:
src: "{{ system_file }}"
dest: "{{ artifactory_home }}/var/etc/system.yaml"
become: yes
when: system_file is defined
- name: configure system yaml - name: configure system yaml
template: template:
src: system.yaml.j2 src: system.yaml.j2
dest: "{{ artifactory_home }}/var/etc/system.yaml" dest: "{{ artifactory_home }}/var/etc/system.yaml"
become: yes become: yes
when: system_file is not defined
- name: ensure {{ artifactory_home }}/var/etc/security/ exists - name: ensure {{ artifactory_home }}/var/etc/security/ exists
file: file:
@@ -92,18 +100,33 @@
dest: "{{ artifactory_home }}/var/etc/info/installer-info.json" dest: "{{ artifactory_home }}/var/etc/info/installer-info.json"
become: yes become: yes
- name: configure binary store - name: use specified binary store
copy:
src: "{{ binary_store_file }}"
dest: "{{ artifactory_home }}/var/etc/binarystore.xml"
become: yes
when: binary_store_file is defined
- name: use default binary store
template: template:
src: binarystore.xml.j2 src: binarystore.xml.j2
dest: "{{ artifactory_home }}/var/etc/binarystore.xml" dest: "{{ artifactory_home }}/var/etc/binarystore.xml"
become: yes become: yes
when: binary_store_file is not defined
- name: configure cluster license - name: use license file
copy:
src: "{{ artifactory_license_file }}"
dest: "{{ artifactory_home }}/var/etc/artifactory/artifactory.cluster.license"
become: yes
when: artifactory_license_file is defined and artifactory_is_primary == true
- name: use license strings
template: template:
src: artifactory.cluster.license.j2 src: artifactory.cluster.license.j2
dest: "{{ artifactory_home }}/var/etc/artifactory/artifactory.cluster.license" dest: "{{ artifactory_home }}/var/etc/artifactory/artifactory.cluster.license"
become: yes become: yes
when: artifactory_is_primary == true when: artifactory_license_file is not defined and artifactory_is_primary == true
- name: download database driver - name: download database driver
get_url: get_url:

View File

@@ -6,16 +6,13 @@
var: join_key var: join_key
- hosts: database - hosts: database
gather_facts: true
roles: roles:
- jfrog/ansible/roles/postgres - postgres
- hosts: artifactory - hosts: artifactory
gather_facts: true
roles: roles:
- jfrog/ansible/roles/artifactory - artifactory
- hosts: xray - hosts: xray
gather_facts: true
roles: roles:
- jfrog/ansible/roles/xray - xray

View File

@@ -1,15 +1,12 @@
--- ---
- hosts: database - hosts: database
gather_facts: true
roles: roles:
- jfrog/ansible/roles/postgres - postgres
- hosts: primary:secondary - hosts: primary:secondary
gather_facts: true
roles: roles:
- jfrog/ansible/roles/artifactory - artifactory
- hosts: xray - hosts: xray
gather_facts: true
roles: roles:
- jfrog/ansible/roles/xray - xray

View File

@@ -1,15 +1,12 @@
--- ---
- hosts: database - hosts: database
gather_facts: true
roles: roles:
- jfrog/ansible/roles/postgres - postgres
- hosts: primary - hosts: primary
gather_facts: true
roles: roles:
- jfrog/ansible/roles/artifactory - artifactory
- hosts: xray - hosts: xray
gather_facts: true
roles: roles:
- jfrog/ansible/roles/xray - xray

View File

@@ -1,15 +1,12 @@
--- ---
- hosts: database - hosts: database
gather_facts: true
roles: roles:
- jfrog/ansible/roles/postgres - postgres
- hosts: artifactory - hosts: artifactory
gather_facts: true
roles: roles:
- jfrog/ansible/roles/artifactory - artifactory
- hosts: xray - hosts: xray
gather_facts: true
roles: roles:
- jfrog/ansible/roles/xray - xray

View File

@@ -2,30 +2,23 @@
all: all:
vars: vars:
ansible_user: "ubuntu" ansible_user: "ubuntu"
ansible_ssh_private_key_file: "/Users/jefff/.ssh/ansible-priv.pem"
children: children:
database: database:
hosts: hosts:
52.86.32.79: 54.83.163.100:
db_users: db_users:
- { db_user: "artifactory", db_password: "Art1fAct0ry" } - { db_user: "artifactory", db_password: "{{ lookup('env', 'artifactory_password') }}" }
dbs: dbs:
- { db_name: "artifactory", db_owner: "artifactory" } - { db_name: "artifactory", db_owner: "artifactory" }
primary: primary:
hosts: hosts:
100.25.104.198: 54.165.47.191:
artifactory_is_primary: true artifactory_is_primary: true
artifactory_license1: x artifactory_license_file: "{{ lookup('env', 'artifactory_license_file') }}"
artifactory_license2: x
artifactory_license3: x
artifactory_license4: x
artifactory_license5: x
master_key: "c97b862469de0d94fbb7d48130637a5a"
join_key: "9bcca98f375c0728d907cc6ee39d4f02"
db_download_url: "https://jdbc.postgresql.org/download/postgresql-42.2.12.jar" db_download_url: "https://jdbc.postgresql.org/download/postgresql-42.2.12.jar"
db_type: "postgresql" db_type: "postgresql"
db_driver: "org.postgresql.Driver" db_driver: "org.postgresql.Driver"
db_url: "jdbc:postgresql://10.0.0.160:5432/artifactory" db_url: "jdbc:postgresql://10.0.0.219:5432/artifactory"
db_user: "artifactory" db_user: "artifactory"
db_password: "Art1fAct0ry" db_password: "{{ lookup('env', 'artifactory_password') }}"
server_name: "ec2-100-25-104-198.compute-1.amazonaws.com" server_name: "ec2-54-165-47-191.compute-1.amazonaws.com"

View File

@@ -1,10 +1,8 @@
--- ---
- hosts: database - hosts: database
gather_facts: true
roles: roles:
- jfrog/ansible/roles/postgres - postgres
- hosts: primary - hosts: primary
gather_facts: true
roles: roles:
- jfrog/ansible/roles/artifactory - artifactory

View File

@@ -0,0 +1,3 @@
#!/usr/bin/env bash
ansible-playbook -i Ansible/project/rt/hosts.yml Ansible/project/rt/playbook.yml --extra-vars "master_key=$(openssl rand -hex 16) join_key=$(openssl rand -hex 16)"

View File

@@ -1,11 +1,9 @@
--- ---
- hosts: database - hosts: database
gather_facts: true
roles: roles:
- jfrog/ansible/roles/postgres - postgres
- hosts: primary - hosts: primary
gather_facts: true
roles: roles:
- jfrog/ansible/roles/artifactory - artifactory
- jfrog/ansible/roles/artifactory-nginx-ssl - artifactory-nginx-ssl

View File

@@ -4,4 +4,5 @@ Template to deploy/manage JFrog Artifactory enterprise cluster on various cloud
* [Terraform](Terraform/README.md) * [Terraform](Terraform/README.md)
* [CloudFormation](CloudFormation/README.md) * [CloudFormation](CloudFormation/README.md)
* [Azure Resource Manager](AzureResourceManager/README.md) * [Azure Resource Manager](AzureResourceManager/README.md)
* [Ansible](Ansible/README.md)