diff --git a/Ansible/README.md b/Ansible/README.md index ec8c616..4527053 100644 --- a/Ansible/README.md +++ b/Ansible/README.md @@ -1,35 +1,94 @@ -# JFrog Ansible Collection +# JFrog Ansible Installers 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. + * [ansible_collections directory](ansible_collections) - This directory contains the Ansible collection package that has the Ansible roles for Artifactory and Xray. See the collection [README](ansible_collections/README.md) for details on the available roles and variables. + * [examples directory](examples) - This directory contains example playbooks for various architectures from single Artifactory (RT) deployments to high-availability setups. * [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. + ## Tested Artifactory and Xray Versions + The following versions of Artifactory and Xray have been validated with this collection. Other versions and combinations may also work. + +| collection_version | artifactory_version | xray_version | +|--------------------|---------------------|--------------| +| 1.0.7 | 7.6.1 | 3.5.2 | +| 1.0.6 | 7.5.0 | 3.3.0 | +| 1.0.6 | 7.4.3 | 3.3.0 | + ## 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"' + 1. Install this collection from Ansible Galaxy. This collection is also available in RedHat Automation Hub. + + ``` + ansible-galaxy collection install jfrog.installers + ``` + + Ensure you reference the collection in your playbook when using these roles. + + ``` + --- + - hosts: xray + collections: + - jfrog.installers + roles: + - xray + + ``` + + 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. - 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. + 3. Create your inventory file. Use one of the examples from the [examples directory](examples) 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. + 4. Create your playbook. Use one of the examples from the [examples directory](examples) 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)" -``` \ No newline at end of file +``` + +## Autogenerating Master and Join Keys +You may want to auto-generate your master amd join keys and apply it to all the nodes. + +``` +ansible-playbook -i hosts.yml playbook.yml --extra-vars "master_key=$(openssl rand -hex 16) join_key=$(openssl rand -hex 16)" +``` + +## Using [Ansible Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html) to Encrypt Vars +Some vars you may want to keep secret. You may put these vars into a separate file and encrypt them using [Ansible Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html). + +``` +ansible-vault encrypt secret-vars.yml --vault-password-file ~/.vault_pass.txt +``` + +then in your playbook include the secret vars file. + +``` +- hosts: primary + + vars_files: + - ./vars/secret-vars.yml + - ./vars/vars.yml + + roles: + - artifactory +``` + +## Bastion Hosts +In many cases, you may want to run this Ansible collection through a Bastion host to provision JFrog servers. You can include the following Var for a host or group of hosts: + +``` +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"' +``` + +## Building the Collection Archive +1. Go to the [ansible_collections/jfrog/installers directory](ansible_collections/jfrog/installers). +2. Update the galaxy.yml meta file as needed. Update the version. +3. Build the archive. +``` +ansible-galaxy collection build +``` diff --git a/Ansible/collection/.ansible-lint b/Ansible/ansible_collections/.ansible-lint similarity index 100% rename from Ansible/collection/.ansible-lint rename to Ansible/ansible_collections/.ansible-lint diff --git a/Ansible/collection/.yamllint b/Ansible/ansible_collections/.yamllint similarity index 100% rename from Ansible/collection/.yamllint rename to Ansible/ansible_collections/.yamllint diff --git a/Ansible/ansible_collections/jfrog/installers/README.md b/Ansible/ansible_collections/jfrog/installers/README.md new file mode 100644 index 0000000..88f2bdf --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/README.md @@ -0,0 +1,89 @@ +# JFrog Ansible Installers Collection + +## Getting Started + + 1. Install this collection from Ansible Galaxy. This collection is also available in RedHat Automation Hub. + + ``` + ansible-galaxy collection install jfrog.installers + ``` + + Ensure you reference the collection in your playbook when using these roles. + + ``` + --- + - hosts: xray + collections: + - jfrog.installers + roles: + - xray + + ``` + + 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. + + 3. Create your inventory file. Use one of the examples from the [examples directory](https://github.com/jfrog/JFrog-Cloud-Installers/tree/master/Ansible/examples) to construct an inventory file (hosts.yml) with the host addresses and variables. + + 4. Create your playbook. Use one of the examples from the [examples directory](https://github.com/jfrog/JFrog-Cloud-Installers/tree/master/Ansible/examples) 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)" +``` + +## Autogenerating Master and Join Keys +You may want to auto-generate your master amd join keys and apply it to all the nodes. + +``` +ansible-playbook -i hosts.yml playbook.yml --extra-vars "master_key=$(openssl rand -hex 16) join_key=$(openssl rand -hex 16)" +``` + +## Using [Ansible Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html) to Encrypt Vars +Some vars you may want to keep secret. You may put these vars into a separate file and encrypt them using [Ansible Vault](https://docs.ansible.com/ansible/latest/user_guide/vault.html). + +``` +ansible-vault encrypt secret-vars.yml --vault-password-file ~/.vault_pass.txt +``` + +then in your playbook include the secret vars file. + +``` +- hosts: primary + + vars_files: + - ./vars/secret-vars.yml + - ./vars/vars.yml + + roles: + - artifactory +``` + +## Bastion Hosts +In many cases, you may want to run this Ansible collection through a Bastion host to provision JFrog servers. You can include the following Var for a host or group of hosts: + +``` +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"' +``` + +## Upgrades +The Artifactory and Xray roles support software upgrades. To use a role to perform a software upgrade only, use the _artifactory_upgrade_only_ or _xray_upgrade_only_ variables and specify the version. See the following example. + +``` +- hosts: artifactory + vars: + artifactory_version: "{{ lookup('env', 'artifactory_version_upgrade') }}" + artifactory_upgrade_only: true + roles: + - artifactory + +- hosts: xray + vars: + xray_version: "{{ lookup('env', 'xray_version_upgrade') }}" + xray_upgrade_only: true + roles: + - xray +``` \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/galaxy.yml b/Ansible/ansible_collections/jfrog/installers/galaxy.yml similarity index 73% rename from Ansible/collection/jfrog/ansible/galaxy.yml rename to Ansible/ansible_collections/jfrog/installers/galaxy.yml index 2b44148..f507c41 100644 --- a/Ansible/collection/jfrog/ansible/galaxy.yml +++ b/Ansible/ansible_collections/jfrog/installers/galaxy.yml @@ -3,40 +3,44 @@ # The namespace of the collection. This can be a company/brand/organization or product namespace under which all # content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with # underscores or numbers and cannot contain consecutive underscores -namespace: jfrog +namespace: "jfrog" # The name of the collection. Has the same character restrictions as 'namespace' -name: ansible +name: "installers" # The version of the collection. Must be compatible with semantic versioning -version: 1.0.0 +version: "1.0.8" # The path to the Markdown (.md) readme file. This path is relative to the root of the collection -readme: README.md +readme: "README.md" # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) # @nicks:irc/im.site#channel' authors: -- your name + - "Jeff Fry " ### OPTIONAL but strongly recommended # A short summary description of the collection -description: your collection description +description: "This collection provides roles for installing Artifactory and Xray. Additionally, it provides optional SSL and Postgresql roles if these are needed for your deployment." # Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only # accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' license: -- GPL-2.0-or-later + - "Apache-2.0" # The path to the license file for the collection. This path is relative to the root of the collection. This key is # mutually exclusive with 'license' -license_file: '' +license_file: "" # A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character # requirements as 'namespace' and 'name' -tags: [] +tags: + - artifactory + - xray + - jfrog + - application # Collections that this collection requires to be installed for it to be usable. The key of the dict is the # collection label 'namespace.name'. The value is a version range @@ -45,13 +49,13 @@ tags: [] dependencies: {} # The URL of the originating SCM repository -repository: http://example.com/repository +repository: "https://github.com/jfrog/JFrog-Cloud-Installers/" # The URL to any online docs -documentation: http://docs.example.com +documentation: "https://github.com/jfrog/JFrog-Cloud-Installers/blob/master/Ansible/README.md" # The URL to the homepage of the collection/project -homepage: http://example.com +homepage: "https://github.com/jfrog/JFrog-Cloud-Installers/" # The URL to the collection issue tracker -issues: http://example.com/issue/tracker +issues: "https://github.com/jfrog/JFrog-Cloud-Installers/issues" diff --git a/Ansible/ansible_collections/jfrog/installers/jfrog-installers-1.0.8.tar.gz b/Ansible/ansible_collections/jfrog/installers/jfrog-installers-1.0.8.tar.gz new file mode 100644 index 0000000..51d104e Binary files /dev/null and b/Ansible/ansible_collections/jfrog/installers/jfrog-installers-1.0.8.tar.gz differ diff --git a/Ansible/collection/jfrog/ansible/plugins/README.md b/Ansible/ansible_collections/jfrog/installers/plugins/README.md similarity index 100% rename from Ansible/collection/jfrog/ansible/plugins/README.md rename to Ansible/ansible_collections/jfrog/installers/plugins/README.md diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory/README.md b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/README.md new file mode 100644 index 0000000..cf6c2a5 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/README.md @@ -0,0 +1,45 @@ +# artifactory +The artifactory role installs the Artifactory Pro software onto the host. Per the Vars below, it will configure a node as primary or secondary. This role uses secondary roles artifactory_nginx to install nginx. + +## Role Variables +* _artifactory_version_: The version of Artifactory to install. eg. "7.4.1" +* _master_key_: This is the Artifactory [Master Key](https://www.jfrog.com/confluence/display/JFROG/Managing+Keys). See below to [autogenerate this key](#autogenerating-master-and-join-keys). +* _join_key_: This is the Artifactory [Join Key](https://www.jfrog.com/confluence/display/JFROG/Managing+Keys). See below to [autogenerate this key](#autogenerating-master-and-join-keys). +* _db_download_url_: This is the download URL for the JDBC driver for your database. eg. "https://jdbc.postgresql.org/download/postgresql-42.2.12.jar" +* _db_type_: This is the database type. eg. "postgresql" +* _db_driver_: This is the JDBC driver class. eg. "org.postgresql.Driver" +* _db_url_: This is the JDBC database url. eg. "jdbc:postgresql://10.0.0.120:5432/artifactory" +* _db_user_: The database user to configure. eg. "artifactory" +* _db_password_: The database password to configure. "Art1fact0ry" +* _server_name_: This is the server name. eg. "artifactory.54.175.51.178.xip.io" +* _system_file_: Your own [system YAML](https://www.jfrog.com/confluence/display/JFROG/System+YAML+Configuration+File) 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](https://www.jfrog.com/confluence/display/JFROG/Configuring+the+Filestore) can be used. If specified, the default cluster-file-system will not be used. +* _artifactory_upgrade_only_: Perform an software upgrade only. Default is false. + +### primary vars (vars used by the primary Artifactory server) +* _artifactory_is_primary_: For the primary node this must be set to **true**. +* _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 (vars used by the secondary Artifactory server) +* _artifactory_is_primary_: For the secondary node(s) this must be set to **false**. + +## Example Playbook +``` +--- +- hosts: primary + roles: + - artifactory +``` + +## Upgrades +The Artifactory role supports software upgrades. To use a role to perform a software upgrade only, use the _artifactory_upgrade_only_ variable and specify the version. See the following example. + +``` +- hosts: artifactory + vars: + artifactory_version: "{{ lookup('env', 'artifactory_version_upgrade') }}" + artifactory_upgrade_only: true + roles: + - artifactory +``` \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/defaults/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/defaults/main.yml similarity index 83% rename from Ansible/collection/jfrog/ansible/roles/artifactory/defaults/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory/defaults/main.yml index 4520463..490b1bd 100644 --- a/Ansible/collection/jfrog/ansible/roles/artifactory/defaults/main.yml +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/defaults/main.yml @@ -4,7 +4,7 @@ ansible_marketplace: standalone # The version of Artifactory to install -artifactory_version: 7.4.1 +artifactory_version: 7.6.1 # licenses file - specify a licenses file or specify up to 5 licenses artifactory_license1: @@ -20,7 +20,7 @@ artifactory_ha_enabled: true artifactory_is_primary: true # The location where Artifactory should install. -artifactory_download_directory: /opt/jfrog +jfrog_home_directory: /opt/jfrog # The location where Artifactory should store data. artifactory_file_store_dir: /data @@ -31,7 +31,8 @@ artifactory_flavour: pro extra_java_opts: -server -Xms2g -Xmx14g -Xss256k -XX:+UseG1GC artifactory_tar: https://dl.bintray.com/jfrog/artifactory-pro/org/artifactory/pro/jfrog-artifactory-pro/{{ artifactory_version }}/jfrog-artifactory-pro-{{ artifactory_version }}-linux.tar.gz -artifactory_home: "{{ artifactory_download_directory }}/artifactory-{{ artifactory_flavour }}-{{ artifactory_version }}" +artifactory_home: "{{ jfrog_home_directory }}/artifactory" +artifactory_untar_home: "{{ jfrog_home_directory }}/artifactory-{{ artifactory_flavour }}-{{ artifactory_version }}" artifactory_user: artifactory artifactory_group: artifactory @@ -46,3 +47,6 @@ service_list: status_pattern: artifactory user_name: "{{ artifactory_user }}" group_name: "{{ artifactory_group }}" + +# if this is an upgrade +artifactory_upgrade_only: false \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/handlers/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/handlers/main.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory/handlers/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory/handlers/main.yml diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory/meta/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/meta/main.yml new file mode 100644 index 0000000..c128393 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/meta/main.yml @@ -0,0 +1,16 @@ +galaxy_info: + author: "Jeff Fry " + description: "The artifactory role installs the Artifactory Pro software onto the host. Per the Vars below, it will configure a node as primary or secondary. This role uses secondary roles artifactory_nginx to install nginx." + 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: + - artifactory + - jfrog + +dependencies: [] \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/tasks/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/tasks/install.yml similarity index 86% rename from Ansible/collection/jfrog/ansible/roles/artifactory/tasks/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory/tasks/install.yml index 04b3a8e..a97d554 100644 --- a/Ansible/collection/jfrog/ansible/roles/artifactory/tasks/main.yml +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/tasks/install.yml @@ -1,8 +1,10 @@ --- -# tasks file for artifactory +- debug: + msg: "Performing installation of Artifactory..." + - name: install nginx include_role: - name: artifactory-nginx + name: artifactory_nginx - name: create group for artifactory group: @@ -17,25 +19,29 @@ system: yes become: yes -- name: ensure artifactory_download_directory exists +- name: ensure jfrog_home_directory exists file: - path: "{{ artifactory_download_directory }}" + path: "{{ jfrog_home_directory }}" state: directory become: yes - name: download artifactory unarchive: src: "{{ artifactory_tar }}" - dest: "{{ artifactory_download_directory }}" + dest: "{{ jfrog_home_directory }}" remote_src: yes owner: "{{ artifactory_user }}" group: "{{ artifactory_group }}" - creates: "{{ artifactory_home }}" + creates: "{{ artifactory_untar_home }}" become: yes register: downloadartifactory until: downloadartifactory is succeeded retries: 3 +- name: MV untar directory to artifactory home + command: "mv {{ artifactory_untar_home }} {{ artifactory_home }}" + become: yes + - name: ensure artifactory_file_store_dir exists file: path: "{{ artifactory_file_store_dir }}" @@ -86,9 +92,9 @@ dest: "{{ artifactory_home }}/var/etc/security/join.key" become: yes -- name: ensure {{ artifactory_home }}/var/etc/info/ exists +- name: ensure {{ artifactory_home }}/var/etc/artifactory/info/ exists file: - path: "{{ artifactory_home }}/var/etc/info/" + path: "{{ artifactory_home }}/var/etc/artifactory/info/" state: directory owner: "{{ artifactory_user }}" group: "{{ artifactory_group }}" @@ -97,7 +103,7 @@ - name: configure installer info template: src: installer-info.json.j2 - dest: "{{ artifactory_home }}/var/etc/info/installer-info.json" + dest: "{{ artifactory_home }}/var/etc/artifactory/info/installer-info.json" become: yes - name: use specified binary store diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory/tasks/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/tasks/main.yml new file mode 100644 index 0000000..3afccb3 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/tasks/main.yml @@ -0,0 +1,6 @@ +- name: perform installation + include_tasks: "install.yml" + when: not artifactory_upgrade_only +- name: perform upgrade + include_tasks: "upgrade.yml" + when: artifactory_upgrade_only \ No newline at end of file diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory/tasks/upgrade.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/tasks/upgrade.yml new file mode 100644 index 0000000..a0273dd --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/tasks/upgrade.yml @@ -0,0 +1,63 @@ +--- +- debug: + msg: "Performing upgrade of Artifactory..." + +- name: stop artifactory + service: + name: artifactory + state: stopped + become: yes + +- name: ensure jfrog_home_directory exists + file: + path: "{{ jfrog_home_directory }}" + state: directory + become: yes + +- name: download artifactory + unarchive: + src: "{{ artifactory_tar }}" + dest: "{{ jfrog_home_directory }}" + remote_src: yes + owner: "{{ artifactory_user }}" + group: "{{ artifactory_group }}" + creates: "{{ artifactory_untar_home }}" + become: yes + register: downloadartifactory + until: downloadartifactory is succeeded + retries: 3 + +- name: Delete artifactory app + file: + path: "{{ artifactory_home }}/app" + state: absent + become: yes + +- name: CP new app to artifactory app + command: "cp -r {{ artifactory_untar_home }}/app {{ artifactory_home }}/app" + become: yes + +- name: Delete untar directory + file: + path: "{{ artifactory_untar_home }}" + state: absent + become: yes + +- name: start and enable the primary node + service: + name: artifactory + state: restarted + become: yes + when: artifactory_is_primary == true + +- name: random wait before restarting to prevent secondary nodes from hitting DB first + pause: + seconds: "{{ 120 | random + 10}}" + when: artifactory_is_primary == false + +- name: start and enable the secondary nodes + service: + name: artifactory + state: restarted + become: yes + when: artifactory_is_primary == false diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/templates/artifactory.cluster.license.j2 b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/artifactory.cluster.license.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory/templates/artifactory.cluster.license.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/artifactory.cluster.license.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/templates/binarystore.xml.j2 b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/binarystore.xml.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory/templates/binarystore.xml.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/binarystore.xml.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/templates/installer-info.json.j2 b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/installer-info.json.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory/templates/installer-info.json.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/installer-info.json.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/templates/join.key.j2 b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/join.key.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory/templates/join.key.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/join.key.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/templates/master.key.j2 b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/master.key.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory/templates/master.key.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/master.key.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/templates/system.yaml.j2 b/Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/system.yaml.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory/templates/system.yaml.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory/templates/system.yaml.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/.travis.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/.travis.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/.travis.yml rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/.travis.yml diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/README.md b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/README.md new file mode 100644 index 0000000..6a6cb60 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/README.md @@ -0,0 +1,5 @@ +# artifactory_nginx +This role installs NGINX for artifactory. This role is automatically called by the artifactory role and isn't intended to be used separately. + +## Role Variables +* _server_name_: This is the server name. eg. "artifactory.54.175.51.178.xip.io" \ No newline at end of file diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/defaults/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/defaults/main.yml new file mode 100644 index 0000000..5818d2b --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for artifactory_nginx \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/files/nginx.conf b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/files/nginx.conf similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory-nginx/files/nginx.conf rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/files/nginx.conf diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/handlers/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/handlers/main.yml new file mode 100644 index 0000000..f07f4d4 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for artifactory_nginx \ No newline at end of file diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/meta/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/meta/main.yml new file mode 100644 index 0000000..bb133f7 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/meta/main.yml @@ -0,0 +1,16 @@ +galaxy_info: + author: "Jeff Fry " + description: "This role installs NGINX for artifactory. This role is automatically called by the artifactory role and isn't intended to be used separately." + 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: + - artifactory + - jfrog + +dependencies: [] \ No newline at end of file diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/tasks/Debian.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/tasks/Debian.yml new file mode 100644 index 0000000..cc41ad0 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/tasks/Debian.yml @@ -0,0 +1,9 @@ +--- +- name: apt-get update + apt: + update_cache: yes + register: package_res + retries: 5 + delay: 60 + become: yes + until: package_res is success diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/tasks/RedHat.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/tasks/RedHat.yml new file mode 100644 index 0000000..93c4168 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/tasks/RedHat.yml @@ -0,0 +1,6 @@ +--- +- name: epel-release + yum: + name: epel-release + state: present + become: yes \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/tasks/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/tasks/main.yml similarity index 87% rename from Ansible/collection/jfrog/ansible/roles/artifactory-nginx/tasks/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/tasks/main.yml index 5146b14..d3c27c2 100644 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/tasks/main.yml +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/tasks/main.yml @@ -1,4 +1,7 @@ --- +- name: perform dependency installation + include_tasks: "{{ ansible_os_family }}.yml" + - name: install nginx package: name: nginx diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/templates/artifactory.conf.j2 b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/templates/artifactory.conf.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory-nginx/templates/artifactory.conf.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/templates/artifactory.conf.j2 diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/vars/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/vars/main.yml new file mode 100644 index 0000000..7d43ed5 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for artifactory_nginx \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/.travis.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/.travis.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory-nginx/.travis.yml rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/.travis.yml diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/README.md b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/README.md new file mode 100644 index 0000000..9a32719 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/README.md @@ -0,0 +1,16 @@ +# artifactory_nginx_ssl +The artifactory_nginx_ssl role installs and configures nginx for SSL. + +## Role Variables +* _server_name_: This is the server name. eg. "artifactory.54.175.51.178.xip.io" +* _certificate_: This is the SSL cert. +* _certificate_key_: This is the SSL private key. + +## Example Playbook +``` +--- +- hosts: primary + roles: + - artifactory + - artifactory_nginx_ssl +``` diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/defaults/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/defaults/main.yml new file mode 100644 index 0000000..5818d2b --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for artifactory_nginx \ No newline at end of file diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/handlers/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/handlers/main.yml new file mode 100644 index 0000000..f07f4d4 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for artifactory_nginx \ No newline at end of file diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/meta/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/meta/main.yml new file mode 100644 index 0000000..5715d56 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/meta/main.yml @@ -0,0 +1,16 @@ +galaxy_info: + author: "Jeff Fry " + description: "The artifactory_nginx_ssl role installs and configures nginx for SSL." + 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: + - artifactory + - jfrog + +dependencies: [] \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/tasks/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/tasks/main.yml similarity index 95% rename from Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/tasks/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/tasks/main.yml index ba37c53..ea18fe2 100644 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/tasks/main.yml +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/tasks/main.yml @@ -1,5 +1,5 @@ --- -# tasks file for artifactory-nginx +# tasks file for artifactory_nginx - name: configure the artifactory nginx conf template: src: artifactory.conf.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/templates/artifactory.conf.j2 b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/templates/artifactory.conf.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/templates/artifactory.conf.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/templates/artifactory.conf.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/templates/certificate.key.j2 b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/templates/certificate.key.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/templates/certificate.key.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/templates/certificate.key.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/templates/certificate.pem.j2 b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/templates/certificate.pem.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/templates/certificate.pem.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/templates/certificate.pem.j2 diff --git a/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/vars/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/vars/main.yml new file mode 100644 index 0000000..7d43ed5 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/artifactory_nginx_ssl/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for artifactory_nginx \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/.travis.yml b/Ansible/ansible_collections/jfrog/installers/roles/postgres/.travis.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/.travis.yml rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/.travis.yml diff --git a/Ansible/ansible_collections/jfrog/installers/roles/postgres/README.md b/Ansible/ansible_collections/jfrog/installers/roles/postgres/README.md new file mode 100644 index 0000000..f8740f1 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/postgres/README.md @@ -0,0 +1,14 @@ +# postgres +The postgres role will install Postgresql software and configure a database and user to support an Artifactory or Xray server. + +### Role Variables +* _db_users_: This is a list of database users to create. eg. db_users: - { db_user: "artifactory", db_password: "Art1fAct0ry" } +* _dbs_: This is the database to create. eg. dbs: - { db_name: "artifactory", db_owner: "artifactory" } + +## Example Playbook +``` +--- +- hosts: database + roles: + - postgres +``` \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/defaults/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/postgres/defaults/main.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/defaults/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/defaults/main.yml diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/handlers/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/postgres/handlers/main.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/handlers/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/handlers/main.yml diff --git a/Ansible/ansible_collections/jfrog/installers/roles/postgres/meta/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/postgres/meta/main.yml new file mode 100644 index 0000000..674d197 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/postgres/meta/main.yml @@ -0,0 +1,16 @@ +galaxy_info: + author: "Jeff Fry " + description: "The postgres role will install Postgresql software and configure a database and user to support an Artifactory or Xray server." + 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: + - postgres + - jfrog + +dependencies: [] \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/tasks/Debian.yml b/Ansible/ansible_collections/jfrog/installers/roles/postgres/tasks/Debian.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/tasks/Debian.yml rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/tasks/Debian.yml diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/tasks/RedHat.yml b/Ansible/ansible_collections/jfrog/installers/roles/postgres/tasks/RedHat.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/tasks/RedHat.yml rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/tasks/RedHat.yml diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/tasks/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/postgres/tasks/main.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/tasks/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/tasks/main.yml diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/templates/pg_hba.conf.j2 b/Ansible/ansible_collections/jfrog/installers/roles/postgres/templates/pg_hba.conf.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/templates/pg_hba.conf.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/templates/pg_hba.conf.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/templates/postgresql.conf.j2 b/Ansible/ansible_collections/jfrog/installers/roles/postgres/templates/postgresql.conf.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/templates/postgresql.conf.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/templates/postgresql.conf.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/vars/Debian.yml b/Ansible/ansible_collections/jfrog/installers/roles/postgres/vars/Debian.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/vars/Debian.yml rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/vars/Debian.yml diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/vars/RedHat.yml b/Ansible/ansible_collections/jfrog/installers/roles/postgres/vars/RedHat.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/vars/RedHat.yml rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/vars/RedHat.yml diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/vars/RedHat_pg-9.6.yml b/Ansible/ansible_collections/jfrog/installers/roles/postgres/vars/RedHat_pg-9.6.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/vars/RedHat_pg-9.6.yml rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/vars/RedHat_pg-9.6.yml diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/vars/RedHat_pg-default.yml b/Ansible/ansible_collections/jfrog/installers/roles/postgres/vars/RedHat_pg-default.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/postgres/vars/RedHat_pg-default.yml rename to Ansible/ansible_collections/jfrog/installers/roles/postgres/vars/RedHat_pg-default.yml diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/.travis.yml b/Ansible/ansible_collections/jfrog/installers/roles/xray/.travis.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/artifactory/.travis.yml rename to Ansible/ansible_collections/jfrog/installers/roles/xray/.travis.yml diff --git a/Ansible/ansible_collections/jfrog/installers/roles/xray/README.md b/Ansible/ansible_collections/jfrog/installers/roles/xray/README.md new file mode 100644 index 0000000..eb5b304 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/xray/README.md @@ -0,0 +1,35 @@ +# xray +The xray role will install Xray software onto the host. An Artifactory server and Postgress database is required. + +### Role Variables +* _xray_version_: The version of Artifactory to install. eg. "3.3.0" +* _jfrog_url_: This is the URL to the Artifactory base URL. eg. "http://ec2-54-237-207-135.compute-1.amazonaws.com" +* _master_key_: This is the Artifactory [Master Key](https://www.jfrog.com/confluence/display/JFROG/Managing+Keys). See below to [autogenerate this key](#autogenerating-master-and-join-keys). +* _join_key_: This is the Artifactory [Join Key](https://www.jfrog.com/confluence/display/JFROG/Managing+Keys). See below to [autogenerate this key](#autogenerating-master-and-join-keys). +* _db_type_: This is the database type. eg. "postgresql" +* _db_driver_: This is the JDBC driver class. eg. "org.postgresql.Driver" +* _db_url_: This is the database url. eg. "postgres://10.0.0.59:5432/xraydb?sslmode=disable" +* _db_user_: The database user to configure. eg. "xray" +* _db_password_: The database password to configure. "xray" +* _system_file_: Your own [system YAML](https://www.jfrog.com/confluence/display/JFROG/System+YAML+Configuration+File) file can be specified and used. If specified, this file will be used rather than constructing a file from the parameters above. +* _xray_upgrade_only_: Perform an software upgrade only. Default is false. + +## Example Playbook +``` +--- +- hosts: xray + 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 + vars: + xray_version: "{{ lookup('env', 'xray_version_upgrade') }}" + xray_upgrade_only: true + roles: + - xray +``` \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/xray/defaults/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/xray/defaults/main.yml similarity index 52% rename from Ansible/collection/jfrog/ansible/roles/xray/defaults/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/xray/defaults/main.yml index b8aad42..3478fd5 100644 --- a/Ansible/collection/jfrog/ansible/roles/xray/defaults/main.yml +++ b/Ansible/ansible_collections/jfrog/installers/roles/xray/defaults/main.yml @@ -4,20 +4,24 @@ ansible_marketplace: standalone # The version of xray to install -xray_version: 3.3.0 +xray_version: 3.5.2 # whether to enable HA xray_ha_enabled: true # The location where xray should install. -xray_download_directory: /opt/jfrog +jfrog_home_directory: /opt/jfrog # The remote xray download file -xray_tar: https://bintray.com/standAloneDownload/downloadArtifact?agree=true&artifactPath=/jfrog/jfrog-xray/xray-linux/{{ xray_version }}/jfrog-xray-{{ xray_version }}-linux.tar.gz&callback_id=anonymous&product=xray +xray_tar: https://dl.bintray.com/jfrog/jfrog-xray/xray-linux/{{ xray_version }}/jfrog-xray-{{ xray_version }}-linux.tar.gz #The xray install directory -xray_home: "{{ xray_download_directory }}/jfrog-xray-{{ xray_version }}-linux" +xray_untar_home: "{{ jfrog_home_directory }}/jfrog-xray-{{ xray_version }}-linux" +xray_home: "{{ jfrog_home_directory }}/xray" #xray users and groups xray_user: xray xray_group: xray + +# if this is an upgrade +xray_upgrade_only: false \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/xray/handlers/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/xray/handlers/main.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/xray/handlers/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/xray/handlers/main.yml diff --git a/Ansible/ansible_collections/jfrog/installers/roles/xray/meta/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/xray/meta/main.yml new file mode 100644 index 0000000..b2be45e --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/xray/meta/main.yml @@ -0,0 +1,16 @@ +galaxy_info: + author: "Jeff Fry " + 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: [] \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/xray/tasks/Debian.yml b/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/Debian.yml similarity index 98% rename from Ansible/collection/jfrog/ansible/roles/xray/tasks/Debian.yml rename to Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/Debian.yml index 420c2d0..8aa2a79 100644 --- a/Ansible/collection/jfrog/ansible/roles/xray/tasks/Debian.yml +++ b/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/Debian.yml @@ -33,5 +33,4 @@ - name: Install erlang apt: deb: "{{ xray_home }}/app/third-party/rabbitmq/esl-erlang_21.2.1-1~ubuntu~xenial_amd64.deb" - become: yes - + become: yes \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/xray/tasks/RedHat.yml b/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/RedHat.yml similarity index 72% rename from Ansible/collection/jfrog/ansible/roles/xray/tasks/RedHat.yml rename to Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/RedHat.yml index 8d24eb7..35792f9 100644 --- a/Ansible/collection/jfrog/ansible/roles/xray/tasks/RedHat.yml +++ b/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/RedHat.yml @@ -1,16 +1,18 @@ --- - name: Install db-utl yum: - name: "{{ xray_home }}/app/third-party/misc/db4-utils-4.7.25-20.el6_7.x86_64.rpm" + name: "{{ xray_home }}/app/third-party/misc/libdb-utils-5.3.21-19.el7.x86_64.rpm" state: present + become: yes - name: Install socat yum: name: "{{ xray_home }}/app/third-party/rabbitmq/socat-1.7.3.2-2.el7.x86_64.rpm" state: present + become: yes - name: Install erlang yum: name: "{{ xray_home }}/app/third-party/rabbitmq/erlang-21.1.4-1.el7.centos.x86_64.rpm" state: present - + become: yes \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/xray/tasks/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/install.yml similarity index 80% rename from Ansible/collection/jfrog/ansible/roles/xray/tasks/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/install.yml index 16810f6..e881e37 100644 --- a/Ansible/collection/jfrog/ansible/roles/xray/tasks/main.yml +++ b/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/install.yml @@ -1,4 +1,7 @@ --- +- debug: + msg: "Performing installation of Xray..." + - name: create group for xray group: name: "{{ xray_group }}" @@ -12,28 +15,35 @@ system: yes become: yes -- name: ensure xray_download_directory exists +- name: ensure jfrog_home_directory exists file: - path: "{{ xray_download_directory }}" + path: "{{ jfrog_home_directory }}" state: directory become: yes - name: download xray unarchive: src: "{{ xray_tar }}" - dest: "{{ xray_download_directory }}" + dest: "{{ jfrog_home_directory }}" remote_src: yes owner: "{{ xray_user }}" group: "{{ xray_group }}" - creates: "{{ xray_home }}" + creates: "{{ xray_untar_home }}" become: yes register: downloadxray until: downloadxray is succeeded retries: 3 -- name: perform prerequisite installation +- name: MV untar directory to xray home + command: "mv {{ xray_untar_home }} {{ xray_home }}" + become: yes + +- debug: + msg: "Running dependency installation for {{ ansible_os_family }}" + +- name: perform dependency installation include_tasks: "{{ ansible_os_family }}.yml" - + - name: ensure etc exists file: path: "{{ xray_home }}/var/etc" @@ -41,7 +51,7 @@ owner: "{{ xray_user }}" group: "{{ xray_group }}" become: yes - + - name: configure system yaml template: src: system.yaml.j2 diff --git a/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/main.yml new file mode 100644 index 0000000..3b9b7e1 --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/main.yml @@ -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 \ No newline at end of file diff --git a/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/upgrade.yml b/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/upgrade.yml new file mode 100644 index 0000000..623661c --- /dev/null +++ b/Ansible/ansible_collections/jfrog/installers/roles/xray/tasks/upgrade.yml @@ -0,0 +1,54 @@ +--- +- debug: + msg: "Performing upgrade of Xray..." + +- name: stop xray + service: + name: xray + state: stopped + become: yes + +- name: ensure jfrog_home_directory exists + file: + path: "{{ jfrog_home_directory }}" + state: directory + become: yes + +- name: download xray + unarchive: + src: "{{ xray_tar }}" + dest: "{{ jfrog_home_directory }}" + remote_src: yes + owner: "{{ xray_user }}" + group: "{{ xray_group }}" + creates: "{{ xray_untar_home }}" + become: yes + register: downloadxray + until: downloadxray is succeeded + retries: 3 + +- name: Delete xray app + file: + path: "{{ xray_home }}/app" + state: absent + become: yes + +- name: CP new app to xray app + command: "cp -r {{ xray_untar_home }}/app {{ xray_home }}/app" + become: yes + +- name: Delete untar directory + file: + path: "{{ xray_untar_home }}" + state: absent + become: yes + +- name: create xray service + shell: "{{ xray_home }}/app/bin/installService.sh" + become: yes + +- name: start and enable xray + service: + name: xray + state: restarted + become: yes \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/xray/templates/installer-info.json.j2 b/Ansible/ansible_collections/jfrog/installers/roles/xray/templates/installer-info.json.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/xray/templates/installer-info.json.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/xray/templates/installer-info.json.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/xray/templates/join.key.j2 b/Ansible/ansible_collections/jfrog/installers/roles/xray/templates/join.key.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/xray/templates/join.key.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/xray/templates/join.key.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/xray/templates/master.key.j2 b/Ansible/ansible_collections/jfrog/installers/roles/xray/templates/master.key.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/xray/templates/master.key.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/xray/templates/master.key.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/xray/templates/system.yaml.j2 b/Ansible/ansible_collections/jfrog/installers/roles/xray/templates/system.yaml.j2 similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/xray/templates/system.yaml.j2 rename to Ansible/ansible_collections/jfrog/installers/roles/xray/templates/system.yaml.j2 diff --git a/Ansible/collection/jfrog/ansible/roles/xray/vars/main.yml b/Ansible/ansible_collections/jfrog/installers/roles/xray/vars/main.yml similarity index 100% rename from Ansible/collection/jfrog/ansible/roles/xray/vars/main.yml rename to Ansible/ansible_collections/jfrog/installers/roles/xray/vars/main.yml diff --git a/Ansible/collection/README.md b/Ansible/collection/README.md deleted file mode 100644 index 1913bd9..0000000 --- a/Ansible/collection/README.md +++ /dev/null @@ -1,87 +0,0 @@ -# Ansible -This repo contains the Ansible collection for JFrog roles. These roles allow you to provision Artifactory for High-Availability using a Primary node and multiple Secondary nodes. Additionally, a Postgresql role is provided for installing an Artifactory Postgresql database. - -## Roles Provided -### artifactory -The artifactory role installs the Artifactory Pro software onto the host. Per the Vars below, it will configure a node as primary or secondary. This role uses secondary roles artifactory-nginx to install nginx. - -### artifactory-nginx-ssl -The artifactory-nginx-ssl role installs and configures nginx for SSL. - -### postgres -The postgres role will install Postgresql software and configure a database and user to support an Artifactory or Xray server. - -### xray -The xray role will install Xray software onto the host. An Artifactory server and Postgress database is required. - -## Vars Required -The following Vars must be configured. - -### databsase vars -* db_users: This is a list of database users to create. eg. db_users: - { db_user: "artifactory", db_password: "Art1fAct0ry" } -* dbs: This is the database to create. eg. dbs: - { db_name: "artifactory", db_owner: "artifactory" } - -### artifactory vars -* artifactory_version: The version of Artifactory to install. eg. "7.4.1" -* master_key: This is the Artifactory Master Key. -* join_key: This is the Artifactory Join Key. -* db_download_url: This is the download URL for the JDBC driver for your database. eg. "https://jdbc.postgresql.org/download/postgresql-42.2.12.jar" -* db_type: This is the database type. eg. "postgresql" -* db_driver: This is the JDBC driver class. eg. "org.postgresql.Driver" -* db_url: This is the JDBC database url. eg. "jdbc:postgresql://10.0.0.120:5432/artifactory" -* db_user: The database user to configure. eg. "artifactory" -* db_password: The database password to configure. "Art1fact0ry" -* 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 -* artifactory_is_primary: For the primary node this must be set to **true**. -* 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 -* artifactory_is_primary: For the secondary node(s) this must be set to **false**. - -### ssl vars (Used with artifactory-nginx-ssl role) -* certificate: This is the SSL cert. -* certificate_key: This is the SSL private key. - -### xray vars -* xray_version: The version of Artifactory to install. eg. "3.3.0" -* jfrog_url: This is the URL to the Artifactory base URL. eg. "http://ec2-54-237-207-135.compute-1.amazonaws.com" -* master_key: This is the Artifactory Master Key. -* join_key: This is the Artifactory Join Key. -* db_type: This is the database type. eg. "postgresql" -* db_driver: This is the JDBC driver class. eg. "org.postgresql.Driver" -* db_url: This is the database url. eg. "postgres://10.0.0.59:5432/xraydb?sslmode=disable" -* db_user: The database user to configure. eg. "xray" -* db_password: The database password to configure. "xray" - -## Example Inventory and Playbooks -Example playbooks are located in the [project](../project) directory. This directory contains several example inventory and plaaybooks for different Artifactory, HA and Xray architectures. - -## Executing a Playbook -``` -ansible-playbook -i - -eg. - ansible-playbook -i example-playbooks/rt-xray-ha/hosts.yml example-playbooks/rt-xray-ha/playbook.yml -``` - -## Autogenerating Master and Join Keys -You may want to auto-generate your master amd join keys and apply it to all the nodes. - -``` -ansible-playbook -i hosts.yml playbook.yml --extra-vars "master_key=$(openssl rand -hex 16) join_key=$(openssl rand -hex 16)" -``` - -## Bastion Hosts -In many cases, you may want to run this Ansible collection through a Bastion host to provision JFrog servers. You can include the following Var for a host or group of hosts: - -``` -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"' -``` \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/defaults/main.yml b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/defaults/main.yml deleted file mode 100644 index 6b28347..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for artifactory-nginx \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/handlers/main.yml b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/handlers/main.yml deleted file mode 100644 index d212386..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for artifactory-nginx \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/meta/main.yml b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/meta/main.yml deleted file mode 100644 index 227ad9c..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/meta/main.yml +++ /dev/null @@ -1,53 +0,0 @@ -galaxy_info: - author: your name - description: your role description - company: your company (optional) - - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Choose a valid license ID from https://spdx.org - some suggested licenses: - # - BSD-3-Clause (default) - # - MIT - # - GPL-2.0-or-later - # - GPL-3.0-only - # - Apache-2.0 - # - CC-BY-4.0 - license: license (GPL-2.0-or-later, MIT, etc) - - min_ansible_version: 2.9 - - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 - - galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. - -dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. - \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/tests/inventory b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/tests/test.yml b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/tests/test.yml deleted file mode 100644 index 7560bbb..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - artifactory-nginx \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/vars/main.yml b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/vars/main.yml deleted file mode 100644 index 7465197..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx-ssl/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for artifactory-nginx \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/defaults/main.yml b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/defaults/main.yml deleted file mode 100644 index 6b28347..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/defaults/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# defaults file for artifactory-nginx \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/handlers/main.yml b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/handlers/main.yml deleted file mode 100644 index d212386..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/handlers/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# handlers file for artifactory-nginx \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/meta/main.yml b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/meta/main.yml deleted file mode 100644 index 227ad9c..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/meta/main.yml +++ /dev/null @@ -1,53 +0,0 @@ -galaxy_info: - author: your name - description: your role description - company: your company (optional) - - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Choose a valid license ID from https://spdx.org - some suggested licenses: - # - BSD-3-Clause (default) - # - MIT - # - GPL-2.0-or-later - # - GPL-3.0-only - # - Apache-2.0 - # - CC-BY-4.0 - license: license (GPL-2.0-or-later, MIT, etc) - - min_ansible_version: 2.9 - - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 - - galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. - -dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. - \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/tests/inventory b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/tests/test.yml b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/tests/test.yml deleted file mode 100644 index 7560bbb..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - artifactory-nginx \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/vars/main.yml b/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/vars/main.yml deleted file mode 100644 index 7465197..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory-nginx/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -# vars file for artifactory-nginx \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/meta/exception.yml b/Ansible/collection/jfrog/ansible/roles/artifactory/meta/exception.yml deleted file mode 100644 index 7de46df..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory/meta/exception.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -exceptions: - - variation: Alpine - reason: Artifactory start/stop scripts don't properly work. - - variation: amazonlinux:1 - reason: "Shutting down artifactory: /usr/bin/java\nfinding\nUsing the default catalina management port (8015) to test shutdown\nArtifactory Tomcat already stopped" diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/meta/main.yml b/Ansible/collection/jfrog/ansible/roles/artifactory/meta/main.yml deleted file mode 100644 index 0dc573a..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory/meta/main.yml +++ /dev/null @@ -1,35 +0,0 @@ ---- -galaxy_info: - author: Robert de Bock - role_name: artifactory - description: Install and configure artifactory on your system. - license: Apache-2.0 - company: none - min_ansible_version: 2.8 - - platforms: - - name: Debian - versions: - - all - - name: EL - versions: - - 7 - - 8 - - name: Fedora - versions: - - all - - name: OpenSUSE - versions: - - all - - name: Ubuntu - versions: - - bionic - - galaxy_tags: - - artifactory - - centos - - redhat - - server - - system - -dependencies: [] diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/meta/preferences.yml b/Ansible/collection/jfrog/ansible/roles/artifactory/meta/preferences.yml deleted file mode 100644 index e7fdebf..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory/meta/preferences.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- -tox_parallel: yes diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/meta/version.yml b/Ansible/collection/jfrog/ansible/roles/artifactory/meta/version.yml deleted file mode 100644 index ea2ef8f..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory/meta/version.yml +++ /dev/null @@ -1,6 +0,0 @@ ---- -project_name: JFrog -reference: "https://github.com/robertdebock/ansible-role-artifactory/blob/master/defaults/main.yml" -versions: - - name: Artifactory - url: "https://dl.bintray.com/jfrog/artifactory/" diff --git a/Ansible/collection/jfrog/ansible/roles/artifactory/vars/main.yml b/Ansible/collection/jfrog/ansible/roles/artifactory/vars/main.yml deleted file mode 100644 index cd21505..0000000 --- a/Ansible/collection/jfrog/ansible/roles/artifactory/vars/main.yml +++ /dev/null @@ -1,2 +0,0 @@ ---- - diff --git a/Ansible/collection/jfrog/ansible/roles/postgres/meta/main.yml b/Ansible/collection/jfrog/ansible/roles/postgres/meta/main.yml deleted file mode 100644 index cc79dee..0000000 --- a/Ansible/collection/jfrog/ansible/roles/postgres/meta/main.yml +++ /dev/null @@ -1,25 +0,0 @@ ---- - -galaxy_info: - role_name: postgres_server - author: Jeff Fry - description: Installation of Postgres for Artifactory HA - company: JFrog - min_ansible_version: 2.8 - platforms: - - name: Fedora - versions: - - 27 - - 29 - - name: Ubuntu - versions: - - xenial - - bionic - - name: Debian - versions: - - stretch - galaxy_tags: - - postgres - - postgresql - -dependencies: [] diff --git a/Ansible/collection/jfrog/ansible/roles/xray/.travis.yml b/Ansible/collection/jfrog/ansible/roles/xray/.travis.yml deleted file mode 100644 index 36bbf62..0000000 --- a/Ansible/collection/jfrog/ansible/roles/xray/.travis.yml +++ /dev/null @@ -1,29 +0,0 @@ ---- -language: python -python: "2.7" - -# Use the new container infrastructure -sudo: false - -# Install ansible -addons: - apt: - packages: - - python-pip - -install: - # Install ansible - - pip install ansible - - # Check ansible version - - ansible --version - - # Create ansible.cfg with correct roles_path - - printf '[defaults]\nroles_path=../' >ansible.cfg - -script: - # Basic role syntax check - - ansible-playbook tests/test.yml -i tests/inventory --syntax-check - -notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/xray/meta/main.yml b/Ansible/collection/jfrog/ansible/roles/xray/meta/main.yml deleted file mode 100644 index 227ad9c..0000000 --- a/Ansible/collection/jfrog/ansible/roles/xray/meta/main.yml +++ /dev/null @@ -1,53 +0,0 @@ -galaxy_info: - author: your name - description: your role description - company: your company (optional) - - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker - - # Choose a valid license ID from https://spdx.org - some suggested licenses: - # - BSD-3-Clause (default) - # - MIT - # - GPL-2.0-or-later - # - GPL-3.0-only - # - Apache-2.0 - # - CC-BY-4.0 - license: license (GPL-2.0-or-later, MIT, etc) - - min_ansible_version: 2.9 - - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 - - galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. - -dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. - \ No newline at end of file diff --git a/Ansible/collection/jfrog/ansible/roles/xray/tests/inventory b/Ansible/collection/jfrog/ansible/roles/xray/tests/inventory deleted file mode 100644 index 878877b..0000000 --- a/Ansible/collection/jfrog/ansible/roles/xray/tests/inventory +++ /dev/null @@ -1,2 +0,0 @@ -localhost - diff --git a/Ansible/collection/jfrog/ansible/roles/xray/tests/test.yml b/Ansible/collection/jfrog/ansible/roles/xray/tests/test.yml deleted file mode 100644 index f296da6..0000000 --- a/Ansible/collection/jfrog/ansible/roles/xray/tests/test.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -- hosts: localhost - remote_user: root - roles: - - xray \ No newline at end of file diff --git a/Ansible/project/rt-ha/hosts.yml b/Ansible/examples/host_vars/rt-ha/hosts.yml similarity index 97% rename from Ansible/project/rt-ha/hosts.yml rename to Ansible/examples/host_vars/rt-ha/hosts.yml index 6246c53..66a6be5 100644 --- a/Ansible/project/rt-ha/hosts.yml +++ b/Ansible/examples/host_vars/rt-ha/hosts.yml @@ -14,6 +14,7 @@ all: - { db_name: "artifactory", db_owner: "artifactory" } artifactory: vars: + artifactory_version: 7.4.1 artifactory_ha_enabled: true master_key: "c97b862469de0d94fbb7d48130637a5a" join_key: "9bcca98f375c0728d907cc6ee39d4f02" diff --git a/Ansible/project/rt-xray-ha/hosts.yml b/Ansible/examples/host_vars/rt-xray-ha/hosts.yml similarity index 96% rename from Ansible/project/rt-xray-ha/hosts.yml rename to Ansible/examples/host_vars/rt-xray-ha/hosts.yml index 0a79555..796305c 100644 --- a/Ansible/project/rt-xray-ha/hosts.yml +++ b/Ansible/examples/host_vars/rt-xray-ha/hosts.yml @@ -20,6 +20,7 @@ all: - { db_user: "xray", db_password: "xray" } artifactory: vars: + artifactory_version: 7.4.1 artifactory_ha_enabled: true master_key: "c97b862469de0d94fbb7d48130637a5a" join_key: "9bcca98f375c0728d907cc6ee39d4f02" @@ -42,6 +43,7 @@ all: artifactory_license5: x xray: vars: + xray_version: 3.3.0 jfrog_url: http://ec2-18-210-33-94.compute-1.amazonaws.com master_key: "c97b862469de0d94fbb7d48130637a5a" join_key: "9bcca98f375c0728d907cc6ee39d4f02" diff --git a/Ansible/project/rt-xray/hosts.yml b/Ansible/examples/host_vars/rt-xray/hosts.yml similarity index 95% rename from Ansible/project/rt-xray/hosts.yml rename to Ansible/examples/host_vars/rt-xray/hosts.yml index c553954..3fac82c 100644 --- a/Ansible/project/rt-xray/hosts.yml +++ b/Ansible/examples/host_vars/rt-xray/hosts.yml @@ -16,6 +16,7 @@ all: artifactory: hosts: 54.237.207.135: + artifactory_version: 7.4.1 artifactory_license1: x artifactory_license2: x artifactory_license3: x @@ -33,6 +34,7 @@ all: xray: hosts: 100.25.104.174: + xray_version: 3.3.0 jfrog_url: "http://ec2-54-237-207-135.compute-1.amazonaws.com" master_key: "c97b862469de0d94fbb7d48130637a5a" join_key: "9bcca98f375c0728d907cc6ee39d4f02" diff --git a/Ansible/project/rt/hosts.yml b/Ansible/examples/host_vars/rt/hosts.yml similarity index 95% rename from Ansible/project/rt/hosts.yml rename to Ansible/examples/host_vars/rt/hosts.yml index 42dab9b..f030ff6 100644 --- a/Ansible/project/rt/hosts.yml +++ b/Ansible/examples/host_vars/rt/hosts.yml @@ -13,6 +13,7 @@ all: primary: hosts: 54.165.47.191: + artifactory_version: 7.4.1 artifactory_is_primary: true artifactory_license_file: "{{ lookup('env', 'artifactory_license_file') }}" db_download_url: "https://jdbc.postgresql.org/download/postgresql-42.2.12.jar" diff --git a/Ansible/project/ssl/hosts.yml b/Ansible/examples/host_vars/ssl/hosts.yml similarity index 97% rename from Ansible/project/ssl/hosts.yml rename to Ansible/examples/host_vars/ssl/hosts.yml index c6c8f9f..c51aa1b 100644 --- a/Ansible/project/ssl/hosts.yml +++ b/Ansible/examples/host_vars/ssl/hosts.yml @@ -14,6 +14,7 @@ all: primary: hosts: 100.25.104.198: + artifactory_version: 7.4.1 artifactory_is_primary: true artifactory_license1: x artifactory_license2: x diff --git a/Ansible/examples/host_vars/xray/hosts.yml b/Ansible/examples/host_vars/xray/hosts.yml new file mode 100644 index 0000000..a4acffc --- /dev/null +++ b/Ansible/examples/host_vars/xray/hosts.yml @@ -0,0 +1,18 @@ +--- +all: + vars: + ansible_user: "centos" + children: + xray: + vars: + xray_version: 3.3.0 + jfrog_url: http://ec2-18-210-33-94.compute-1.amazonaws.com + master_key: "c97b862469de0d94fbb7d48130637a5a" + join_key: "9bcca98f375c0728d907cc6ee39d4f02" + db_type: "postgresql" + db_driver: "org.postgresql.Driver" + db_url: "postgres://10.0.0.5:5432/xraydb?sslmode=disable" + db_user: "xray" + db_password: "xray" + hosts: + 3.17.132.222 diff --git a/Ansible/examples/playbook-rt-ha.yml b/Ansible/examples/playbook-rt-ha.yml new file mode 100644 index 0000000..57fc65c --- /dev/null +++ b/Ansible/examples/playbook-rt-ha.yml @@ -0,0 +1,13 @@ +--- +- hosts: database + collections: + - jfrog.installers + roles: + - postgres + +- hosts: primary:secondary + collections: + - jfrog.installers + roles: + - artifactory + - artifactory_nginx_ssl \ No newline at end of file diff --git a/Ansible/project/rt-xray/playbook.yml b/Ansible/examples/playbook-rt-xray.yml similarity index 53% rename from Ansible/project/rt-xray/playbook.yml rename to Ansible/examples/playbook-rt-xray.yml index 9c0ff31..6081198 100644 --- a/Ansible/project/rt-xray/playbook.yml +++ b/Ansible/examples/playbook-rt-xray.yml @@ -1,12 +1,18 @@ --- - hosts: database + collections: + - jfrog.installers roles: - postgres - hosts: artifactory + collections: + - jfrog.installers roles: - artifactory - hosts: xray + collections: + - jfrog.installers roles: - xray \ No newline at end of file diff --git a/Ansible/project/ssl/playbook.yml b/Ansible/examples/playbook-rt.yml similarity index 54% rename from Ansible/project/ssl/playbook.yml rename to Ansible/examples/playbook-rt.yml index 359472b..72ffbec 100644 --- a/Ansible/project/ssl/playbook.yml +++ b/Ansible/examples/playbook-rt.yml @@ -1,9 +1,12 @@ --- - hosts: database + collections: + - jfrog.installers roles: - postgres - hosts: primary + collections: + - jfrog.installers roles: - artifactory - - artifactory-nginx-ssl diff --git a/Ansible/examples/playbook-ssl.yml b/Ansible/examples/playbook-ssl.yml new file mode 100644 index 0000000..7370111 --- /dev/null +++ b/Ansible/examples/playbook-ssl.yml @@ -0,0 +1,13 @@ +--- +- hosts: database + collections: + - jfrog.installers + roles: + - postgres + +- hosts: primary + collections: + - jfrog.installers + roles: + - artifactory + - artifactory_nginx_ssl diff --git a/Ansible/examples/playbook-xray.yml b/Ansible/examples/playbook-xray.yml new file mode 100644 index 0000000..3f0e5a4 --- /dev/null +++ b/Ansible/examples/playbook-xray.yml @@ -0,0 +1,6 @@ +--- +- hosts: xray + collections: + - jfrog.installers + roles: + - xray \ No newline at end of file diff --git a/Ansible/infra/aws/lb-rt-xray-ha-centos78.json b/Ansible/infra/aws/lb-rt-xray-ha-centos78.json new file mode 100644 index 0000000..73859a8 --- /dev/null +++ b/Ansible/infra/aws/lb-rt-xray-ha-centos78.json @@ -0,0 +1,769 @@ +{ + "Description": "This template deploys a VPC, with a pair of public and private subnets spread across two Availability Zones. It deploys an internet gateway, with a default route on the public subnets. It deploys a pair of NAT gateways (one in each AZ), and default routes for them in the private subnets.", + "Parameters": { + "SSHKeyName": { + "Description": "Name of the ec2 key you need one to use this template", + "Type": "AWS::EC2::KeyPair::KeyName", + "Default": "choose-key" + }, + "EnvironmentName": { + "Description": "An environment name that is prefixed to resource names", + "Type": "String", + "Default": "Ansible" + }, + "VpcCIDR": { + "Description": "Please enter the IP range (CIDR notation) for this VPC", + "Type": "String", + "Default": "10.192.0.0/16" + }, + "PublicSubnet1CIDR": { + "Description": "Please enter the IP range (CIDR notation) for the public subnet in the first Availability Zone", + "Type": "String", + "Default": "10.192.10.0/24" + }, + "PublicSubnet2CIDR": { + "Description": "Please enter the IP range (CIDR notation) for the public subnet in the second Availability Zone", + "Type": "String", + "Default": "10.192.11.0/24" + }, + "PrivateSubnet1CIDR": { + "Description": "Please enter the IP range (CIDR notation) for the private subnet in the first Availability Zone", + "Type": "String", + "Default": "10.192.20.0/24" + }, + "PrivateSubnet2CIDR": { + "Description": "Please enter the IP range (CIDR notation) for the private subnet in the second Availability Zone", + "Type": "String", + "Default": "10.192.21.0/24" + } + }, + "Mappings": { + "RegionToAmazonAMI": { + "us-east-1": { + "HVM64": "ami-02e98f78" + }, + "us-east-2": { + "HVM64": "ami-01e36b7901e884a10" + }, + "us-west-1": { + "HVM64": "ami-074e2d6769f445be5" + }, + "us-west-2": { + "HVM64": "ami-01ed306a12b7d1c96" + } + } + }, + "Resources": { + "VPC": { + "Type": "AWS::EC2::VPC", + "Properties": { + "CidrBlock": { + "Ref": "VpcCIDR" + }, + "EnableDnsSupport": true, + "EnableDnsHostnames": true, + "Tags": [ + { + "Key": "Name", + "Value": { + "Ref": "EnvironmentName" + } + } + ] + } + }, + "InternetGateway": { + "Type": "AWS::EC2::InternetGateway", + "Properties": { + "Tags": [ + { + "Key": "Name", + "Value": { + "Ref": "EnvironmentName" + } + } + ] + } + }, + "InternetGatewayAttachment": { + "Type": "AWS::EC2::VPCGatewayAttachment", + "Properties": { + "InternetGatewayId": { + "Ref": "InternetGateway" + }, + "VpcId": { + "Ref": "VPC" + } + } + }, + "PublicSubnet1": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "VPC" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": { + "Ref": "PublicSubnet1CIDR" + }, + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "Name", + "Value": { + "Fn::Sub": "${EnvironmentName} Public Subnet (AZ1)" + } + } + ] + } + }, + "PublicSubnet2": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "VPC" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": { + "Ref": "PublicSubnet2CIDR" + }, + "MapPublicIpOnLaunch": true, + "Tags": [ + { + "Key": "Name", + "Value": { + "Fn::Sub": "${EnvironmentName} Public Subnet (AZ2)" + } + } + ] + } + }, + "PrivateSubnet1": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "VPC" + }, + "AvailabilityZone": { + "Fn::Select": [ + 0, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": { + "Ref": "PrivateSubnet1CIDR" + }, + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "Name", + "Value": { + "Fn::Sub": "${EnvironmentName} Private Subnet (AZ1)" + } + } + ] + } + }, + "PrivateSubnet2": { + "Type": "AWS::EC2::Subnet", + "Properties": { + "VpcId": { + "Ref": "VPC" + }, + "AvailabilityZone": { + "Fn::Select": [ + 1, + { + "Fn::GetAZs": "" + } + ] + }, + "CidrBlock": { + "Ref": "PrivateSubnet2CIDR" + }, + "MapPublicIpOnLaunch": false, + "Tags": [ + { + "Key": "Name", + "Value": { + "Fn::Sub": "${EnvironmentName} Private Subnet (AZ2)" + } + } + ] + } + }, + "NatGateway1EIP": { + "Type": "AWS::EC2::EIP", + "DependsOn": "InternetGatewayAttachment", + "Properties": { + "Domain": "vpc" + } + }, + "NatGateway2EIP": { + "Type": "AWS::EC2::EIP", + "DependsOn": "InternetGatewayAttachment", + "Properties": { + "Domain": "vpc" + } + }, + "NatGateway1": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "NatGateway1EIP", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "PublicSubnet1" + } + } + }, + "NatGateway2": { + "Type": "AWS::EC2::NatGateway", + "Properties": { + "AllocationId": { + "Fn::GetAtt": [ + "NatGateway2EIP", + "AllocationId" + ] + }, + "SubnetId": { + "Ref": "PublicSubnet2" + } + } + }, + "PublicRouteTable": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPC" + }, + "Tags": [ + { + "Key": "Name", + "Value": { + "Fn::Sub": "${EnvironmentName} Public Routes" + } + } + ] + } + }, + "DefaultPublicRoute": { + "Type": "AWS::EC2::Route", + "DependsOn": "InternetGatewayAttachment", + "Properties": { + "RouteTableId": { + "Ref": "PublicRouteTable" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "GatewayId": { + "Ref": "InternetGateway" + } + } + }, + "PublicSubnet1RouteTableAssociation": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "PublicRouteTable" + }, + "SubnetId": { + "Ref": "PublicSubnet1" + } + } + }, + "PublicSubnet2RouteTableAssociation": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "PublicRouteTable" + }, + "SubnetId": { + "Ref": "PublicSubnet2" + } + } + }, + "PrivateRouteTable1": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPC" + }, + "Tags": [ + { + "Key": "Name", + "Value": { + "Fn::Sub": "${EnvironmentName} Private Routes (AZ1)" + } + } + ] + } + }, + "DefaultPrivateRoute1": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "PrivateRouteTable1" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "NatGateway1" + } + } + }, + "PrivateSubnet1RouteTableAssociation": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "PrivateRouteTable1" + }, + "SubnetId": { + "Ref": "PrivateSubnet1" + } + } + }, + "PrivateRouteTable2": { + "Type": "AWS::EC2::RouteTable", + "Properties": { + "VpcId": { + "Ref": "VPC" + }, + "Tags": [ + { + "Key": "Name", + "Value": { + "Fn::Sub": "${EnvironmentName} Private Routes (AZ2)" + } + } + ] + } + }, + "DefaultPrivateRoute2": { + "Type": "AWS::EC2::Route", + "Properties": { + "RouteTableId": { + "Ref": "PrivateRouteTable2" + }, + "DestinationCidrBlock": "0.0.0.0/0", + "NatGatewayId": { + "Ref": "NatGateway2" + } + } + }, + "PrivateSubnet2RouteTableAssociation": { + "Type": "AWS::EC2::SubnetRouteTableAssociation", + "Properties": { + "RouteTableId": { + "Ref": "PrivateRouteTable2" + }, + "SubnetId": { + "Ref": "PrivateSubnet2" + } + } + }, + "EC2SecurityGroup": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "SSH, Port 80, Database", + "VpcId": { + "Ref": "VPC" + }, + "SecurityGroupIngress": [ + { + "IpProtocol": "tcp", + "FromPort": 22, + "ToPort": 22, + "CidrIp": "0.0.0.0/0" + }, + { + "IpProtocol": "tcp", + "FromPort": 5432, + "ToPort": 5432, + "CidrIp": "0.0.0.0/0" + }, + { + "IpProtocol": "tcp", + "FromPort": 8082, + "ToPort": 8082, + "CidrIp": "0.0.0.0/0" + }, + { + "IpProtocol": "tcp", + "FromPort": 80, + "ToPort": 80, + "SourceSecurityGroupId": { + "Ref": "ELBSecurityGroup" + } + } + ] + } + }, + "ELBSecurityGroup": { + "Type": "AWS::EC2::SecurityGroup", + "Properties": { + "GroupDescription": "SSH and Port 80", + "VpcId": { + "Ref": "VPC" + }, + "SecurityGroupIngress": [ + { + "IpProtocol": "tcp", + "FromPort": 80, + "ToPort": 80, + "CidrIp": "0.0.0.0/0" + } + ] + } + }, + "BastionInstance": { + "Type": "AWS::EC2::Instance", + "Properties": { + "ImageId": { + "Fn::FindInMap": [ + "RegionToAmazonAMI", + { + "Ref": "AWS::Region" + }, + "HVM64" + ] + }, + "InstanceInitiatedShutdownBehavior": "stop", + "InstanceType": "t2.medium", + "KeyName": { + "Ref": "SSHKeyName" + }, + "Monitoring": "true", + "NetworkInterfaces": [ + { + "AssociatePublicIpAddress": "true", + "DeviceIndex": "0", + "GroupSet": [ + { + "Ref": "EC2SecurityGroup" + } + ], + "SubnetId": { + "Ref": "PublicSubnet1" + } + } + ], + "Tags": [ + { + "Key": "Name", + "Value": "bastion" + } + ], + "Tenancy": "default" + } + }, + "RTPriInstance": { + "Type": "AWS::EC2::Instance", + "Properties": { + "ImageId": { + "Fn::FindInMap": [ + "RegionToAmazonAMI", + { + "Ref": "AWS::Region" + }, + "HVM64" + ] + }, + "InstanceInitiatedShutdownBehavior": "stop", + "InstanceType": "t2.medium", + "KeyName": { + "Ref": "SSHKeyName" + }, + "Monitoring": "true", + "NetworkInterfaces": [ + { + "AssociatePublicIpAddress": "false", + "DeviceIndex": "0", + "GroupSet": [ + { + "Ref": "EC2SecurityGroup" + } + ], + "SubnetId": { + "Ref": "PrivateSubnet1" + } + } + ], + "Tags": [ + { + "Key": "Name", + "Value": "rtprimary" + } + ], + "Tenancy": "default" + } + }, + "RTSecInstance": { + "Type": "AWS::EC2::Instance", + "Properties": { + "ImageId": { + "Fn::FindInMap": [ + "RegionToAmazonAMI", + { + "Ref": "AWS::Region" + }, + "HVM64" + ] + }, + "InstanceInitiatedShutdownBehavior": "stop", + "InstanceType": "t2.medium", + "KeyName": { + "Ref": "SSHKeyName" + }, + "Monitoring": "true", + "NetworkInterfaces": [ + { + "AssociatePublicIpAddress": "false", + "DeviceIndex": "0", + "GroupSet": [ + { + "Ref": "EC2SecurityGroup" + } + ], + "SubnetId": { + "Ref": "PrivateSubnet2" + } + } + ], + "Tags": [ + { + "Key": "Name", + "Value": "rtsecondary" + } + ], + "Tenancy": "default" + } + }, + "XrayInstance": { + "Type": "AWS::EC2::Instance", + "Properties": { + "ImageId": { + "Fn::FindInMap": [ + "RegionToAmazonAMI", + { + "Ref": "AWS::Region" + }, + "HVM64" + ] + }, + "InstanceInitiatedShutdownBehavior": "stop", + "InstanceType": "t2.medium", + "KeyName": { + "Ref": "SSHKeyName" + }, + "Monitoring": "true", + "NetworkInterfaces": [ + { + "AssociatePublicIpAddress": "false", + "DeviceIndex": "0", + "GroupSet": [ + { + "Ref": "EC2SecurityGroup" + } + ], + "SubnetId": { + "Ref": "PrivateSubnet1" + } + } + ], + "Tags": [ + { + "Key": "Name", + "Value": "xray" + } + ], + "Tenancy": "default" + } + }, + "DBInstance": { + "Type": "AWS::EC2::Instance", + "Properties": { + "ImageId": { + "Fn::FindInMap": [ + "RegionToAmazonAMI", + { + "Ref": "AWS::Region" + }, + "HVM64" + ] + }, + "InstanceInitiatedShutdownBehavior": "stop", + "InstanceType": "t2.medium", + "KeyName": { + "Ref": "SSHKeyName" + }, + "Monitoring": "true", + "NetworkInterfaces": [ + { + "AssociatePublicIpAddress": "false", + "DeviceIndex": "0", + "GroupSet": [ + { + "Ref": "EC2SecurityGroup" + } + ], + "SubnetId": { + "Ref": "PrivateSubnet1" + } + } + ], + "Tags": [ + { + "Key": "Name", + "Value": "database" + } + ], + "Tenancy": "default" + } + }, + "EC2TargetGroup": { + "Type": "AWS::ElasticLoadBalancingV2::TargetGroup", + "Properties": { + "HealthCheckIntervalSeconds": 30, + "HealthCheckProtocol": "HTTP", + "HealthCheckTimeoutSeconds": 15, + "HealthyThresholdCount": 2, + "Matcher": { + "HttpCode": "200,302" + }, + "Name": "EC2TargetGroup", + "Port": 80, + "Protocol": "HTTP", + "TargetGroupAttributes": [ + { + "Key": "deregistration_delay.timeout_seconds", + "Value": "20" + } + ], + "Targets": [ + { + "Id": { + "Ref": "RTPriInstance" + } + }, + { + "Id": { + "Ref": "RTSecInstance" + }, + "Port": 80 + } + ], + "UnhealthyThresholdCount": 3, + "VpcId": { + "Ref": "VPC" + }, + "Tags": [ + { + "Key": "Name", + "Value": "EC2TargetGroup" + }, + { + "Key": "Port", + "Value": 80 + } + ] + } + }, + "ALBListener": { + "Type": "AWS::ElasticLoadBalancingV2::Listener", + "Properties": { + "DefaultActions": [ + { + "Type": "forward", + "TargetGroupArn": { + "Ref": "EC2TargetGroup" + } + } + ], + "LoadBalancerArn": { + "Ref": "ApplicationLoadBalancer" + }, + "Port": 80, + "Protocol": "HTTP" + } + }, + "ApplicationLoadBalancer": { + "Type": "AWS::ElasticLoadBalancingV2::LoadBalancer", + "Properties": { + "Scheme": "internet-facing", + "Subnets": [ + { + "Ref": "PublicSubnet1" + }, + { + "Ref": "PublicSubnet2" + } + ], + "SecurityGroups": [ + { + "Ref": "ELBSecurityGroup" + } + ] + } + } + }, + + "Outputs": { + "VPC": { + "Description": "Virtual Private Cloud", + "Value": { + "Ref": "VPC" + } + }, + "ALBHostName": { + "Description": "Application Load Balancer Hostname", + "Value": { + "Fn::GetAtt": [ + "ApplicationLoadBalancer", + "DNSName" + ] + } + }, + "BastionInstancePublic": { + "Description": "Bastion", + "Value": { "Fn::GetAtt" : [ "BastionInstance", "PublicIp" ]} + }, + "BastionInstancePrivate": { + "Description": "Bastion", + "Value": { "Fn::GetAtt" : [ "BastionInstance", "PrivateIp" ]} + }, + "RTPriInstancePrivate": { + "Description": "RTPriInstance", + "Value": { "Fn::GetAtt" : [ "RTPriInstance", "PrivateIp" ]} + }, + "RTSecInstancePrivate": { + "Description": "RTSecInstance", + "Value": { "Fn::GetAtt" : [ "RTSecInstance", "PrivateIp" ]} + }, + "XrayInstancePrivate": { + "Description": "XrayInstance", + "Value": { "Fn::GetAtt" : [ "XrayInstance", "PrivateIp" ]} + }, + "DBInstancePrivate": { + "Description": "DBInstance", + "Value": { "Fn::GetAtt" : [ "DBInstance", "PrivateIp" ]} + } + } +} \ No newline at end of file diff --git a/Ansible/infra/aws/lb-rt-xray-ha.json b/Ansible/infra/aws/lb-rt-xray-ha-ubuntu16.json similarity index 100% rename from Ansible/infra/aws/lb-rt-xray-ha.json rename to Ansible/infra/aws/lb-rt-xray-ha-ubuntu16.json diff --git a/Ansible/pipelines.yaml b/Ansible/pipelines.yaml index 3fd14a5..9f7a18f 100644 --- a/Ansible/pipelines.yaml +++ b/Ansible/pipelines.yaml @@ -34,8 +34,10 @@ pipelines: - sudo apt -y --allow-unauthenticated install ansible - sudo pip install packaging - sudo pip install boto3 botocore - - cd ../dependencyState/resources/ansibleRepo + - cd dependencyState/resources/ansibleRepo - echo 'Setting environment variables...' + - export artifactory_version="$int_ansibleEnvVars_artifactory_version" + - export xray_version="$int_ansibleEnvVars_xray_version" - export artifactory_license1="$int_ansibleEnvVars_artifactory_license1" - export artifactory_license2="$int_ansibleEnvVars_artifactory_license2" - export artifactory_license3="$int_ansibleEnvVars_artifactory_license3" @@ -47,6 +49,8 @@ pipelines: - export AWS_ACCESS_KEY_ID="$int_ansibleEnvVars_AWS_ACCESS_KEY_ID" - export AWS_SECRET_KEY="$int_ansibleEnvVars_AWS_SECRET_KEY" - printenv + - pwd + - ls - eval $(ssh-agent -s) - ssh-add <(echo "$int_ansiblePrivateKey_key") - ansible-playbook Ansible/test/aws/playbook.yaml @@ -80,8 +84,10 @@ pipelines: - sudo pip install packaging - sudo pip install msrestazure - sudo pip install ansible[azure] - - cd ../dependencyState/resources/ansibleRepo + - cd dependencyState/resources/ansibleRepo - echo 'Setting environment variables...' + - export artifactory_version="$int_ansibleEnvVars_artifactory_version" + - export xray_version="$int_ansibleEnvVars_xray_version" - export artifactory_license1="$int_ansibleEnvVars_artifactory_license1" - export artifactory_license2="$int_ansibleEnvVars_artifactory_license2" - export artifactory_license3="$int_ansibleEnvVars_artifactory_license3" @@ -94,6 +100,8 @@ pipelines: - export clientSecret="$int_ansibleAzureKeys_password" - export tenantId="$int_ansibleAzureKeys_tenant" - printenv + - pwd + - ls - eval $(ssh-agent -s) - ssh-add <(echo "$int_ansiblePrivateKey_key") - az login --service-principal -u "$clientId" -p "$clientSecret" --tenant "$tenantId" diff --git a/Ansible/project/rt-ha/playbook.yml b/Ansible/project/rt-ha/playbook.yml deleted file mode 100644 index ae9639e..0000000 --- a/Ansible/project/rt-ha/playbook.yml +++ /dev/null @@ -1,11 +0,0 @@ ---- -- hosts: database - gather_facts: true - roles: - - jfrog/ansible/roles/postgres - -- hosts: primary:secondary - gather_facts: true - roles: - - jfrog/ansible/roles/artifactory - - jfrog/ansible/roles/artifactory-nginx-ssl \ No newline at end of file diff --git a/Ansible/project/rt-xray-auto-keys/hosts.yml b/Ansible/project/rt-xray-auto-keys/hosts.yml deleted file mode 100644 index 76babec..0000000 --- a/Ansible/project/rt-xray-auto-keys/hosts.yml +++ /dev/null @@ -1,40 +0,0 @@ ---- -all: - vars: - ansible_user: "ubuntu" - ansible_ssh_private_key_file: "/Users/jefff/.ssh/ansible-priv.pem" - ansible_ssh_common_args: '-o ProxyCommand="ssh -o StrictHostKeyChecking=no -A ubuntu@13.82.225.20 -W %h:%p"' - children: - database: - hosts: - 34.239.107.0: - dbs: - - { db_name: "artifactory", db_owner: "artifactory" } - - { db_name: "xraydb", db_owner: "xray" } - db_users: - - { db_user: "artifactory", db_password: "Art1fAct0ry" } - - { db_user: "xray", db_password: "xray" } - artifactory: - hosts: - 54.237.207.135: - artifactory_license1: x - artifactory_license2: x - artifactory_license3: x - artifactory_license4: x - artifactory_license5: x - db_download_url: "https://jdbc.postgresql.org/download/postgresql-42.2.12.jar" - db_type: "postgresql" - db_driver: "org.postgresql.Driver" - db_url: "jdbc:postgresql://10.0.0.59:5432/artifactory" - db_user: "artifactory" - db_password: "Art1fAct0ry" - server_name: "ec2-54-237-207-135.compute-1.amazonaws.com" - xray: - hosts: - 100.25.104.174: - jfrog_url: "http://ec2-54-237-207-135.compute-1.amazonaws.com" - db_type: "postgresql" - db_driver: "org.postgresql.Driver" - db_url: "postgres://10.0.0.59:5432/xraydb?sslmode=disable" - db_user: "xray" - db_password: "xray" diff --git a/Ansible/project/rt-xray-auto-keys/playbook.yml b/Ansible/project/rt-xray-auto-keys/playbook.yml deleted file mode 100644 index 2e99018..0000000 --- a/Ansible/project/rt-xray-auto-keys/playbook.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- debug: - var: master_key - -- debug: - var: join_key - -- hosts: database - roles: - - postgres - -- hosts: artifactory - roles: - - artifactory - -- hosts: xray - roles: - - xray \ No newline at end of file diff --git a/Ansible/project/rt-xray-auto-keys/runAutoKeysPlaybook.sh b/Ansible/project/rt-xray-auto-keys/runAutoKeysPlaybook.sh deleted file mode 100755 index 0949cb0..0000000 --- a/Ansible/project/rt-xray-auto-keys/runAutoKeysPlaybook.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/usr/bin/env bash - -ansible-playbook -i hosts.yml playbook.yml --extra-vars "master_key=$(openssl rand -hex 16) join_key=$(openssl rand -hex 16)" \ No newline at end of file diff --git a/Ansible/project/rt-xray-ha-ssh-proxy/hosts.yml b/Ansible/project/rt-xray-ha-ssh-proxy/hosts.yml deleted file mode 100644 index 8651299..0000000 --- a/Ansible/project/rt-xray-ha-ssh-proxy/hosts.yml +++ /dev/null @@ -1,60 +0,0 @@ ---- -all: - vars: - ansible_user: "ubuntu" - ansible_ssh_private_key_file: "/Users/jefff/.ssh/ansible-priv.pem" - ansible_ssh_common_args: '-o ProxyCommand="ssh -o StrictHostKeyChecking=no -A ubuntu@13.82.225.20 -W %h:%p"' - children: - database: - hosts: - #artifactory database - 10.0.0.6: - db_users: - - { db_user: "artifactory", db_password: "Art1fAct0ry" } - dbs: - - { db_name: "artifactory", db_owner: "artifactory" } - #xray database - 10.0.0.4: - dbs: - - { db_name: "xraydb", db_owner: "xray" } - db_users: - - { db_user: "xray", db_password: "xray" } - artifactory: - vars: - artifactory_ha_enabled: true - master_key: "c97b862469de0d94fbb7d48130637a5a" - join_key: "9bcca98f375c0728d907cc6ee39d4f02" - db_download_url: "https://jdbc.postgresql.org/download/postgresql-42.2.12.jar" - db_type: "postgresql" - db_driver: "org.postgresql.Driver" - db_url: "jdbc:postgresql://10.0.0.6:5432/artifactory" - db_user: "artifactory" - db_password: "Art1fAct0ry" - server_name: "rt.13.82.225.208.xip.io" - children: - primary: - hosts: - 10.0.0.8: - artifactory_is_primary: true - artifactory_license1: x - artifactory_license2: x - artifactory_license3: x - artifactory_license4: x - artifactory_license5: x - secondary: - hosts: - 10.0.0.9: - vars: - artifactory_is_primary: false - xray: - vars: - jfrog_url: http://rt.13.82.225.208.xip.io/ - master_key: "c97b862469de0d94fbb7d48130637a5a" - join_key: "9bcca98f375c0728d907cc6ee39d4f02" - db_type: "postgresql" - db_driver: "org.postgresql.Driver" - db_url: "postgres://10.0.0.4:5432/xraydb?sslmode=disable" - db_user: "xray" - db_password: "xray" - hosts: - 10.0.0.5: diff --git a/Ansible/project/rt-xray-ha-ssh-proxy/playbook.yml b/Ansible/project/rt-xray-ha-ssh-proxy/playbook.yml deleted file mode 100644 index 825fe0b..0000000 --- a/Ansible/project/rt-xray-ha-ssh-proxy/playbook.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- hosts: database - roles: - - postgres - -- hosts: primary:secondary - roles: - - artifactory - -- hosts: xray - roles: - - xray \ No newline at end of file diff --git a/Ansible/project/rt-xray-ha/playbook.yml b/Ansible/project/rt-xray-ha/playbook.yml deleted file mode 100644 index b25f3af..0000000 --- a/Ansible/project/rt-xray-ha/playbook.yml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- hosts: database - roles: - - postgres - -- hosts: primary - roles: - - artifactory - -- hosts: xray - roles: - - xray \ No newline at end of file diff --git a/Ansible/project/rt/playbook.yml b/Ansible/project/rt/playbook.yml deleted file mode 100644 index 48d7c1e..0000000 --- a/Ansible/project/rt/playbook.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- hosts: database - roles: - - postgres - -- hosts: primary - roles: - - artifactory diff --git a/Ansible/project/rt/runPlaybook.sh b/Ansible/project/rt/runPlaybook.sh deleted file mode 100755 index 1c5d200..0000000 --- a/Ansible/project/rt/runPlaybook.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/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)" \ No newline at end of file diff --git a/Ansible/test/aws/playbook.yaml b/Ansible/test/aws/playbook-ha-install.yaml similarity index 96% rename from Ansible/test/aws/playbook.yaml rename to Ansible/test/aws/playbook-ha-install.yaml index fafe557..a859072 100644 --- a/Ansible/test/aws/playbook.yaml +++ b/Ansible/test/aws/playbook-ha-install.yaml @@ -33,6 +33,7 @@ hostname: "{{ AWSDeployment.stack_outputs.RTPriInstancePrivate }}" ansible_user: "ubuntu" ansible_ssh_common_args: '-o ProxyCommand="ssh -o StrictHostKeyChecking=no -A ubuntu@{{ AWSDeployment.stack_outputs.BastionInstancePublic }} -W %h:%p"' + artifactory_version: "{{ lookup('env', 'artifactory_version') }}" db_url: "jdbc:postgresql://{{ AWSDeployment.stack_outputs.DBInstancePrivate }}:5432/artifactory" server_name: "{{ AWSDeployment.stack_outputs.ALBHostName }}" artifactory_is_primary: true @@ -47,6 +48,7 @@ hostname: "{{ AWSDeployment.stack_outputs.RTSecInstancePrivate }}" ansible_user: "ubuntu" ansible_ssh_common_args: '-o ProxyCommand="ssh -o StrictHostKeyChecking=no -A ubuntu@{{ AWSDeployment.stack_outputs.BastionInstancePublic }} -W %h:%p"' + artifactory_version: "{{ lookup('env', 'artifactory_version') }}" db_url: "jdbc:postgresql://{{ AWSDeployment.stack_outputs.DBInstancePrivate }}:5432/artifactory" server_name: "{{ AWSDeployment.stack_outputs.ALBHostName }}" artifactory_is_primary: false @@ -58,6 +60,7 @@ hostname: "{{ AWSDeployment.stack_outputs.XrayInstancePrivate }}" ansible_user: "ubuntu" ansible_ssh_common_args: '-o ProxyCommand="ssh -o StrictHostKeyChecking=no -A ubuntu@{{ AWSDeployment.stack_outputs.BastionInstancePublic }} -W %h:%p"' + xray_version: "{{ lookup('env', 'xray_version') }}" jfrog_url: "http://{{ AWSDeployment.stack_outputs.ALBHostName }}" master_key: "{{ lookup('env', 'master_key') }}" join_key: "{{ lookup('env', 'join_key') }}" diff --git a/Ansible/test/aws/runAws.sh b/Ansible/test/aws/runAwsInstall.sh similarity index 100% rename from Ansible/test/aws/runAws.sh rename to Ansible/test/aws/runAwsInstall.sh diff --git a/Ansible/test/azure/playbook.yaml b/Ansible/test/azure/playbook.yaml index f4eb24a..6304319 100644 --- a/Ansible/test/azure/playbook.yaml +++ b/Ansible/test/azure/playbook.yaml @@ -44,6 +44,7 @@ hostname: "{{ azureDeployment.deployment.outputs.vmArtPriIp.value }}" ansible_user: "ubuntu" ansible_ssh_common_args: '-o ProxyCommand="ssh -o StrictHostKeyChecking=no -A ubuntu@{{ azureDeployment.deployment.outputs.lbIp.value }} -W %h:%p"' + artifactory_version: "{{ lookup('env', 'artifactory_version') }}" db_url: "jdbc:postgresql://{{ azureDeployment.deployment.outputs.vmDbArrIp.value[0] }}:5432/artifactory" server_name: "rt.{{ azureDeployment.deployment.outputs.lbIp.value }}.xip.io" artifactory_is_primary: true @@ -58,6 +59,7 @@ hostname: "{{ item }}" ansible_user: "ubuntu" ansible_ssh_common_args: '-o ProxyCommand="ssh -o StrictHostKeyChecking=no -A ubuntu@{{ azureDeployment.deployment.outputs.lbIp.value }} -W %h:%p"' + artifactory_version: "{{ lookup('env', 'artifactory_version') }}" db_url: "jdbc:postgresql://{{ azureDeployment.deployment.outputs.vmDbArrIp.value[0] }}:5432/artifactory" server_name: "rt.{{ azureDeployment.deployment.outputs.lbIp.value }}.xip.io" artifactory_is_primary: false @@ -70,6 +72,7 @@ hostname: "{{ item }}" ansible_user: "ubuntu" ansible_ssh_common_args: '-o ProxyCommand="ssh -o StrictHostKeyChecking=no -A ubuntu@{{ azureDeployment.deployment.outputs.lbIp.value }} -W %h:%p"' + xray_version: "{{ lookup('env', 'xray_version') }}" jfrog_url: "http://rt.{{ azureDeployment.deployment.outputs.lbIp.value }}.xip.io" master_key: "{{ lookup('env', 'master_key') }}" join_key: "{{ lookup('env', 'join_key') }}" diff --git a/Ansible/test/tests/.gradle/5.2.1/fileChanges/last-build.bin b/Ansible/test/tests/.gradle/5.2.1/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Ansible/test/tests/.gradle/5.2.1/fileChanges/last-build.bin differ diff --git a/Ansible/test/tests/.gradle/5.2.1/fileHashes/fileHashes.lock b/Ansible/test/tests/.gradle/5.2.1/fileHashes/fileHashes.lock new file mode 100644 index 0000000..ceb38cc Binary files /dev/null and b/Ansible/test/tests/.gradle/5.2.1/fileHashes/fileHashes.lock differ diff --git a/Ansible/test/tests/.gradle/5.2.1/gc.properties b/Ansible/test/tests/.gradle/5.2.1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Ansible/test/tests/.gradle/6.5/executionHistory/executionHistory.bin b/Ansible/test/tests/.gradle/6.5/executionHistory/executionHistory.bin new file mode 100644 index 0000000..1da42b9 Binary files /dev/null and b/Ansible/test/tests/.gradle/6.5/executionHistory/executionHistory.bin differ diff --git a/Ansible/test/tests/.gradle/6.5/executionHistory/executionHistory.lock b/Ansible/test/tests/.gradle/6.5/executionHistory/executionHistory.lock new file mode 100644 index 0000000..c83a26b Binary files /dev/null and b/Ansible/test/tests/.gradle/6.5/executionHistory/executionHistory.lock differ diff --git a/Ansible/test/tests/.gradle/6.5/fileChanges/last-build.bin b/Ansible/test/tests/.gradle/6.5/fileChanges/last-build.bin new file mode 100644 index 0000000..f76dd23 Binary files /dev/null and b/Ansible/test/tests/.gradle/6.5/fileChanges/last-build.bin differ diff --git a/Ansible/test/tests/.gradle/6.5/fileContent/fileContent.lock b/Ansible/test/tests/.gradle/6.5/fileContent/fileContent.lock new file mode 100644 index 0000000..1f397f7 Binary files /dev/null and b/Ansible/test/tests/.gradle/6.5/fileContent/fileContent.lock differ diff --git a/Ansible/test/tests/.gradle/6.5/fileHashes/fileHashes.bin b/Ansible/test/tests/.gradle/6.5/fileHashes/fileHashes.bin new file mode 100644 index 0000000..3aa0a9b Binary files /dev/null and b/Ansible/test/tests/.gradle/6.5/fileHashes/fileHashes.bin differ diff --git a/Ansible/test/tests/.gradle/6.5/fileHashes/fileHashes.lock b/Ansible/test/tests/.gradle/6.5/fileHashes/fileHashes.lock new file mode 100644 index 0000000..e9ea2c5 Binary files /dev/null and b/Ansible/test/tests/.gradle/6.5/fileHashes/fileHashes.lock differ diff --git a/Ansible/test/tests/.gradle/6.5/gc.properties b/Ansible/test/tests/.gradle/6.5/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Ansible/test/tests/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/Ansible/test/tests/.gradle/buildOutputCleanup/buildOutputCleanup.lock new file mode 100644 index 0000000..866a35e Binary files /dev/null and b/Ansible/test/tests/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ diff --git a/Ansible/test/tests/.gradle/buildOutputCleanup/cache.properties b/Ansible/test/tests/.gradle/buildOutputCleanup/cache.properties new file mode 100644 index 0000000..9d7456f --- /dev/null +++ b/Ansible/test/tests/.gradle/buildOutputCleanup/cache.properties @@ -0,0 +1,2 @@ +#Thu Jun 18 12:50:09 PDT 2020 +gradle.version=6.5 diff --git a/Ansible/test/tests/.gradle/buildOutputCleanup/outputFiles.bin b/Ansible/test/tests/.gradle/buildOutputCleanup/outputFiles.bin new file mode 100644 index 0000000..b2b9c92 Binary files /dev/null and b/Ansible/test/tests/.gradle/buildOutputCleanup/outputFiles.bin differ diff --git a/Ansible/test/tests/.gradle/checksums/checksums.lock b/Ansible/test/tests/.gradle/checksums/checksums.lock new file mode 100644 index 0000000..19bc257 Binary files /dev/null and b/Ansible/test/tests/.gradle/checksums/checksums.lock differ diff --git a/Ansible/test/tests/.gradle/vcs-1/gc.properties b/Ansible/test/tests/.gradle/vcs-1/gc.properties new file mode 100644 index 0000000..e69de29 diff --git a/Ansible/test/tests/gradle/wrapper/gradle-wrapper.properties b/Ansible/test/tests/gradle/wrapper/gradle-wrapper.properties index 09c586a..f9f4003 100644 --- a/Ansible/test/tests/gradle/wrapper/gradle-wrapper.properties +++ b/Ansible/test/tests/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ #Wed Feb 12 10:23:21 PST 2020 -distributionUrl=https\://services.gradle.org/distributions/gradle-5.2.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStorePath=wrapper/dists diff --git a/AzureResourceManager/LICENSE b/AzureResourceManager/Artifactory/LICENSE similarity index 100% rename from AzureResourceManager/LICENSE rename to AzureResourceManager/Artifactory/LICENSE diff --git a/AzureResourceManager/MP_submission_7/createUiDefinition.json b/AzureResourceManager/Artifactory/MP_submission/createUiDefinition.json similarity index 80% rename from AzureResourceManager/MP_submission_7/createUiDefinition.json rename to AzureResourceManager/Artifactory/MP_submission/createUiDefinition.json index b935f73..e91512a 100644 --- a/AzureResourceManager/MP_submission_7/createUiDefinition.json +++ b/AzureResourceManager/Artifactory/MP_submission/createUiDefinition.json @@ -132,14 +132,10 @@ "name": "artifactoryVersion", "type": "Microsoft.Common.DropDown", "label": "Artifactory-vm image version to deploy.", - "defaultValue": "7.4.3", + "defaultValue": "7.7.3", "toolTip": "Version of Artifactory to deploy", "constraints": { "allowedValues": [ - { - "label": "6.8.0", - "value": "6.8.0" - }, { "label": "6.16.0", "value": "0.16.0" @@ -162,7 +158,15 @@ }, { "label": "7.4.3", - "value": "7.4.3" + "value": "7.4.30" + }, + { + "label": "7.6.2", + "value": "0.0.1" + }, + { + "label": "7.7.3", + "value": "0.0.2" } ], "required": true @@ -179,7 +183,24 @@ "toolTip": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'", "constraints": { "required": true, - "regex": "^[a-z0-9A-Z]{1,32}$", + "regex": "^[a-z0-9A-Z]{12,32}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long." + }, + "options": { + "hideConfirmation": true + } + }, + { + "name": "joinKey", + "type": "Microsoft.Common.PasswordBox", + "label": { + "password": "Artifactory join Key", + "confirmPassword": "Confirm join Key" + }, + "toolTip": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'", + "constraints": { + "required": false, + "regex": "^[a-z0-9A-Z]{12,32}$", "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long." }, "options": { @@ -250,7 +271,7 @@ }, "toolTip": "To use Artifactory as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate.", "constraints": { - "required": true, + "required": false, "regex": "^(-----BEGIN CERTIFICATE-----)(.+)(-----END CERTIFICATE-----)$", "validationMessage": "Provide SSL Certificate." }, @@ -267,7 +288,7 @@ }, "toolTip": "Provide your SSL Certificate key", "constraints": { - "required": true, + "required": false, "regex": "^(-----BEGIN)(.+)(PRIVATE KEY-----)(.+)(-----END)(.+)(PRIVATE KEY-----)$", "validationMessage": "Provide SSL Certificate Key." }, @@ -282,7 +303,7 @@ "defaultValue": "artifactory", "toolTip": "Provide your Certificate Domain Name. For e.g jfrog.team for certificate with *.jfrog.team", "constraints": { - "required": true, + "required": false, "regex": "^(\\*)*([\\w-\\.])+$", "validationMessage": "Must be a valid fully-qualified domain name." } @@ -323,7 +344,77 @@ "bladeTitle": "Database Credential", "elements": [ { - "name": "dbAdminUsername", + "name": "infoMessage", + "type": "Microsoft.Common.InfoBox", + "visible": true, + "options": { + "icon": "Info", + "text": "You can deploy a new Database or use your existing Postgres or MSSQL Databeses" + } + }, + { + "name": "db_type", + "type": "Microsoft.Common.DropDown", + "label": "Database options", + "toolTip": "Deploy a new DB instance or use an existing DB", + "constraints": { + "required": true, + "allowedValues": [ + { + "label": "Deploy a new Postgresql instance", + "value": "Postgresql_deploy.json" + }, + { + "label": "Use existing Postgresql instance", + "value": "Postgresql_existing.json" + }, + { + "label": "Deploy a new MSSQL instance", + "value": "MSSQL_deploy.json" + }, + { + "label": "Use existing MSSQL instance", + "value": "MSSQL_existing.json" + } + ] + }, + "visible": true + }, + { + "name": "db_name", + "type": "Microsoft.Common.TextBox", + "label": "Database name", + "toolTip": "Database name", + "constraints": { + "required": true, + "regex": "^[a-z0-9A-Z]{1,15}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-15 characters long." + } + }, + { + "name": "db_server", + "type": "Microsoft.Common.TextBox", + "label": "Database server name. Skip if a new deployment is selected", + "toolTip": "Database server name", + "constraints": { + "required": false, + "regex": "^[a-z0-9A-Z]{1,15}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-15 characters long." + } + }, + { + "name": "manual_db_url", + "type": "Microsoft.Common.TextBox", + "label": "Database connection string. Skip if a new deployment is selected", + "toolTip": "Jdbc connection string for MSSQL or Postgresql", + "constraints": { + "required": false, + "regex": "..*", + "validationMessage": "DB connection string is not valid" + } + }, + { + "name": "db_user", "type": "Microsoft.Compute.UserNameTextBox", "label": "User name", "toolTip": "Admin username for the database", @@ -335,7 +426,7 @@ } }, { - "name": "dbAdminPassword", + "name": "db_password", "type": "Microsoft.Common.PasswordBox", "label": { "password": "Password", @@ -353,22 +444,11 @@ "visible": true }, { - "name": "dbName", - "type": "Microsoft.Common.TextBox", - "label": "Database name", - "toolTip": "Database name", - "constraints": { - "required": true, - "regex": "^[a-z0-9A-Z]{1,15}$", - "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-15 characters long." - } - }, - { - "name": "dbEdition", + "name": "db_edition", "type": "Microsoft.Common.DropDown", "label": "Database Edition", "defaultValue": "Basic", - "toolTip": "Edition of Database to use", + "toolTip": "MSSQL. Edition of Database to use", "constraints": { "allowedValues": [ { @@ -384,7 +464,7 @@ "value": "Premium" } ], - "required": true + "required": false }, "visible": true } @@ -426,6 +506,7 @@ "nodeCount": "[steps('clusterConfig').nodeCount]", "artifactoryVersion": "[steps('clusterConfig').artifactoryVersion]", "masterKey": "[steps('clusterConfig').masterKey]", + "joinKey": "[steps('clusterConfig').joinKey]", "artifactoryLicense1": "[steps('clusterConfig').artifactoryLicense1]", "artifactoryLicense2": "[steps('clusterConfig').artifactoryLicense2]", "artifactoryLicense3": "[steps('clusterConfig').artifactoryLicense3]", @@ -438,10 +519,13 @@ "extraJavaOptions": "[steps('clusterConfig').extraJavaOptions]", "adminUsername": "[steps('vmCredentials').adminUsername]", "adminPassword": "[steps('vmCredentials').adminPassword.password]", - "DB_Admin_User": "[steps('databaseConfig').dbAdminUsername]", - "DB_Admin_Password": "[steps('databaseConfig').dbAdminPassword]", - "DB_Name": "[steps('databaseConfig').dbName]", - "DB_Edition": "[steps('databaseConfig').dbEdition]", + "db_type": "[steps('databaseConfig').db_type]", + "db_name": "[steps('databaseConfig').db_name]", + "db_server": "[steps('databaseConfig').db_server]", + "manual_db_url": "[steps('databaseConfig').manual_db_url]", + "db_user": "[steps('databaseConfig').db_user]", + "db_password": "[steps('databaseConfig').db_password]", + "db_edition": "[steps('databaseConfig').db_edition]", "storageAccountType": "[steps('storageConfig').storageAccountsType]" } } diff --git a/AzureResourceManager/MP_submission_7/mainTemplate.json b/AzureResourceManager/Artifactory/MP_submission/mainTemplate.json similarity index 81% rename from AzureResourceManager/MP_submission_7/mainTemplate.json rename to AzureResourceManager/Artifactory/MP_submission/mainTemplate.json index 0aaab5d..76b323c 100644 --- a/AzureResourceManager/MP_submission_7/mainTemplate.json +++ b/AzureResourceManager/Artifactory/MP_submission/mainTemplate.json @@ -16,6 +16,51 @@ "description": "String used as a base for naming resources. Must be 3-61 characters in length and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended." } }, + "db_type": { + "type": "string", + "defaultValue": "Postgresql_deploy.json", + "allowedValues": [ + "Postgresql_deploy.json", + "MSSQL_deploy.json", + "Postgresql_existing.json", + "MSSQL_existing.json" + ], + "metadata": { + "description": "Deploy new Postgresql, MSSQL or use existing DB" + } + }, + "manual_db_url": { + "type": "string", + "metadata": { + "description": "DB server URL, if existing DB server is used instead of a new deployment (jdbc:sqlserver://.. or jdbc:postgresql://..)" + } + }, + "db_server": { + "type": "string", + "metadata": { + "description": "DB server name, if pre-existing DB is used" + } + }, + "db_name": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "MSSQL Database name" + } + }, + "db_edition": { + "type": "string", + "minLength": 1, + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ], + "metadata": { + "description": "MSSQL Database Edition" + } + }, "location": { "type": "string", "defaultValue": "[resourceGroup().location]", @@ -34,7 +79,7 @@ }, "artifactoryVersion": { "type": "string", - "defaultValue": "7.4.3", + "defaultValue": "0.0.2", "allowedValues": [ "6.6.0", "6.6.1", @@ -47,7 +92,10 @@ "6.18.0", "7.2.1", "0.3.2", - "7.4.3" + "7.4.3", + "7.4.30", + "0.0.1", + "0.0.2" ], "metadata": { "description": "Artifactory-vm image version to deploy." @@ -60,6 +108,13 @@ "description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'" } }, + "joinKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'" + } + }, "adminUsername": { "type": "string", "metadata": { @@ -142,38 +197,30 @@ "description": "Setting Java Memory Parameters for Artifactory. Learn about system requirements for Artifactory https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware." } }, - "DB_Admin_User": { + "db_user": { "type": "string", "minLength": 1, "metadata": { "description": "Database Admin user name" } }, - "DB_Admin_Password": { + "db_password": { "type": "securestring", "minLength": 1, "metadata": { "description": "Database Admin password" } }, - "DB_Name": { - "type": "string", - "minLength": 1, - "metadata": { - "description": "Database name" - } - }, - "DB_Edition": { - "type": "string", - "minLength": 1, - "defaultValue": "Basic", - "allowedValues": [ - "Basic", - "Standard", - "Premium" - ], - "metadata": { - "description": "Database Edition" + "databases": { + "type": "object", + "defaultValue": { + "properties": [ + { + "name": "artdb", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] } }, "storageAccountType": { @@ -237,13 +284,16 @@ "httpsProbeMemberName": "memberHttpsProbe", "storageAccountName": "[concat(variables('namingInfix'), 'storage')]", "vmStorageAccountContainerName": "filestore", - "azureSqlServerName": "[concat(variables('namingInfix'), 'sqlsrv')]", - "DB_Name": "[parameters('DB_Name')]", - "DB_Admin_User": "[parameters('DB_Admin_User')]", - "DB_Admin_Password": "[parameters('DB_Admin_Password')]", - "DB_Edition": "[parameters('DB_Edition')]", - "DB_Location": "[parameters('location')]", + "azureSqlServerName": "[if(or(equals(parameters('db_type'), 'MSSQL_existing.json'),equals(parameters('db_type'),'Postgresql_existing.json')), parameters('db_server'), concat(variables('namingInfix'), 'sqlsrv'))]", + "artDBname": "[parameters('databases').properties[0].name]", + "postgres_db_user": "[concat(parameters('db_user'), '@', variables('azureSqlServerName'))]", + "db_user": "[if(or(equals(parameters('db_type'), 'Postgresql_deploy.json'),equals(parameters('db_type'),'Postgresql_existing.json')), variables('postgres_db_user'), parameters('db_user'))]", + "db_password": "[parameters('db_password')]", + "db_location": "[parameters('location')]", + "db_name": "[parameters('db_name')]", + "db_edition": "[parameters('db_edition')]", "masterKey": "[parameters('masterKey')]", + "joinKey": "[parameters('joinKey')]", "certificate": "[parameters('certificate')]", "certificateKey": "[parameters('certificateKey')]", "certificateDomain": "[parameters('certificateDomain')]", @@ -261,7 +311,7 @@ "version": "[parameters('artifactoryVersion')]" }, "imageReference": "[variables('osType')]", - "dbTemplate": "azureDBDeploy.json", + "dbTemplate": "[parameters('db_type')]", "dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]", "nsgName": "[concat(variables('namingInfix'), 'nsg')]" }, @@ -283,7 +333,7 @@ "type": "Microsoft.Network/networkSecurityGroups", "location": "[parameters('location')]", "name": "[variables('nsgName')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "properties": { "securityRules": [ { @@ -363,9 +413,9 @@ "type": "Microsoft.Network/virtualNetworks", "name": "[variables('virtualNetworkName')]", "location": "[parameters('location')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "dependsOn": [ - "[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" + "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" ], "properties": { "addressSpace": { @@ -396,14 +446,14 @@ } }, { - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "type": "Microsoft.Network/networkInterfaces", "name": "[variables('nicPrimaryName')]", "location": "[parameters('location')]", "dependsOn": [ - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" ], "properties": { "ipConfigurations": [ @@ -423,14 +473,14 @@ } }, { - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "type": "Microsoft.Network/networkInterfaces", "name": "[variables('nicMemberName')]", "location": "[parameters('location')]", "dependsOn": [ - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" ], "properties": { "ipConfigurations": [ @@ -456,7 +506,7 @@ "sku": { "name": "Standard" }, - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "properties": { "publicIPAllocationMethod": "Static", "dnsSettings": { @@ -471,7 +521,7 @@ "sku": { "name": "Standard" }, - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "properties": { "publicIPAllocationMethod": "Static", "dnsSettings": { @@ -483,13 +533,13 @@ "type": "Microsoft.Network/loadBalancers", "name": "[variables('lbName')]", "location": "[parameters('location')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "sku": { "name": "Standard" }, "dependsOn": [ - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]" + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]" ], "tags":{ "displayName": "Load Balancer" @@ -672,7 +722,7 @@ } }, { - "apiVersion": "2018-07-01", + "apiVersion": "2019-06-01", "type": "Microsoft.Storage/storageAccounts", "name": "[variables('storageAccountName')]", "location": "[parameters('location')]", @@ -688,7 +738,7 @@ { "type": "Microsoft.Resources/deployments", "name": "deploySQLDB", - "apiVersion": "2018-07-01", + "apiVersion": "2019-09-01", "properties": { "mode": "Incremental", "templateLink": { @@ -697,22 +747,28 @@ }, "parameters": { "db_user": { - "value": "[parameters('DB_Admin_User')]" + "value": "[parameters('db_user')]" }, "db_password": { - "value": "[parameters('DB_Admin_Password')]" + "value": "[variables('db_password')]" }, "db_server": { "value": "[variables('azureSqlServerName')]" }, + "db_location": { + "value": "[variables('db_location')]" + }, + "databases": { + "value": "[parameters('databases')]" + }, "db_name": { - "value": "[parameters('DB_Name')]" + "value": "[variables('db_name')]" }, "db_edition": { - "value": "[variables('DB_Edition')]" + "value": "[variables('db_edition')]" }, - "db_location": { - "value": "[variables('DB_Location')]" + "manual_db_url": { + "value": "[parameters('manual_db_url')]" } } } @@ -723,10 +779,10 @@ "location": "[parameters('location')]", "apiVersion": "2018-10-01", "dependsOn": [ - "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]", - "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" + "[resourceId('Microsoft.Network/loadBalancers/', variables('lbName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Resources/deployments/', 'deploySQLDB')]", + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" ], "plan": { "name": "artifactory-vm", @@ -757,7 +813,7 @@ "computerNamePrefix": "[variables('namingInfix')]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]", - "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',variables('certificateKey'),'\nCERTIFICATE=', variables('certificate'),'\nCERTIFICATE_DOMAIN=',variables('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nIS_PRIMARY=','true','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]" + "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',variables('certificateKey'),'\nCERTIFICATE=', variables('certificate'),'\nCERTIFICATE_DOMAIN=',variables('certificateDomain'),'\nDB_TYPE=',parameters('db_type'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('artDBname'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\nIS_PRIMARY=','true','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]" }, "networkProfile": { "networkInterfaceConfigurations": [ @@ -821,11 +877,11 @@ "location": "[parameters('location')]", "apiVersion": "2018-10-01", "dependsOn": [ - "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[concat('Microsoft.Compute/virtualMachineScaleSets/', variables('scaleSetPrimaryName'))]", - "[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]", - "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" + "[resourceId('Microsoft.Network/loadBalancers/', variables('lbName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Compute/virtualMachineScaleSets/', variables('scaleSetPrimaryName'))]", + "[resourceId('Microsoft.Resources/deployments/', 'deploySQLDB')]", + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" ], "plan": { "name": "artifactory-vm", @@ -856,7 +912,7 @@ "computerNamePrefix": "[variables('namingInfix')]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]", - "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',parameters('certificateKey'),'\nCERTIFICATE=', parameters('certificate'),'\nCERTIFICATE_DOMAIN=',parameters('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',parameters('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',parameters('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nIS_PRIMARY=','false','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]" + "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',variables('certificateKey'),'\nCERTIFICATE=', variables('certificate'),'\nCERTIFICATE_DOMAIN=',variables('certificateDomain'),'\nDB_TYPE=',parameters('db_type'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('artDBname'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\nIS_PRIMARY=','false','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]" }, "networkProfile": { "networkInterfaceConfigurations": [ diff --git a/JFrogContainerRegistry/AzureResourceManager/nested/azureDBDeploy.json b/AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_deploy.json similarity index 62% rename from JFrogContainerRegistry/AzureResourceManager/nested/azureDBDeploy.json rename to AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_deploy.json index 8c608f5..2a96758 100644 --- a/JFrogContainerRegistry/AzureResourceManager/nested/azureDBDeploy.json +++ b/AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_deploy.json @@ -1,9 +1,10 @@ { - "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "db_user": { "type": "string", + "defaultValue": "artifactory", "minLength": 1 }, "db_password": { @@ -11,39 +12,43 @@ }, "db_server": { "type": "string", + "defaultValue": "artmssqlsrv", "minLength": 1 }, "db_name": { "type": "string", + "defaultValue": "artdb", "minLength": 1 }, "db_location": { - "type": "string", - "defaultValue": "" + "type": "string" }, "db_edition": { "type": "string", + "defaultValue": "Basic", "allowedValues": [ "Basic", "Standard", "Premium" ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" } }, "variables": { - "rtdbCollation": "Latin1_General_100_CS_AS", - "db_location": "[parameters('db_location')]" + "rtdbCollation": "Latin1_General_100_CS_AS" }, "resources": [ { "name": "[parameters('db_server')]", "type": "Microsoft.Sql/servers", "kind": "v12.0", - "location": "[variables('db_location')]", - "apiVersion": "2015-05-01-preview", - "dependsOn": [ - - ], + "location": "[parameters('db_location')]", + "apiVersion": "2020-02-02-preview", "tags": { "displayName": "artifactoryDB" }, @@ -56,10 +61,10 @@ { "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", "type": "firewallrules", - "location": "[variables('db_location')]", - "apiVersion": "2015-05-01-preview", + "location": "[parameters('db_location')]", + "apiVersion": "2020-02-02-preview", "dependsOn": [ - "[concat('Microsoft.Sql/servers/', parameters('db_server'))]" + "[resourceId('Microsoft.Sql/servers/', parameters('db_server'))]" ], "properties": { "startIpAddress": "0.0.0.0", @@ -70,8 +75,8 @@ "name": "[parameters('db_name')]", "type": "databases", "kind": "v12.0,user", - "location": "[variables('db_location')]", - "apiVersion": "2015-05-01-preview", + "location": "[parameters('db_location')]", + "apiVersion": "2020-02-02-preview", "dependsOn": [ "[parameters('db_server')]" ], @@ -90,7 +95,15 @@ "outputs": { "jdbcConnString": { "type": "string", - "value": "[concat('jdbc:sqlserver://', reference(concat('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]" + "value": "[concat('jdbc:sqlserver://', reference(resourceId('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" } } } diff --git a/AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_existing.json b/AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_existing.json new file mode 100644 index 0000000..4d7aa07 --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/nested/MSSQL_existing.json @@ -0,0 +1,76 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "artifactory", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "mssqlsrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_deploy.json b/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_deploy.json new file mode 100644 index 0000000..464ebd5 --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_deploy.json @@ -0,0 +1,178 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "xray", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artrtdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "skuCapacity": { + "type": "int", + "defaultValue": 2 + }, + "skuFamily": { + "type": "string", + "defaultValue": "Gen5" + }, + "skuName": { + "type": "string", + "defaultValue": "GP_Gen5_2" + }, + "skuSizeMB": { + "type": "int", + "defaultValue": 5120 + }, + "skuTier": { + "type": "string", + "defaultValue": "GeneralPurpose" + }, + "version": { + "type": "string", + "defaultValue": "9.6" + }, + "backupRetentionDays": { + "type": "int", + "defaultValue": 7 + }, + "geoRedundantBackup": { + "type": "string", + "defaultValue": "Disabled" + }, + "databases": { + "type": "object" + }, + "sslEnforcement": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Disabled", + "metadata": { + "description": "SSL Enforcement" + } + }, + "publicNetworkAccess": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Enabled", + "metadata": { + "description": "Public Network Access" + } + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + { + "type": "Microsoft.DBforPostgreSQL/servers", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "name": "[parameters('db_server')]", + "properties": { + "version": "[parameters('version')]", + "administratorLogin": "[parameters('db_user')]", + "administratorLoginPassword": "[parameters('db_password')]", + "publicNetworkAccess": "[parameters('publicNetworkAccess')]", + "sslEnforcement": "[parameters('sslEnforcement')]", + "storageProfile": { + "storageMB": "[parameters('skuSizeMB')]", + "backupRetentionDays": "[parameters('backupRetentionDays')]", + "geoRedundantBackup": "[parameters('geoRedundantBackup')]" + } + }, + "sku": { + "name": "[parameters('skuName')]", + "tier": "[parameters('skuTier')]", + "capacity": "[parameters('skuCapacity')]", + "size": "[parameters('skuSizeMB')]", + "family": "[parameters('skuFamily')]" + }, + "resources": [ + { + "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", + "type": "firewallRules", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[0].name)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[0].charset]", + "collation": "[parameters('databases').properties[0].collation]" + } + } + ] + } + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[concat('jdbc:postgresql://', reference(resourceId('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + }, + "dbServerName": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "xrayConnString": { + "type": "string", + "value": "[concat('postgres://', reference(resourceId('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_existing.json b/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_existing.json new file mode 100644 index 0000000..e8757f3 --- /dev/null +++ b/AzureResourceManager/Artifactory/MP_submission/nested/Postgresql_existing.json @@ -0,0 +1,76 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "artifactory", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/MP_submission_7/scripts/install_artifactory.sh b/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory.sh similarity index 100% rename from AzureResourceManager/MP_submission_7/scripts/install_artifactory.sh rename to AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory.sh diff --git a/AzureResourceManager/scripts/install_artifactory7.sh b/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory7.sh similarity index 74% rename from AzureResourceManager/scripts/install_artifactory7.sh rename to AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory7.sh index 00d1dc2..75bf714 100644 --- a/AzureResourceManager/scripts/install_artifactory7.sh +++ b/AzureResourceManager/Artifactory/MP_submission/scripts/install_artifactory7.sh @@ -1,12 +1,17 @@ #!/bin/bash + +# Script stdout and stderr are stored in /var/lib/waagent/custom-script/download on the VM DB_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JDBC_STR" | sed "s/JDBC_STR=//") DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//") DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//") +DB_TYPE=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_TYPE=" | sed "s/DB_TYPE=//") DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//") STORAGE_ACCT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_NAME=" | sed "s/STO_ACT_NAME=//") STORAGE_CONTAINER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_CTR_NAME=" | sed "s/STO_CTR_NAME=//") STORAGE_ACCT_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_KEY=" | sed "s/STO_ACT_KEY=//") ARTIFACTORY_VERSION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_VERSION=" | sed "s/ARTIFACTORY_VERSION=//") +CERTIFICATE=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//") +CERTIFICATE_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_KEY=//") MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//") IS_PRIMARY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^IS_PRIMARY=" | sed "s/IS_PRIMARY=//") ARTIFACTORY_LICENSE_1=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE1=" | sed "s/LICENSE1=//") @@ -20,6 +25,9 @@ export DEBIAN_FRONTEND=noninteractive mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/ openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost" +# Install Postgresql driver +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/postgresql-9.4.1212.jar https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar >> /tmp/install-databse-driver.log 2>&1 + CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//") [ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory @@ -71,6 +79,8 @@ cat </etc/nginx/nginx.conf } EOF +if [[ -n "${CERTIFICATE}" ]] || [[ -n "${CERTIFICATE_KEY}" ]]; then + cat </etc/nginx/conf.d/artifactory.conf ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_certificate /etc/pki/tls/certs/cert.pem; @@ -111,7 +121,44 @@ server { } } EOF +else +cat </etc/nginx/conf.d/artifactory.conf +## server configuration +server { + listen 80 ; + server_name ~(?.+)\\.${CERTIFICATE_DOMAIN} artifactory ${ARTIFACTORY_SERVER_NAME}.${CERTIFICATE_DOMAIN}; + if (\$http_x_forwarded_proto = '') { + set \$http_x_forwarded_proto \$scheme; + } + ## Application specific logs + ## access_log /var/log/nginx/artifactory-access.log timing; + ## error_log /var/log/nginx/artifactory-error.log; + rewrite ^/$ /ui/ redirect; + rewrite ^/ui$ /ui/ redirect; + chunked_transfer_encoding on; + client_max_body_size 0; + location / { + proxy_read_timeout 2400; + proxy_pass_header Server; + proxy_cookie_path ~*^/.* /; + proxy_pass http://127.0.0.1:8082; + proxy_next_upstream error timeout non_idempotent; + proxy_next_upstream_tries 1; + proxy_set_header X-JFrog-Override-Base-Url \$http_x_forwarded_proto://\$host:\$server_port; + proxy_set_header X-Forwarded-Port \$server_port; + proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto; + proxy_set_header Host \$http_host; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + + location ~ ^/artifactory/ { + proxy_pass http://127.0.0.1:8081; + } + } +} +EOF + +fi mkdir -p /opt/jfrog/artifactory/var/etc/artifactory/ cat </opt/jfrog/artifactory/var/etc/artifactory/artifactory.cluster.license @@ -145,11 +192,13 @@ sed -i -e "s/#ip:/ip: ${HOSTNAME}/" /var/opt/jfrog/artifactory/etc/system.yaml sed -i -e "s/#primary: true/primary: ${IS_PRIMARY}/" /var/opt/jfrog/artifactory/etc/system.yaml sed -i -e "s/#haEnabled:/haEnabled:/" /var/opt/jfrog/artifactory/etc/system.yaml -# Set MS SQL configuration -cat <>/var/opt/jfrog/artifactory/etc/system.yaml + +if [[ $DB_TYPE =~ "MSSQL" ]]; then + # Set MS SQL configuration + cat <>/var/opt/jfrog/artifactory/etc/system.yaml ## One of: mysql, oracle, mssql, postgresql, mariadb ## Default: Embedded derby - ## Example for mysql + ## Example for mssql type: mssql driver: com.microsoft.sqlserver.jdbc.SQLServerDriver url: ${DB_URL};databaseName=${DB_NAME};sendStringParametersAsUnicode=false;applicationName=Artifactory Binary Repository @@ -157,6 +206,20 @@ cat <>/var/opt/jfrog/artifactory/etc/system.yaml password: ${DB_PASSWORD} EOF +elif [[ $DB_TYPE =~ "Postgresql" ]]; then + # Set Postgresql settings (add if/else for Postgres/MSSQL) ATTENTION - RT VM 7.5.5 doesn't have Postgres driver!! + cat <>/var/opt/jfrog/artifactory/etc/system.yaml + ## One of: mysql, oracle, mssql, postgresql, mariadb + ## Default: Embedded derby + ## Example for postgresql + type: postgresql + driver: org.postgresql.Driver + url: ${DB_URL}/${DB_NAME} + username: ${DB_USER} + password: ${DB_PASSWORD} + +EOF +fi # Create master.key on each node mkdir -p /opt/jfrog/artifactory/var/etc/security/ @@ -179,14 +242,19 @@ cat </var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml EOF - -cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//" > /tmp/temp.pem +if [[ -n "${CERTIFICATE}" ]] || [[ -n "${CERTIFICATE_KEY}" ]]; then +cat </tmp/temp.pem +${CERTIFICATE} +EOF cat /tmp/temp.pem | sed 's/CERTIFICATE----- /&\n/g' | sed 's/ -----END/\n-----END/g' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/certs/cert.pem -rm /tmp/temp.pem + rm /tmp/temp.pem -cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_KEY=//" > /tmp/temp.key +cat </tmp/temp.key +${CERTIFICATE_KEY} +EOF cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key -rm /tmp/temp.key + rm /tmp/temp.key +fi chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/security && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/* diff --git a/AzureResourceManager/scripts/version_selector.sh b/AzureResourceManager/Artifactory/MP_submission/scripts/version_selector.sh similarity index 87% rename from AzureResourceManager/scripts/version_selector.sh rename to AzureResourceManager/Artifactory/MP_submission/scripts/version_selector.sh index 13526b2..aab3104 100644 --- a/AzureResourceManager/scripts/version_selector.sh +++ b/AzureResourceManager/Artifactory/MP_submission/scripts/version_selector.sh @@ -5,9 +5,9 @@ SUPPORTED_VERSIONS=("6.8.0\t6.11.3\t6.15.0\t0.16.0\t0.17.0\t6.18.0") unset IFS if [[ "\t${SUPPORTED_VERSIONS[@]}\t" =~ "\t${ARTIFACTORY_VERSION}\t" ]]; then - sh install_artifactory.sh + ./install_artifactory.sh echo "\ninstall_artifactory.sh was selected" >> user-data.txt else - sh install_artifactory7.sh + ./install_artifactory7.sh echo "\ninstall_artifactory7.sh was selected" >> user-data.txt fi \ No newline at end of file diff --git a/AzureResourceManager/README.md b/AzureResourceManager/Artifactory/README.md similarity index 75% rename from AzureResourceManager/README.md rename to AzureResourceManager/Artifactory/README.md index 8725cd8..48053c8 100644 --- a/AzureResourceManager/README.md +++ b/AzureResourceManager/Artifactory/README.md @@ -1,9 +1,9 @@ # Setup Artifactory Enterprise - - + + - + @@ -20,7 +20,7 @@ This template can help you setup the [Artifactory Enterprise](https://jfrog.com/ ![screenshot](images/Parameters.png) -3. Click on Purchase to start deploying resources. It will deploy MsSQL database, Azure Blob storage container, VM installing Nginx and Artifactory and Load balancer. +3. Click on Review + Create, then on Create to start deploying resources. It will deploy MsSQL or Postgresql database (or it can use existing), Azure Blob storage container, VM installing Nginx and Artifactory and Load balancer. 4. Once deployment is done. Copy FQDN from Output of deployment template. @@ -29,8 +29,8 @@ This template can help you setup the [Artifactory Enterprise](https://jfrog.com/ 6. You will see specified artifactory member nodes in 'Admin -> High Availability' page. ### Note: -1. This template only supports Artifactory version 5.8.x and above. -2. Turn off daily backups. Read Documentation provided [here](https://www.jfrog.com/confluence/display/RTF/Managing+Backups) +1. This template only supports Artifactory version 6.18.x and above. +2. Turn off daily backups. Read Documentation provided [here](https://www.jfrog.com/confluence/display/RTF/Managing+Backups) 3. Use SSL Certificate with valid wild card to you artifactory as docker registry with subdomain method. 4. Input values for 'adminUsername' and 'adminPassword' parameters needs to follow azure VM access rules. 5. One primary node is configured automatically. And, Minimum 1 member node is expected for the Artifactory HA installation. @@ -50,12 +50,11 @@ considering you have SSL certificate for `*.jfrog.team` ### Steps to upgrade Artifactory Version -1. Login into Primary VM instance and sudo as root. Use the admin credentials provided in the install setup. +1. Login into first member VM instance and sudo as root. Use the admin credentials provided in the install setup. Note: Use load balancer's NAT entries under Azure resources, to get the allocated NAT port for accessing the VM instance. 2. Stop nginx and artifactory services. ``` - service nginx stop service artifactory stop ``` @@ -67,9 +66,9 @@ Note: Use load balancer's NAT entries under Azure resources, to get the allocate 4. Start artifactory and nginx services. ``` service artifactory start - service nginx start ``` -5. Repeat above steps for all member nodes. +5. Repeat above steps for all member nodes then for primary node. +6. To check the version of each node, open Administration -> Monitoring -> Service status ------ #### Note: diff --git a/AzureResourceManager/azuredeploy.json b/AzureResourceManager/Artifactory/azuredeploy_ms_ps.json similarity index 74% rename from AzureResourceManager/azuredeploy.json rename to AzureResourceManager/Artifactory/azuredeploy_ms_ps.json index e2bdccf..7ae66b3 100644 --- a/AzureResourceManager/azuredeploy.json +++ b/AzureResourceManager/Artifactory/azuredeploy_ms_ps.json @@ -16,6 +16,51 @@ "description": "String used as a base for naming resources. Must be 3-61 characters in length and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended." } }, + "db_type": { + "type": "string", + "defaultValue": "Postgresql_deploy.json", + "allowedValues": [ + "Postgresql_deploy.json", + "MSSQL_deploy.json", + "Postgresql_existing.json", + "MSSQL_existing.json" + ], + "metadata": { + "description": "Deploy new Postgresql, MSSQL or use existing DB" + } + }, + "manual_db_url": { + "type": "string", + "metadata": { + "description": "DB server URL, if existing DB server is used instead of a new deployment (jdbc:sqlserver://.. or jdbc:postgresql://..)" + } + }, + "db_server": { + "type": "string", + "metadata": { + "description": "DB server name, if pre-existing DB is used" + } + }, + "db_name": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "MSSQL Database name" + } + }, + "db_edition": { + "type": "string", + "minLength": 1, + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ], + "metadata": { + "description": "MSSQL Database Edition" + } + }, "location": { "type": "string", "defaultValue": "[resourceGroup().location]", @@ -34,7 +79,7 @@ }, "artifactoryVersion": { "type": "string", - "defaultValue": "7.4.30", + "defaultValue": "0.0.2", "allowedValues": [ "6.6.0", "6.6.1", @@ -50,21 +95,24 @@ "7.2.1", "7.4.3", "7.4.30", - "7.4.31" + "7.4.31", + "7.5.7", + "0.0.1", + "0.0.2" ], "metadata": { "description": "Artifactory-vm image version to deploy." } }, "masterKey": { - "type": "string", + "type": "securestring", "maxLength": 64, "metadata": { "description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'" } }, "joinKey": { - "type": "string", + "type": "securestring", "maxLength": 64, "metadata": { "description": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'" @@ -117,15 +165,13 @@ } }, "certificate": { - "type": "string", - "defaultValue": "-----BEGIN CERTIFICATE----- MIIFhzCCA2+gAwIBAgIJALC4r5BQWZE4MA0GCSqGSIb3DQEBCwUAMFoxCzAJBgNV BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQHDApTYW50YUNsYXJh MQswCQYDVQQKDAJJVDEUMBIGA1UEAwwLKi5sb2NhbGhvc3QwHhcNMTgwMTE3MTk0 NjI4WhcNMTkwMTA4MTk0NjI4WjBaMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2Fs aWZvcm5pYTETMBEGA1UEBwwKU2FudGFDbGFyYTELMAkGA1UECgwCSVQxFDASBgNV BAMMCyoubG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA 7KfOWDQlov8cMa8r/lcJqiWZaH9myQC74Vbe0HXsntQbcvljkjG2P7ebm5dd9Bzc sauNOJpbKf5AhFK1iwJUAkciGc1LR4k8wfWmQM3NPS8hrqrtH20zqNpdFRpNYjja JofwccPNm030GhhZkZ95TpruvmswMDwspl3jfqdcc/eiQsHcKyGnV2a+UAeoqe7J mHhmhRy1MLqAjF5U1GrUYUONA+22iRDJb4c9B91QoWvsnXpdA9NKV/mmA3/rIdx6 Ld2IPRdrIw2K5sAnXsh3bx2oCSvSfussf0x+4XDrnsaHVfjwvfNL8ECOuac2Oi/E WOp9528gOohpFAuwEt63Vl5p8/CC9m0HJDTZBKm2l5eD1kdPIj4PvP9Sn9CxGXKQ E1bxWoFxGX8EyRW0b0NK31N7b8JPZ1SoFNiB5amOMNLvR26a7cQrKumTuJeYK9Ja JaxhMXM7R0DA0Ev8ZG2xmyCygox+1KPSmJOIEpT70BFbj3rKLNqP22ET+zvPuh+2 DdgyrpHFeYkGWjMbWPjK7wJsD2zM8ccoJQfepPz8I4rT0JfrKAQgCGuGOggneaNJ KTVGNOFbj5AXdZ/Q+GvNommyRdq4J7EnqY6L+P25fo5qZ6UZ/iS0tPcvxgn0Fdhs pUPbQyQIDZyxZd3Q1lUIE38ol8P66mS2zbzf8EeOCoUCAwEAAaNQME4wHQYDVR0O BBYEFETAQM/5P7XJ8kevHFj6BPndQOFaMB8GA1UdIwQYMBaAFETAQM/5P7XJ8kev HFj6BPndQOFaMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAJ1TepKv LWYhFmVQcgZwZf/qt1a1cohzJSm6da9RCnnAWC7WC/U117bgSomtrH1v0OysHFhB zBBUeBqI7+OmzAX8dhj+roKkcnFUM/IwlK1eueIIA//CWvEf/o0XExilVS2yCc9d PTpOQBXwk9QinxK36kHdBiGxa7dW0JPnOEEmuMgGORKeLy4J6Ik8iSeFY1SZVcOI +6WWvoKciPlmIeccC+6YVmkeBwhP2o5r5w/UAaO2hSnGvmm4UIj/VJv4VQu7xTUp cIfFz5NtIr80DbqcyPiEMS2ETJ4L/kO4MS5FfeEXyQuXCzmiIDVY6tE3C7+kZmK4 JzPLuWm9ndQoyQySOGfQqvlUR1+YxUdvmu3LrOS5dOA354Q36wHa4wEGUoHU/7GV fYQmmmDSDaNSpXW5PFey6scFyDBS/yYJ0H9EjYb/11HeWYj8Yv5xTWj8nhzJONC8 D6Y5ydlU4PifM2pOf88pTYpmogNwLJWXbql5I9cvMa8APo4yLVqcISU5ynsvFke+ Non+T0mHpJai/hrA9NK+s6EGC1dAX58jy61h6FhOPI1d4s/mov/KMa2t3SfZp5SF 81aR6dHvO56teiK5M1xMkrqG75zh3TMFJJLRFe9XxeB4JeN76URB3mgADOUqkBxd ibSgVqfKwOw4IujEcqMUc5mqSnbLY1Dv+oby -----END CERTIFICATE-----", + "type": "securestring", "metadata": { "description": "To use Artifactory as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate." } }, "certificateKey": { - "type": "string", - "defaultValue": "-----BEGIN PRIVATE KEY----- MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDsp85YNCWi/xwx ryv+VwmqJZlof2bJALvhVt7Qdeye1Bty+WOSMbY/t5ubl130HNyxq404mlsp/kCE UrWLAlQCRyIZzUtHiTzB9aZAzc09LyGuqu0fbTOo2l0VGk1iONomh/Bxw82bTfQa GFmRn3lOmu6+azAwPCymXeN+p1xz96JCwdwrIadXZr5QB6ip7smYeGaFHLUwuoCM XlTUatRhQ40D7baJEMlvhz0H3VCha+ydel0D00pX+aYDf+sh3Hot3Yg9F2sjDYrm wCdeyHdvHagJK9J+6yx/TH7hcOuexodV+PC980vwQI65pzY6L8RY6n3nbyA6iGkU C7AS3rdWXmnz8IL2bQckNNkEqbaXl4PWR08iPg+8/1Kf0LEZcpATVvFagXEZfwTJ FbRvQ0rfU3tvwk9nVKgU2IHlqY4w0u9HbprtxCsq6ZO4l5gr0lolrGExcztHQMDQ S/xkbbGbILKCjH7Uo9KYk4gSlPvQEVuPesos2o/bYRP7O8+6H7YN2DKukcV5iQZa MxtY+MrvAmwPbMzxxyglB96k/PwjitPQl+soBCAIa4Y6CCd5o0kpNUY04VuPkBd1 n9D4a82iabJF2rgnsSepjov4/bl+jmpnpRn+JLS09y/GCfQV2GylQ9tDJAgNnLFl 3dDWVQgTfyiXw/rqZLbNvN/wR44KhQIDAQABAoICAQDm1pAp7UPBCELCG/I3t0KQ GvjWu17RNcwN86SHhl92VcMolSaQ1bjF0h0Q2ccldHm5PHMWAUpnXcAk0mCO5Yh4 aFZVALEraCxBrZGrqJNH2Q9rxwJhIy2+yLD/Apb09iukZfkdnzaRBKrUQWgs6Xd0 OyAh0YBBrJCI/xAG3M0LuUMnBt3xnHQUhv2gJrhYeble5iJqOSRsEZ+OS/1G7aWX 8kI80MS6UguKpEndv/0EV7eHrHHKZ3Ee+z76Lu52Kw9qaaqYnJ0+pdkVV92PUM9f LXhY6cv7TP4sdbtVv8W1LEWakKaTQhySjwYpBXeZrjpB2QlSlEzFi4WjrfrjjSca UZazm/jY5uDI2cXf35NyZUkbYxIKlGtURtDpoPp5R7XguHSoqLrh2Zsc79mZfNST zFwbhNBVB2nAl6ZyIRNFLjVhQScvlImpIVSVZm5/NiiABIEaxRh8w8C5qRMctSTy KF6rS6as2KsPQHpiu/6nDMqqTZ8UMQ3yXEpai5VwAzKFP67usHheKf4RIXNUn7Xc JxWiI8KfOV5n4cSJK1/R+i+ZpWyQiloao4v7GS/fwZTsILeBLBa0utDmNs5aJgVK cEagRjVGAeAEc2W+jXmSqtZRHQowJmEKOARMn4lI+duziSCjIfPH6xIDAUhVlc/K u03432NupfPepW6BYVBgQQKCAQEA/+CD2uiRZgmzuEn/vn/u7jGFjETdUQmfl5kX pMTtueXyQxHBRwBCZqq885doozeQd7mLRcW+klngq1NmnEnjx+NfUzFJLpEmQO1/ AMHUpYpZY4jOyntx9cBy+M+DUfNtdsJUz+VOe3HO5/lJJf+gSgpVp2ku1oOrgEeH a71aGIXOsiOQ/fHL4Q0CuylersD5Dq4Tdf/u6rr4NbwOZQCQ9WH0uTckA9SkjJFu iHXblg8j9RUNbj89WPrEulKA98duFuLvGTeohcAPQ8f60Z7sxDLGLRyRvhUO4EBr hTTmcfI2LsPWSo+X+n6eBqfUfGZub2qN+d2B08qKgnGdgFEf6QKCAQEA7MTtAphl lswq4kPvDkPHMqJhmPBgb5NAUzE2Z8yjJY3IX6zxinSDnuMwEzCinKe7rzv6aYIh klviND/oyLOxVlLESZu62epokgIey05sv9a/030z7q5hradNzcMP1VfGVs6IeOvr 3Kit4T7LI1L2eXwD1Yks6uHHw8lHAlyrrlbwCEmzqElKs0YtkvNa4HFgesFNnObe f8C29LOPZMqje7iAT91823MGI9NML9qGYON/ZLc4uCB9no+o6ZOTQHqX1xxSWv5D 66KGiRnUC/RAq6RbTVn3NxFgvb3k0rejbQbxW5KCri1E4sTw+pZ5bIRUJcXi+J+Z Tg88lVbmqXfwPQKCAQEA94yShDr0UC+au/R7hCXpVnB6r5YAN+KDj/sAsNwE0hDx LIoE31gU5ZbRbylQhne/QNU1NK93C8gAYEAzyYiC4mPLWYUZNAAhbjdW47iirfUH PhChX6vGOOeTU7wPZD2J7ZdczjUelLcqYar/Zc/Fl1wgOfK86bRBO733+fgbLhZm PlnCcKx5fqVDuybu/0qaqeUn1sVgs59nezURCA5gL8YxKO973GjhOU2KDmNXqfnD 49wWPk7YXzldEpW3SACdNW8futnqJFwHaKAUvLBwh/BHYmV9atScq8AnRZxERoD6 govcyg3aDvJomC/OlvvSY+BGszHl5KzTDBg3NGlH4QKCAQA/71lU5xQfqVg3K0MF ZhYHPUP/iYFw/6FSFarsUp0Higa+lzPOQHI+WHjl5a8zgDO1OQwAq6wnGnq1w0A3 2hYcClOI0O2e5KaCLuJj4fSJxRKdqGR6okosG05uLqs63+3mCPVfOc3CEyaI+Wzf SArYeT2LzvP7JSbNXq+3GpEdjcpZYpWJ7uimCmBKGz7B9runykUMBme0tbRx1X72 J6YHxaWYa2XI2IGi8O7UyTyaMzR2XOeLCPMC+yYQlNIhijkwVCyE974dhhCwOvJA nB9Oeh5Rf+a6zw2BjyKYKBCQY1yPbrutDvpYBfhQoot9Wyph3NLScj5yjri8VvAI eSO9AoIBAQDyUx5YUgHgpoJtRZ+8PGQBZHm5L5HJhvfUs96I9Z4lZSXnCmEJyOWn LIob8c0n4hU1EXdbbl+7eRQgG3oGKyF0XXhuaP3vHprIBW6tm9kCGORTliZOaZdW 0Mj9GUv2de1r8anwJMFvIMXsuO08rsGzsIt7DrNYa0YSMkeDwPenRfDHXOYH2fjf RKjlP3fQr/iLL/YuMGaNxzIeyWPZ2WTUUC0bllNxMTZmztuMkPNb7fhhs0hLecXM fE2nbwUaGwMZaails1+5G3HvEAlChJ1GN9XnYxrtfqq93tYELWBiNcv1LaMAFvj8 S+j1+iUKGGhwVmhqh75q5do3+VF3XlAh -----END PRIVATE KEY-----", + "type": "securestring", "metadata": { "description": "Provide your SSL Certificate key" } @@ -154,38 +200,30 @@ "description": "Setting Java Memory Parameters for Artifactory. Learn about system requirements for Artifactory https://www.jfrog.com/confluence/display/RTF/System+Requirements#SystemRequirements-RecommendedHardware." } }, - "DB_Admin_User": { + "db_user": { "type": "string", "minLength": 1, "metadata": { "description": "Database Admin user name" } }, - "DB_Admin_Password": { + "db_password": { "type": "securestring", "minLength": 1, "metadata": { "description": "Database Admin password" } }, - "DB_Name": { - "type": "string", - "minLength": 1, - "metadata": { - "description": "Database name" - } - }, - "DB_Edition": { - "type": "string", - "minLength": 1, - "defaultValue": "Basic", - "allowedValues": [ - "Basic", - "Standard", - "Premium" - ], - "metadata": { - "description": "Database Edition" + "databases": { + "type": "object", + "defaultValue": { + "properties": [ + { + "name": "artdb", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] } }, "storageAccountType": { @@ -205,7 +243,7 @@ "metadata": { "description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated." }, - "defaultValue": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/master/AzureResourceManager/" + "defaultValue": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/master/AzureResourceManager/Artifactory/" }, "_artifactsLocationSasToken": { "type": "securestring", @@ -249,12 +287,14 @@ "httpsProbeMemberName": "memberHttpsProbe", "storageAccountName": "[concat(variables('namingInfix'), 'storage')]", "vmStorageAccountContainerName": "filestore", - "azureSqlServerName": "[concat(variables('namingInfix'), 'sqlsrv')]", - "DB_Name": "[parameters('DB_Name')]", - "DB_Admin_User": "[parameters('DB_Admin_User')]", - "DB_Admin_Password": "[parameters('DB_Admin_Password')]", - "DB_Edition": "[parameters('DB_Edition')]", - "DB_Location": "[parameters('location')]", + "azureSqlServerName": "[if(or(equals(parameters('db_type'), 'MSSQL_existing.json'),equals(parameters('db_type'),'Postgresql_existing.json')), parameters('db_server'), concat(variables('namingInfix'), 'sqlsrv'))]", + "artDBname": "[parameters('databases').properties[0].name]", + "postgres_db_user": "[concat(parameters('db_user'), '@', variables('azureSqlServerName'))]", + "db_user": "[if(or(equals(parameters('db_type'), 'Postgresql_deploy.json'),equals(parameters('db_type'),'Postgresql_existing.json')), variables('postgres_db_user'), parameters('db_user'))]", + "db_password": "[parameters('db_password')]", + "db_location": "[parameters('location')]", + "db_name": "[parameters('db_name')]", + "db_edition": "[parameters('db_edition')]", "masterKey": "[parameters('masterKey')]", "joinKey": "[parameters('joinKey')]", "certificate": "[parameters('certificate')]", @@ -270,11 +310,11 @@ "osType": { "publisher": "jfrog", "offer": "artifactory-vm", - "sku": "artifactory-vm-private", + "sku": "artifactory-vm", "version": "[parameters('artifactoryVersion')]" }, "imageReference": "[variables('osType')]", - "dbTemplate": "azureDBDeploy.json", + "dbTemplate": "[parameters('db_type')]", "dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]", "nsgName": "[concat(variables('namingInfix'), 'nsg')]" }, @@ -296,7 +336,7 @@ "type": "Microsoft.Network/networkSecurityGroups", "location": "[parameters('location')]", "name": "[variables('nsgName')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "properties": { "securityRules": [ { @@ -376,9 +416,9 @@ "type": "Microsoft.Network/virtualNetworks", "name": "[variables('virtualNetworkName')]", "location": "[parameters('location')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "dependsOn": [ - "[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" + "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" ], "properties": { "addressSpace": { @@ -409,14 +449,14 @@ } }, { - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "type": "Microsoft.Network/networkInterfaces", "name": "[variables('nicPrimaryName')]", "location": "[parameters('location')]", "dependsOn": [ - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" ], "properties": { "ipConfigurations": [ @@ -436,14 +476,14 @@ } }, { - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "type": "Microsoft.Network/networkInterfaces", "name": "[variables('nicMemberName')]", "location": "[parameters('location')]", "dependsOn": [ - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" ], "properties": { "ipConfigurations": [ @@ -469,7 +509,7 @@ "sku": { "name": "Standard" }, - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "properties": { "publicIPAllocationMethod": "Static", "dnsSettings": { @@ -484,7 +524,7 @@ "sku": { "name": "Standard" }, - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "properties": { "publicIPAllocationMethod": "Static", "dnsSettings": { @@ -496,13 +536,13 @@ "type": "Microsoft.Network/loadBalancers", "name": "[variables('lbName')]", "location": "[parameters('location')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "sku": { "name": "Standard" }, "dependsOn": [ - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]" + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipMemberName'))]" ], "tags":{ "displayName": "Load Balancer" @@ -685,7 +725,7 @@ } }, { - "apiVersion": "2018-07-01", + "apiVersion": "2019-06-01", "type": "Microsoft.Storage/storageAccounts", "name": "[variables('storageAccountName')]", "location": "[parameters('location')]", @@ -701,7 +741,7 @@ { "type": "Microsoft.Resources/deployments", "name": "deploySQLDB", - "apiVersion": "2018-07-01", + "apiVersion": "2019-09-01", "properties": { "mode": "Incremental", "templateLink": { @@ -710,22 +750,28 @@ }, "parameters": { "db_user": { - "value": "[parameters('DB_Admin_User')]" + "value": "[parameters('db_user')]" }, "db_password": { - "value": "[parameters('DB_Admin_Password')]" + "value": "[variables('db_password')]" }, "db_server": { "value": "[variables('azureSqlServerName')]" }, + "db_location": { + "value": "[variables('db_location')]" + }, + "databases": { + "value": "[parameters('databases')]" + }, "db_name": { - "value": "[parameters('DB_Name')]" + "value": "[variables('db_name')]" }, "db_edition": { - "value": "[parameters('DB_Edition')]" + "value": "[variables('db_edition')]" }, - "db_location": { - "value": "[variables('DB_Location')]" + "manual_db_url": { + "value": "[parameters('manual_db_url')]" } } } @@ -736,13 +782,13 @@ "location": "[parameters('location')]", "apiVersion": "2018-10-01", "dependsOn": [ - "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]", - "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" + "[resourceId('Microsoft.Network/loadBalancers/', variables('lbName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Resources/deployments/', 'deploySQLDB')]", + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" ], "plan": { - "name": "artifactory-vm-private", + "name": "artifactory-vm", "publisher": "jfrog", "product": "artifactory-vm" }, @@ -770,7 +816,7 @@ "computerNamePrefix": "[variables('namingInfix')]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]", - "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',parameters('certificateKey'),'\nCERTIFICATE=', parameters('certificate'),'\nCERTIFICATE_DOMAIN=',parameters('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',parameters('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',parameters('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\nIS_PRIMARY=','true','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]" + "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',variables('certificateKey'),'\nCERTIFICATE=', variables('certificate'),'\nCERTIFICATE_DOMAIN=',variables('certificateDomain'),'\nDB_TYPE=',parameters('db_type'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('artDBname'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\nIS_PRIMARY=','true','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]" }, "networkProfile": { "networkInterfaceConfigurations": [ @@ -834,14 +880,14 @@ "location": "[parameters('location')]", "apiVersion": "2018-10-01", "dependsOn": [ - "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[concat('Microsoft.Compute/virtualMachineScaleSets/', variables('scaleSetPrimaryName'))]", - "[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]", - "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" + "[resourceId('Microsoft.Network/loadBalancers/', variables('lbName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Compute/virtualMachineScaleSets/', variables('scaleSetPrimaryName'))]", + "[resourceId('Microsoft.Resources/deployments/', 'deploySQLDB')]", + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" ], "plan": { - "name": "artifactory-vm-private", + "name": "artifactory-vm", "publisher": "jfrog", "product": "artifactory-vm" }, @@ -869,7 +915,7 @@ "computerNamePrefix": "[variables('namingInfix')]", "adminUsername": "[parameters('adminUsername')]", "adminPassword": "[parameters('adminPassword')]", - "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',parameters('certificateKey'),'\nCERTIFICATE=', parameters('certificate'),'\nCERTIFICATE_DOMAIN=',parameters('certificateDomain'),'\nARTIFACTORY_SERVER_NAME=',parameters('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',parameters('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('DB_Name'),'\nDB_ADMIN_USER=',variables('DB_Admin_User'),'\nDB_ADMIN_PASSWD=',variables('DB_Admin_Password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\nIS_PRIMARY=','false','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]" + "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nARTIFACTORY_VERSION=', parameters('artifactoryVersion'),'\nCERTIFICATE_KEY=',variables('certificateKey'),'\nCERTIFICATE=', variables('certificate'),'\nCERTIFICATE_DOMAIN=',variables('certificateDomain'),'\nDB_TYPE=',parameters('db_type'),'\nARTIFACTORY_SERVER_NAME=',variables('artifactoryServerName'),'\nEXTRA_JAVA_OPTS=',variables('extraJavaOptions'),'\nJDBC_STR=',reference('Microsoft.Resources/deployments/deploySQLDB').outputs.jdbcConnString.value,'\nDB_NAME=',variables('artDBname'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nSTO_ACT_NAME=',variables('storageAccountName'),'\nSTO_ACT_ENDPOINT=',reference(resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))).primaryEndpoints.blob,'\nSTO_CTR_NAME=',variables('vmStorageAccountContainerName'),'\nSTO_ACT_KEY=',listKeys(resourceId('Microsoft.Storage/storageAccounts', variables('storageAccountName')), '2018-07-01').keys[0].value,'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\nIS_PRIMARY=','false','\nLICENSE1=',variables('artifactoryLicense1'),'\nLICENSE2=',variables('artifactoryLicense2'),'\nLICENSE3=',variables('artifactoryLicense3'),'\nLICENSE4=',variables('artifactoryLicense4'),'\nLICENSE5=',variables('artifactoryLicense5'),'\n'))]" }, "networkProfile": { "networkInterfaceConfigurations": [ diff --git a/AzureResourceManager/Artifactory/azuredeploy_ms_ps.parameters.json b/AzureResourceManager/Artifactory/azuredeploy_ms_ps.parameters.json new file mode 100644 index 0000000..8e4317e --- /dev/null +++ b/AzureResourceManager/Artifactory/azuredeploy_ms_ps.parameters.json @@ -0,0 +1,68 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "clusterName": { + "value": "rtha" + }, + "adminUsername": { + "value": "vmuser" + }, + "adminPassword": { + "value": "password" + }, + "db_type": { + "value": "Postgresql_deploy.json" + }, + "db_user": { + "value": "artifactory" + }, + "db_password": { + "value": "password" + }, + "db_name": { + "value": "artdb" + }, + "db_edition": { + "value": "Basic" + }, + "databases": { + "value": { + "properties": [ + { + "name": "artdb", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } + }, + "manual_db_url": { + "value": "jdbc:postgresql://postgressrvr.postgres.database.azure.com:5432" + }, + "db_server": { + "value": "postgressrvr" + }, + "masterKey": { + "value": "GENERATE_MASTER_KEY" + }, + "joinKey": { + "value": "GENERATE_JOIN_KEY" + }, + "certificate": { + "value": "-----BEGIN CERTIFICATE----- -----END CERTIFICATE-----" + }, + "certificateKey": { + "value": "-----BEGIN PRIVATE KEY----- -----END PRIVATE KEY-----" + }, + "artifactoryLicense1": { + "value": "" + }, + "artifactoryLicense2": { + "value": "" + }, + "artifactoryLicense3": { + "value": "" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/images/HA_Diagram.png b/AzureResourceManager/Artifactory/images/HA_Diagram.png similarity index 100% rename from AzureResourceManager/images/HA_Diagram.png rename to AzureResourceManager/Artifactory/images/HA_Diagram.png diff --git a/AzureResourceManager/images/Parameters.png b/AzureResourceManager/Artifactory/images/Parameters.png similarity index 100% rename from AzureResourceManager/images/Parameters.png rename to AzureResourceManager/Artifactory/images/Parameters.png diff --git a/AzureResourceManager/images/add_licenses.png b/AzureResourceManager/Artifactory/images/add_licenses.png similarity index 100% rename from AzureResourceManager/images/add_licenses.png rename to AzureResourceManager/Artifactory/images/add_licenses.png diff --git a/AzureResourceManager/nested/azureDBDeploy.json b/AzureResourceManager/Artifactory/nested/MSSQL_deploy.json similarity index 59% rename from AzureResourceManager/nested/azureDBDeploy.json rename to AzureResourceManager/Artifactory/nested/MSSQL_deploy.json index e107ea0..2a96758 100644 --- a/AzureResourceManager/nested/azureDBDeploy.json +++ b/AzureResourceManager/Artifactory/nested/MSSQL_deploy.json @@ -1,54 +1,54 @@ { - "$schema": "http://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", "contentVersion": "1.0.0.0", "parameters": { "db_user": { "type": "string", - "minLength": 1, - "defaultValue": "artifactory" + "defaultValue": "artifactory", + "minLength": 1 }, "db_password": { - "type": "securestring", - "defaultValue": "jFrog123" + "type": "securestring" }, "db_server": { "type": "string", - "minLength": 1, - "defaultValue": "artmssqlsrv" + "defaultValue": "artmssqlsrv", + "minLength": 1 }, "db_name": { "type": "string", - "minLength": 1, - "defaultValue": "artdb" + "defaultValue": "artdb", + "minLength": 1 }, "db_location": { - "type": "string", - "defaultValue": "" + "type": "string" }, "db_edition": { "type": "string", + "defaultValue": "Basic", "allowedValues": [ "Basic", "Standard", "Premium" ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" } }, "variables": { - "apiVersion": "2015-05-01-preview", - "rtdbCollation": "Latin1_General_100_CS_AS", - "db_location": "[if(equals(parameters('db_location'), ''), resourceGroup().location, parameters('db_location'))]" + "rtdbCollation": "Latin1_General_100_CS_AS" }, "resources": [ { "name": "[parameters('db_server')]", "type": "Microsoft.Sql/servers", "kind": "v12.0", - "location": "[variables('db_location')]", - "apiVersion": "[variables('apiVersion')]", - "dependsOn": [ - - ], + "location": "[parameters('db_location')]", + "apiVersion": "2020-02-02-preview", "tags": { "displayName": "artifactoryDB" }, @@ -61,10 +61,10 @@ { "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", "type": "firewallrules", - "location": "[variables('db_location')]", - "apiVersion": "[variables('apiVersion')]", + "location": "[parameters('db_location')]", + "apiVersion": "2020-02-02-preview", "dependsOn": [ - "[concat('Microsoft.Sql/servers/', parameters('db_server'))]" + "[resourceId('Microsoft.Sql/servers/', parameters('db_server'))]" ], "properties": { "startIpAddress": "0.0.0.0", @@ -75,8 +75,8 @@ "name": "[parameters('db_name')]", "type": "databases", "kind": "v12.0,user", - "location": "[variables('db_location')]", - "apiVersion": "[variables('apiVersion')]", + "location": "[parameters('db_location')]", + "apiVersion": "2020-02-02-preview", "dependsOn": [ "[parameters('db_server')]" ], @@ -95,7 +95,15 @@ "outputs": { "jdbcConnString": { "type": "string", - "value": "[concat('jdbc:sqlserver://', reference(concat('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]" + "value": "[concat('jdbc:sqlserver://', reference(resourceId('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" } } } diff --git a/AzureResourceManager/Artifactory/nested/MSSQL_existing.json b/AzureResourceManager/Artifactory/nested/MSSQL_existing.json new file mode 100644 index 0000000..4d7aa07 --- /dev/null +++ b/AzureResourceManager/Artifactory/nested/MSSQL_existing.json @@ -0,0 +1,76 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "artifactory", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "mssqlsrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/nested/Postgresql_deploy.json b/AzureResourceManager/Artifactory/nested/Postgresql_deploy.json new file mode 100644 index 0000000..464ebd5 --- /dev/null +++ b/AzureResourceManager/Artifactory/nested/Postgresql_deploy.json @@ -0,0 +1,178 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "xray", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artrtdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "skuCapacity": { + "type": "int", + "defaultValue": 2 + }, + "skuFamily": { + "type": "string", + "defaultValue": "Gen5" + }, + "skuName": { + "type": "string", + "defaultValue": "GP_Gen5_2" + }, + "skuSizeMB": { + "type": "int", + "defaultValue": 5120 + }, + "skuTier": { + "type": "string", + "defaultValue": "GeneralPurpose" + }, + "version": { + "type": "string", + "defaultValue": "9.6" + }, + "backupRetentionDays": { + "type": "int", + "defaultValue": 7 + }, + "geoRedundantBackup": { + "type": "string", + "defaultValue": "Disabled" + }, + "databases": { + "type": "object" + }, + "sslEnforcement": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Disabled", + "metadata": { + "description": "SSL Enforcement" + } + }, + "publicNetworkAccess": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Enabled", + "metadata": { + "description": "Public Network Access" + } + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + { + "type": "Microsoft.DBforPostgreSQL/servers", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "name": "[parameters('db_server')]", + "properties": { + "version": "[parameters('version')]", + "administratorLogin": "[parameters('db_user')]", + "administratorLoginPassword": "[parameters('db_password')]", + "publicNetworkAccess": "[parameters('publicNetworkAccess')]", + "sslEnforcement": "[parameters('sslEnforcement')]", + "storageProfile": { + "storageMB": "[parameters('skuSizeMB')]", + "backupRetentionDays": "[parameters('backupRetentionDays')]", + "geoRedundantBackup": "[parameters('geoRedundantBackup')]" + } + }, + "sku": { + "name": "[parameters('skuName')]", + "tier": "[parameters('skuTier')]", + "capacity": "[parameters('skuCapacity')]", + "size": "[parameters('skuSizeMB')]", + "family": "[parameters('skuFamily')]" + }, + "resources": [ + { + "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", + "type": "firewallRules", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[0].name)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[0].charset]", + "collation": "[parameters('databases').properties[0].collation]" + } + } + ] + } + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[concat('jdbc:postgresql://', reference(resourceId('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + }, + "dbServerName": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "xrayConnString": { + "type": "string", + "value": "[concat('postgres://', reference(resourceId('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "dbUrl": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/nested/Postgresql_existing.json b/AzureResourceManager/Artifactory/nested/Postgresql_existing.json new file mode 100644 index 0000000..e8757f3 --- /dev/null +++ b/AzureResourceManager/Artifactory/nested/Postgresql_existing.json @@ -0,0 +1,76 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "artifactory", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "artdb", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_name": { + "type": "string", + "value": "[parameters('db_name')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/scripts/install_artifactory.sh b/AzureResourceManager/Artifactory/scripts/install_artifactory.sh similarity index 100% rename from AzureResourceManager/scripts/install_artifactory.sh rename to AzureResourceManager/Artifactory/scripts/install_artifactory.sh diff --git a/AzureResourceManager/MP_submission_7/scripts/install_artifactory7.sh b/AzureResourceManager/Artifactory/scripts/install_artifactory7.sh similarity index 73% rename from AzureResourceManager/MP_submission_7/scripts/install_artifactory7.sh rename to AzureResourceManager/Artifactory/scripts/install_artifactory7.sh index 438ea1f..75bf714 100644 --- a/AzureResourceManager/MP_submission_7/scripts/install_artifactory7.sh +++ b/AzureResourceManager/Artifactory/scripts/install_artifactory7.sh @@ -1,27 +1,33 @@ #!/bin/bash + +# Script stdout and stderr are stored in /var/lib/waagent/custom-script/download on the VM DB_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JDBC_STR" | sed "s/JDBC_STR=//") DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//") DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//") +DB_TYPE=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_TYPE=" | sed "s/DB_TYPE=//") DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//") STORAGE_ACCT=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_NAME=" | sed "s/STO_ACT_NAME=//") STORAGE_CONTAINER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_CTR_NAME=" | sed "s/STO_CTR_NAME=//") STORAGE_ACCT_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^STO_ACT_KEY=" | sed "s/STO_ACT_KEY=//") ARTIFACTORY_VERSION=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_VERSION=" | sed "s/ARTIFACTORY_VERSION=//") +CERTIFICATE=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//") +CERTIFICATE_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_KEY=//") MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//") -JOIN_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JOIN_KEY=" | sed "s/JOIN_KEY=//") IS_PRIMARY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^IS_PRIMARY=" | sed "s/IS_PRIMARY=//") ARTIFACTORY_LICENSE_1=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE1=" | sed "s/LICENSE1=//") ARTIFACTORY_LICENSE_2=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE2=" | sed "s/LICENSE2=//") ARTIFACTORY_LICENSE_3=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE3=" | sed "s/LICENSE3=//") ARTIFACTORY_LICENSE_4=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE4=" | sed "s/LICENSE4=//") ARTIFACTORY_LICENSE_5=$(cat /var/lib/cloud/instance/user-data.txt | grep "^LICENSE5=" | sed "s/LICENSE5=//") -#JOIN_KEY_GENERATED=$(openssl rand -hex 16) export DEBIAN_FRONTEND=noninteractive #Generate Self-Signed Cert mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/ openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost" +# Install Postgresql driver +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/postgresql-9.4.1212.jar https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar >> /tmp/install-databse-driver.log 2>&1 + CERTIFICATE_DOMAIN=$(cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_DOMAIN=" | sed "s/CERTIFICATE_DOMAIN=//") [ -z "$CERTIFICATE_DOMAIN" ] && CERTIFICATE_DOMAIN=artifactory @@ -73,6 +79,8 @@ cat </etc/nginx/nginx.conf } EOF +if [[ -n "${CERTIFICATE}" ]] || [[ -n "${CERTIFICATE_KEY}" ]]; then + cat </etc/nginx/conf.d/artifactory.conf ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_certificate /etc/pki/tls/certs/cert.pem; @@ -113,7 +121,44 @@ server { } } EOF +else +cat </etc/nginx/conf.d/artifactory.conf +## server configuration +server { + listen 80 ; + server_name ~(?.+)\\.${CERTIFICATE_DOMAIN} artifactory ${ARTIFACTORY_SERVER_NAME}.${CERTIFICATE_DOMAIN}; + if (\$http_x_forwarded_proto = '') { + set \$http_x_forwarded_proto \$scheme; + } + ## Application specific logs + ## access_log /var/log/nginx/artifactory-access.log timing; + ## error_log /var/log/nginx/artifactory-error.log; + rewrite ^/$ /ui/ redirect; + rewrite ^/ui$ /ui/ redirect; + chunked_transfer_encoding on; + client_max_body_size 0; + location / { + proxy_read_timeout 2400; + proxy_pass_header Server; + proxy_cookie_path ~*^/.* /; + proxy_pass http://127.0.0.1:8082; + proxy_next_upstream error timeout non_idempotent; + proxy_next_upstream_tries 1; + proxy_set_header X-JFrog-Override-Base-Url \$http_x_forwarded_proto://\$host:\$server_port; + proxy_set_header X-Forwarded-Port \$server_port; + proxy_set_header X-Forwarded-Proto \$http_x_forwarded_proto; + proxy_set_header Host \$http_host; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + + location ~ ^/artifactory/ { + proxy_pass http://127.0.0.1:8081; + } + } +} +EOF + +fi mkdir -p /opt/jfrog/artifactory/var/etc/artifactory/ cat </opt/jfrog/artifactory/var/etc/artifactory/artifactory.cluster.license @@ -147,11 +192,13 @@ sed -i -e "s/#ip:/ip: ${HOSTNAME}/" /var/opt/jfrog/artifactory/etc/system.yaml sed -i -e "s/#primary: true/primary: ${IS_PRIMARY}/" /var/opt/jfrog/artifactory/etc/system.yaml sed -i -e "s/#haEnabled:/haEnabled:/" /var/opt/jfrog/artifactory/etc/system.yaml -# Set MS SQL configuration -cat <>/var/opt/jfrog/artifactory/etc/system.yaml + +if [[ $DB_TYPE =~ "MSSQL" ]]; then + # Set MS SQL configuration + cat <>/var/opt/jfrog/artifactory/etc/system.yaml ## One of: mysql, oracle, mssql, postgresql, mariadb ## Default: Embedded derby - ## Example for mysql + ## Example for mssql type: mssql driver: com.microsoft.sqlserver.jdbc.SQLServerDriver url: ${DB_URL};databaseName=${DB_NAME};sendStringParametersAsUnicode=false;applicationName=Artifactory Binary Repository @@ -159,10 +206,23 @@ cat <>/var/opt/jfrog/artifactory/etc/system.yaml password: ${DB_PASSWORD} EOF +elif [[ $DB_TYPE =~ "Postgresql" ]]; then + # Set Postgresql settings (add if/else for Postgres/MSSQL) ATTENTION - RT VM 7.5.5 doesn't have Postgres driver!! + cat <>/var/opt/jfrog/artifactory/etc/system.yaml + ## One of: mysql, oracle, mssql, postgresql, mariadb + ## Default: Embedded derby + ## Example for postgresql + type: postgresql + driver: org.postgresql.Driver + url: ${DB_URL}/${DB_NAME} + username: ${DB_USER} + password: ${DB_PASSWORD} + +EOF +fi # Create master.key on each node mkdir -p /opt/jfrog/artifactory/var/etc/security/ - cat </opt/jfrog/artifactory/var/etc/security/master.key ${MASTER_KEY} EOF @@ -182,21 +242,26 @@ cat </var/opt/jfrog/artifactory/etc/artifactory/binarystore.xml EOF - -cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE=" | sed "s/CERTIFICATE=//" > /tmp/temp.pem +if [[ -n "${CERTIFICATE}" ]] || [[ -n "${CERTIFICATE_KEY}" ]]; then +cat </tmp/temp.pem +${CERTIFICATE} +EOF cat /tmp/temp.pem | sed 's/CERTIFICATE----- /&\n/g' | sed 's/ -----END/\n-----END/g' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/certs/cert.pem -rm /tmp/temp.pem + rm /tmp/temp.pem -cat /var/lib/cloud/instance/user-data.txt | grep "^CERTIFICATE_KEY=" | sed "s/CERTIFICATE_KEY=//" > /tmp/temp.key +cat </tmp/temp.key +${CERTIFICATE_KEY} +EOF cat /tmp/temp.key | sed 's/KEY----- /&\n/' | sed 's/ -----END/\n-----END/' | awk '{if($0 ~ /----/) {print;} else { gsub(/ /,"\n");print;}}' > /etc/pki/tls/private/cert.key -rm /tmp/temp.key + rm /tmp/temp.key +fi chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/security && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/* # start Artifactory -sleep $((RANDOM % 120)) -service artifactory start -service nginx start +sleep 120 +systemctl start artifactory +systemctl start nginx nginx -s reload echo "INFO: Artifactory HA installation completed." echo "" diff --git a/AzureResourceManager/MP_submission_7/scripts/version_selector.sh b/AzureResourceManager/Artifactory/scripts/version_selector.sh similarity index 87% rename from AzureResourceManager/MP_submission_7/scripts/version_selector.sh rename to AzureResourceManager/Artifactory/scripts/version_selector.sh index 13526b2..aab3104 100644 --- a/AzureResourceManager/MP_submission_7/scripts/version_selector.sh +++ b/AzureResourceManager/Artifactory/scripts/version_selector.sh @@ -5,9 +5,9 @@ SUPPORTED_VERSIONS=("6.8.0\t6.11.3\t6.15.0\t0.16.0\t0.17.0\t6.18.0") unset IFS if [[ "\t${SUPPORTED_VERSIONS[@]}\t" =~ "\t${ARTIFACTORY_VERSION}\t" ]]; then - sh install_artifactory.sh + ./install_artifactory.sh echo "\ninstall_artifactory.sh was selected" >> user-data.txt else - sh install_artifactory7.sh + ./install_artifactory7.sh echo "\ninstall_artifactory7.sh was selected" >> user-data.txt fi \ No newline at end of file diff --git a/AzureResourceManager/Artifactory/vm_install/install_pro7_to_vm.sh b/AzureResourceManager/Artifactory/vm_install/install_pro7_to_vm.sh new file mode 100644 index 0000000..7900216 --- /dev/null +++ b/AzureResourceManager/Artifactory/vm_install/install_pro7_to_vm.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# Upgrade version for every release +ARTIFACTORY_VERSION=7.7.3 +UBUNTU_CODENAME=$(cat /etc/lsb-release | grep "^DISTRIB_CODENAME=" | sed "s/DISTRIB_CODENAME=//") + +export DEBIAN_FRONTEND=noninteractive + +# install the wget and curl +apt-get update +apt-get -y install wget curl>> /tmp/install-curl.log 2>&1 + +#Generate Self-Signed Cert +mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/ +openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost" + +# install the Artifactory PRO and Nginx +echo "deb https://jfrog.bintray.com/artifactory-pro-debs ${UBUNTU_CODENAME} main" | tee -a /etc/apt/sources.list +curl --retry 5 https://bintray.com/user/downloadSubjectPublicKey?username=jfrog | apt-key add - +apt-get update +apt-get -y install nginx>> /tmp/install-nginx.log 2>&1 +apt-get -y install jfrog-artifactory-pro=${ARTIFACTORY_VERSION} >> /tmp/install-artifactory.log 2>&1 + +# Add callhome metadata (allow us to collect information) +mkdir -p /var/opt/jfrog/artifactory/etc/info +cat </var/opt/jfrog/artifactory/etc/info/installer-info.json +{ + "productId": "ARM_artifactory-pro/1.0.0", + "features": [ + { + "featureId": "Partner/ACC-007221" + } + ] +} +EOF + +#Install database drivers (for Java 11, path is different for RT6 and RT7) +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/mysql-connector-java-5.1.38.jar https://bintray.com/artifact/download/bintray/jcenter/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar >> /tmp/install-databse-driver.log 2>&1 +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/mssql-jdbc-7.4.1.jre11.jar https://bintray.com/artifact/download/bintray/jcenter/com/microsoft/sqlserver/mssql-jdbc/7.4.1.jre11/mssql-jdbc-7.4.1.jre11.jar >> /tmp/install-databse-driver.log 2>&1 +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/postgresql-9.4.1212.jar https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar >> /tmp/install-databse-driver.log 2>&1 + +#Configuring nginx +rm /etc/nginx/sites-enabled/default + +printf "\nartifactory.ping.allowUnauthenticated=true" >> /var/opt/jfrog/artifactory/etc/artifactory/artifactory.system.properties + +chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/* + +# Remove Artifactory service from boot up run +systemctl disable artifactory +systemctl disable nginx \ No newline at end of file diff --git a/JFrogContainerRegistry/AzureResourceManager/LICENSE b/AzureResourceManager/JCR/LICENSE similarity index 100% rename from JFrogContainerRegistry/AzureResourceManager/LICENSE rename to AzureResourceManager/JCR/LICENSE diff --git a/JFrogContainerRegistry/AzureResourceManager/MP_submission_6/createUiDefinition.json b/AzureResourceManager/JCR/MP_submission_6/createUiDefinition.json similarity index 100% rename from JFrogContainerRegistry/AzureResourceManager/MP_submission_6/createUiDefinition.json rename to AzureResourceManager/JCR/MP_submission_6/createUiDefinition.json diff --git a/JFrogContainerRegistry/AzureResourceManager/MP_submission_6/mainTemplate.json b/AzureResourceManager/JCR/MP_submission_6/mainTemplate.json similarity index 100% rename from JFrogContainerRegistry/AzureResourceManager/MP_submission_6/mainTemplate.json rename to AzureResourceManager/JCR/MP_submission_6/mainTemplate.json diff --git a/AzureResourceManager/MP_submission_7/nested/azureDBDeploy.json b/AzureResourceManager/JCR/MP_submission_6/nested/azureDBDeploy.json similarity index 100% rename from AzureResourceManager/MP_submission_7/nested/azureDBDeploy.json rename to AzureResourceManager/JCR/MP_submission_6/nested/azureDBDeploy.json diff --git a/JFrogContainerRegistry/AzureResourceManager/MP_submission_6/scripts/install_artifactory.sh b/AzureResourceManager/JCR/MP_submission_6/scripts/install_artifactory.sh similarity index 100% rename from JFrogContainerRegistry/AzureResourceManager/MP_submission_6/scripts/install_artifactory.sh rename to AzureResourceManager/JCR/MP_submission_6/scripts/install_artifactory.sh diff --git a/JFrogContainerRegistry/AzureResourceManager/MP_submission_7/createUiDefinition.json b/AzureResourceManager/JCR/MP_submission_7/createUiDefinition.json similarity index 98% rename from JFrogContainerRegistry/AzureResourceManager/MP_submission_7/createUiDefinition.json rename to AzureResourceManager/JCR/MP_submission_7/createUiDefinition.json index e61080f..990c3ba 100644 --- a/JFrogContainerRegistry/AzureResourceManager/MP_submission_7/createUiDefinition.json +++ b/AzureResourceManager/JCR/MP_submission_7/createUiDefinition.json @@ -101,7 +101,7 @@ "name": "artifactoryVersion", "type": "Microsoft.Common.DropDown", "label": "JFrog Container Registry-vm image version to deploy.", - "defaultValue": "7.4.3", + "defaultValue": "7.7.3", "toolTip": "Version of JFrog Container Registry to deploy", "constraints": { "allowedValues": [ @@ -116,6 +116,10 @@ { "label": "7.4.3", "value": "7.4.3" + }, + { + "label": "7.7.3", + "value": "0.0.2" } ], "required": true @@ -132,7 +136,7 @@ "toolTip": "Master key for JFrog Container Registry cluster. Generate master.key using command '$openssl rand -hex 16'", "constraints": { "required": true, - "regex": "^[a-z0-9A-Z]{1,32}$", + "regex": "^[a-z0-9A-Z]{12,32}$", "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long." }, "options": { diff --git a/JFrogContainerRegistry/AzureResourceManager/MP_submission_7/mainTemplate.json b/AzureResourceManager/JCR/MP_submission_7/mainTemplate.json similarity index 95% rename from JFrogContainerRegistry/AzureResourceManager/MP_submission_7/mainTemplate.json rename to AzureResourceManager/JCR/MP_submission_7/mainTemplate.json index bd39da3..8456a9e 100644 --- a/JFrogContainerRegistry/AzureResourceManager/MP_submission_7/mainTemplate.json +++ b/AzureResourceManager/JCR/MP_submission_7/mainTemplate.json @@ -25,11 +25,12 @@ }, "artifactoryVersion": { "type": "string", - "defaultValue": "7.4.3", + "defaultValue": "0.0.2", "allowedValues": [ "7.2.1", "7.3.2", - "7.4.3" + "7.4.3", + "0.0.2" ], "metadata": { "description": "JFrog Container Registry-vm image version to deploy." @@ -213,7 +214,7 @@ "type": "Microsoft.Network/networkSecurityGroups", "location": "[parameters('location')]", "name": "[variables('nsgName')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "properties": { "securityRules": [ { @@ -293,9 +294,9 @@ "type": "Microsoft.Network/virtualNetworks", "name": "[variables('virtualNetworkName')]", "location": "[parameters('location')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "dependsOn": [ - "[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" + "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" ], "properties": { "addressSpace": { @@ -317,14 +318,14 @@ } }, { - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "type": "Microsoft.Network/networkInterfaces", "name": "[variables('nicPrimaryName')]", "location": "[parameters('location')]", "dependsOn": [ - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" ], "properties": { "ipConfigurations": [ @@ -350,7 +351,7 @@ "sku": { "name": "Standard" }, - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "properties": { "publicIPAllocationMethod": "Static", "dnsSettings": { @@ -362,12 +363,12 @@ "type": "Microsoft.Network/loadBalancers", "name": "[variables('lbName')]", "location": "[parameters('location')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "sku": { "name": "Standard" }, "dependsOn": [ - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]" + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]" ], "tags":{ "displayName": "Load Balancer" @@ -468,7 +469,7 @@ } }, { - "apiVersion": "2018-07-01", + "apiVersion": "2019-06-01", "type": "Microsoft.Storage/storageAccounts", "name": "[variables('storageAccountName')]", "location": "[parameters('location')]", @@ -484,7 +485,7 @@ { "type": "Microsoft.Resources/deployments", "name": "deploySQLDB", - "apiVersion": "2018-07-01", + "apiVersion": "2019-09-01", "properties": { "mode": "Incremental", "templateLink": { @@ -519,10 +520,10 @@ "location": "[parameters('location')]", "apiVersion": "2018-10-01", "dependsOn": [ - "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]", - "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" + "[resourceId('Microsoft.Network/loadBalancers/', variables('lbName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Resources/deployments/', 'deploySQLDB')]", + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" ], "plan": { "name": "artifactory-jcr", diff --git a/JFrogContainerRegistry/AzureResourceManager/MP_submission_6/nested/azureDBDeploy.json b/AzureResourceManager/JCR/MP_submission_7/nested/azureDBDeploy.json similarity index 86% rename from JFrogContainerRegistry/AzureResourceManager/MP_submission_6/nested/azureDBDeploy.json rename to AzureResourceManager/JCR/MP_submission_7/nested/azureDBDeploy.json index 70c31a5..44b6f3d 100644 --- a/JFrogContainerRegistry/AzureResourceManager/MP_submission_6/nested/azureDBDeploy.json +++ b/AzureResourceManager/JCR/MP_submission_7/nested/azureDBDeploy.json @@ -43,7 +43,7 @@ "type": "Microsoft.Sql/servers", "kind": "v12.0", "location": "[variables('db_location')]", - "apiVersion": "2019-06-01-preview", + "apiVersion": "2020-02-02-preview", "tags": { "displayName": "artifactoryDB" }, @@ -57,9 +57,9 @@ "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", "type": "firewallrules", "location": "[variables('db_location')]", - "apiVersion": "2019-06-01-preview", + "apiVersion": "2020-02-02-preview", "dependsOn": [ - "[concat('Microsoft.Sql/servers/', parameters('db_server'))]" + "[resourceId('Microsoft.Sql/servers/', parameters('db_server'))]" ], "properties": { "startIpAddress": "0.0.0.0", @@ -71,7 +71,7 @@ "type": "databases", "kind": "v12.0,user", "location": "[variables('db_location')]", - "apiVersion": "2019-06-01-preview", + "apiVersion": "2020-02-02-preview", "dependsOn": [ "[parameters('db_server')]" ], @@ -90,7 +90,7 @@ "outputs": { "jdbcConnString": { "type": "string", - "value": "[concat('jdbc:sqlserver://', reference(concat('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]" + "value": "[concat('jdbc:sqlserver://', reference(resourceId('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]" } } } diff --git a/JFrogContainerRegistry/AzureResourceManager/MP_submission_7/scripts/install_artifactory7.sh b/AzureResourceManager/JCR/MP_submission_7/scripts/install_artifactory7.sh similarity index 100% rename from JFrogContainerRegistry/AzureResourceManager/MP_submission_7/scripts/install_artifactory7.sh rename to AzureResourceManager/JCR/MP_submission_7/scripts/install_artifactory7.sh diff --git a/JFrogContainerRegistry/AzureResourceManager/README.md b/AzureResourceManager/JCR/README.md similarity index 100% rename from JFrogContainerRegistry/AzureResourceManager/README.md rename to AzureResourceManager/JCR/README.md diff --git a/JFrogContainerRegistry/AzureResourceManager/azuredeploy.json b/AzureResourceManager/JCR/azuredeploy.json similarity index 75% rename from JFrogContainerRegistry/AzureResourceManager/azuredeploy.json rename to AzureResourceManager/JCR/azuredeploy.json index e6688ca..a2cc4f9 100644 --- a/JFrogContainerRegistry/AzureResourceManager/azuredeploy.json +++ b/AzureResourceManager/JCR/azuredeploy.json @@ -25,19 +25,19 @@ }, "artifactoryVersion": { "type": "string", - "defaultValue": "7.4.3", + "defaultValue": "0.0.2", "allowedValues": [ "7.2.1", "7.3.2", - "7.4.3" + "7.4.3", + "0.0.2" ], "metadata": { "description": "JFrog Container Registry-vm image version to deploy." } }, "masterKey": { - "type": "string", - "defaultValue": "1ce2be4490ca2c662cb79636cf9b7b8e", + "type": "securestring", "maxLength": 64, "metadata": { "description": "Master key for JFrog Container Registry cluster. Generate master.key using command '$openssl rand -hex 16'" @@ -56,15 +56,13 @@ } }, "certificate": { - "type": "string", - "defaultValue": "-----BEGIN CERTIFICATE----- MIIFhzCCA2+gAwIBAgIJALC4r5BQWZE4MA0GCSqGSIb3DQEBCwUAMFoxCzAJBgNV BAYTAlVTMRMwEQYDVQQIDApDYWxpZm9ybmlhMRMwEQYDVQQHDApTYW50YUNsYXJh MQswCQYDVQQKDAJJVDEUMBIGA1UEAwwLKi5sb2NhbGhvc3QwHhcNMTgwMTE3MTk0 NjI4WhcNMTkwMTA4MTk0NjI4WjBaMQswCQYDVQQGEwJVUzETMBEGA1UECAwKQ2Fs aWZvcm5pYTETMBEGA1UEBwwKU2FudGFDbGFyYTELMAkGA1UECgwCSVQxFDASBgNV BAMMCyoubG9jYWxob3N0MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEA 7KfOWDQlov8cMa8r/lcJqiWZaH9myQC74Vbe0HXsntQbcvljkjG2P7ebm5dd9Bzc sauNOJpbKf5AhFK1iwJUAkciGc1LR4k8wfWmQM3NPS8hrqrtH20zqNpdFRpNYjja JofwccPNm030GhhZkZ95TpruvmswMDwspl3jfqdcc/eiQsHcKyGnV2a+UAeoqe7J mHhmhRy1MLqAjF5U1GrUYUONA+22iRDJb4c9B91QoWvsnXpdA9NKV/mmA3/rIdx6 Ld2IPRdrIw2K5sAnXsh3bx2oCSvSfussf0x+4XDrnsaHVfjwvfNL8ECOuac2Oi/E WOp9528gOohpFAuwEt63Vl5p8/CC9m0HJDTZBKm2l5eD1kdPIj4PvP9Sn9CxGXKQ E1bxWoFxGX8EyRW0b0NK31N7b8JPZ1SoFNiB5amOMNLvR26a7cQrKumTuJeYK9Ja JaxhMXM7R0DA0Ev8ZG2xmyCygox+1KPSmJOIEpT70BFbj3rKLNqP22ET+zvPuh+2 DdgyrpHFeYkGWjMbWPjK7wJsD2zM8ccoJQfepPz8I4rT0JfrKAQgCGuGOggneaNJ KTVGNOFbj5AXdZ/Q+GvNommyRdq4J7EnqY6L+P25fo5qZ6UZ/iS0tPcvxgn0Fdhs pUPbQyQIDZyxZd3Q1lUIE38ol8P66mS2zbzf8EeOCoUCAwEAAaNQME4wHQYDVR0O BBYEFETAQM/5P7XJ8kevHFj6BPndQOFaMB8GA1UdIwQYMBaAFETAQM/5P7XJ8kev HFj6BPndQOFaMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggIBAJ1TepKv LWYhFmVQcgZwZf/qt1a1cohzJSm6da9RCnnAWC7WC/U117bgSomtrH1v0OysHFhB zBBUeBqI7+OmzAX8dhj+roKkcnFUM/IwlK1eueIIA//CWvEf/o0XExilVS2yCc9d PTpOQBXwk9QinxK36kHdBiGxa7dW0JPnOEEmuMgGORKeLy4J6Ik8iSeFY1SZVcOI +6WWvoKciPlmIeccC+6YVmkeBwhP2o5r5w/UAaO2hSnGvmm4UIj/VJv4VQu7xTUp cIfFz5NtIr80DbqcyPiEMS2ETJ4L/kO4MS5FfeEXyQuXCzmiIDVY6tE3C7+kZmK4 JzPLuWm9ndQoyQySOGfQqvlUR1+YxUdvmu3LrOS5dOA354Q36wHa4wEGUoHU/7GV fYQmmmDSDaNSpXW5PFey6scFyDBS/yYJ0H9EjYb/11HeWYj8Yv5xTWj8nhzJONC8 D6Y5ydlU4PifM2pOf88pTYpmogNwLJWXbql5I9cvMa8APo4yLVqcISU5ynsvFke+ Non+T0mHpJai/hrA9NK+s6EGC1dAX58jy61h6FhOPI1d4s/mov/KMa2t3SfZp5SF 81aR6dHvO56teiK5M1xMkrqG75zh3TMFJJLRFe9XxeB4JeN76URB3mgADOUqkBxd ibSgVqfKwOw4IujEcqMUc5mqSnbLY1Dv+oby -----END CERTIFICATE-----", + "type": "securestring", "metadata": { "description": "To use Artifactory as docker registry you need to provide wild card valid Certificate. Provide your SSL Certificate." } }, "certificateKey": { - "type": "string", - "defaultValue": "-----BEGIN PRIVATE KEY----- MIIJRAIBADANBgkqhkiG9w0BAQEFAASCCS4wggkqAgEAAoICAQDsp85YNCWi/xwx ryv+VwmqJZlof2bJALvhVt7Qdeye1Bty+WOSMbY/t5ubl130HNyxq404mlsp/kCE UrWLAlQCRyIZzUtHiTzB9aZAzc09LyGuqu0fbTOo2l0VGk1iONomh/Bxw82bTfQa GFmRn3lOmu6+azAwPCymXeN+p1xz96JCwdwrIadXZr5QB6ip7smYeGaFHLUwuoCM XlTUatRhQ40D7baJEMlvhz0H3VCha+ydel0D00pX+aYDf+sh3Hot3Yg9F2sjDYrm wCdeyHdvHagJK9J+6yx/TH7hcOuexodV+PC980vwQI65pzY6L8RY6n3nbyA6iGkU C7AS3rdWXmnz8IL2bQckNNkEqbaXl4PWR08iPg+8/1Kf0LEZcpATVvFagXEZfwTJ FbRvQ0rfU3tvwk9nVKgU2IHlqY4w0u9HbprtxCsq6ZO4l5gr0lolrGExcztHQMDQ S/xkbbGbILKCjH7Uo9KYk4gSlPvQEVuPesos2o/bYRP7O8+6H7YN2DKukcV5iQZa MxtY+MrvAmwPbMzxxyglB96k/PwjitPQl+soBCAIa4Y6CCd5o0kpNUY04VuPkBd1 n9D4a82iabJF2rgnsSepjov4/bl+jmpnpRn+JLS09y/GCfQV2GylQ9tDJAgNnLFl 3dDWVQgTfyiXw/rqZLbNvN/wR44KhQIDAQABAoICAQDm1pAp7UPBCELCG/I3t0KQ GvjWu17RNcwN86SHhl92VcMolSaQ1bjF0h0Q2ccldHm5PHMWAUpnXcAk0mCO5Yh4 aFZVALEraCxBrZGrqJNH2Q9rxwJhIy2+yLD/Apb09iukZfkdnzaRBKrUQWgs6Xd0 OyAh0YBBrJCI/xAG3M0LuUMnBt3xnHQUhv2gJrhYeble5iJqOSRsEZ+OS/1G7aWX 8kI80MS6UguKpEndv/0EV7eHrHHKZ3Ee+z76Lu52Kw9qaaqYnJ0+pdkVV92PUM9f LXhY6cv7TP4sdbtVv8W1LEWakKaTQhySjwYpBXeZrjpB2QlSlEzFi4WjrfrjjSca UZazm/jY5uDI2cXf35NyZUkbYxIKlGtURtDpoPp5R7XguHSoqLrh2Zsc79mZfNST zFwbhNBVB2nAl6ZyIRNFLjVhQScvlImpIVSVZm5/NiiABIEaxRh8w8C5qRMctSTy KF6rS6as2KsPQHpiu/6nDMqqTZ8UMQ3yXEpai5VwAzKFP67usHheKf4RIXNUn7Xc JxWiI8KfOV5n4cSJK1/R+i+ZpWyQiloao4v7GS/fwZTsILeBLBa0utDmNs5aJgVK cEagRjVGAeAEc2W+jXmSqtZRHQowJmEKOARMn4lI+duziSCjIfPH6xIDAUhVlc/K u03432NupfPepW6BYVBgQQKCAQEA/+CD2uiRZgmzuEn/vn/u7jGFjETdUQmfl5kX pMTtueXyQxHBRwBCZqq885doozeQd7mLRcW+klngq1NmnEnjx+NfUzFJLpEmQO1/ AMHUpYpZY4jOyntx9cBy+M+DUfNtdsJUz+VOe3HO5/lJJf+gSgpVp2ku1oOrgEeH a71aGIXOsiOQ/fHL4Q0CuylersD5Dq4Tdf/u6rr4NbwOZQCQ9WH0uTckA9SkjJFu iHXblg8j9RUNbj89WPrEulKA98duFuLvGTeohcAPQ8f60Z7sxDLGLRyRvhUO4EBr hTTmcfI2LsPWSo+X+n6eBqfUfGZub2qN+d2B08qKgnGdgFEf6QKCAQEA7MTtAphl lswq4kPvDkPHMqJhmPBgb5NAUzE2Z8yjJY3IX6zxinSDnuMwEzCinKe7rzv6aYIh klviND/oyLOxVlLESZu62epokgIey05sv9a/030z7q5hradNzcMP1VfGVs6IeOvr 3Kit4T7LI1L2eXwD1Yks6uHHw8lHAlyrrlbwCEmzqElKs0YtkvNa4HFgesFNnObe f8C29LOPZMqje7iAT91823MGI9NML9qGYON/ZLc4uCB9no+o6ZOTQHqX1xxSWv5D 66KGiRnUC/RAq6RbTVn3NxFgvb3k0rejbQbxW5KCri1E4sTw+pZ5bIRUJcXi+J+Z Tg88lVbmqXfwPQKCAQEA94yShDr0UC+au/R7hCXpVnB6r5YAN+KDj/sAsNwE0hDx LIoE31gU5ZbRbylQhne/QNU1NK93C8gAYEAzyYiC4mPLWYUZNAAhbjdW47iirfUH PhChX6vGOOeTU7wPZD2J7ZdczjUelLcqYar/Zc/Fl1wgOfK86bRBO733+fgbLhZm PlnCcKx5fqVDuybu/0qaqeUn1sVgs59nezURCA5gL8YxKO973GjhOU2KDmNXqfnD 49wWPk7YXzldEpW3SACdNW8futnqJFwHaKAUvLBwh/BHYmV9atScq8AnRZxERoD6 govcyg3aDvJomC/OlvvSY+BGszHl5KzTDBg3NGlH4QKCAQA/71lU5xQfqVg3K0MF ZhYHPUP/iYFw/6FSFarsUp0Higa+lzPOQHI+WHjl5a8zgDO1OQwAq6wnGnq1w0A3 2hYcClOI0O2e5KaCLuJj4fSJxRKdqGR6okosG05uLqs63+3mCPVfOc3CEyaI+Wzf SArYeT2LzvP7JSbNXq+3GpEdjcpZYpWJ7uimCmBKGz7B9runykUMBme0tbRx1X72 J6YHxaWYa2XI2IGi8O7UyTyaMzR2XOeLCPMC+yYQlNIhijkwVCyE974dhhCwOvJA nB9Oeh5Rf+a6zw2BjyKYKBCQY1yPbrutDvpYBfhQoot9Wyph3NLScj5yjri8VvAI eSO9AoIBAQDyUx5YUgHgpoJtRZ+8PGQBZHm5L5HJhvfUs96I9Z4lZSXnCmEJyOWn LIob8c0n4hU1EXdbbl+7eRQgG3oGKyF0XXhuaP3vHprIBW6tm9kCGORTliZOaZdW 0Mj9GUv2de1r8anwJMFvIMXsuO08rsGzsIt7DrNYa0YSMkeDwPenRfDHXOYH2fjf RKjlP3fQr/iLL/YuMGaNxzIeyWPZ2WTUUC0bllNxMTZmztuMkPNb7fhhs0hLecXM fE2nbwUaGwMZaails1+5G3HvEAlChJ1GN9XnYxrtfqq93tYELWBiNcv1LaMAFvj8 S+j1+iUKGGhwVmhqh75q5do3+VF3XlAh -----END PRIVATE KEY-----", + "type": "securestring", "metadata": { "description": "Provide your SSL Certificate key" } @@ -144,7 +142,7 @@ "metadata": { "description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated." }, - "defaultValue": "https://raw.githubusercontent.com/JFrogDev/JFrog-Cloud-Installers/master/JFrogContainerRegistry/AzureResourceManager/" + "defaultValue": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/master/AzureResourceManager/JCR/" }, "_artifactsLocationSasToken": { "type": "securestring", @@ -190,7 +188,7 @@ "osType": { "publisher": "jfrog", "offer": "jfrogcontainerregistry-vm", - "sku": "artifactory-jcr-private", + "sku": "artifactory-jcr", "version": "[parameters('artifactoryVersion')]" }, "imageReference": "[variables('osType')]", @@ -216,7 +214,7 @@ "type": "Microsoft.Network/networkSecurityGroups", "location": "[parameters('location')]", "name": "[variables('nsgName')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "properties": { "securityRules": [ { @@ -296,9 +294,9 @@ "type": "Microsoft.Network/virtualNetworks", "name": "[variables('virtualNetworkName')]", "location": "[parameters('location')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "dependsOn": [ - "[concat('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" + "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" ], "properties": { "addressSpace": { @@ -320,14 +318,14 @@ } }, { - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "type": "Microsoft.Network/networkInterfaces", "name": "[variables('nicPrimaryName')]", "location": "[parameters('location')]", "dependsOn": [ - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[resourceId('Microsoft.Network/networkSecurityGroups', variables('nsgName'))]" + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Network/networkSecurityGroups/', variables('nsgName'))]" ], "properties": { "ipConfigurations": [ @@ -353,7 +351,7 @@ "sku": { "name": "Standard" }, - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "properties": { "publicIPAllocationMethod": "Static", "dnsSettings": { @@ -365,12 +363,12 @@ "type": "Microsoft.Network/loadBalancers", "name": "[variables('lbName')]", "location": "[parameters('location')]", - "apiVersion": "2018-07-01", + "apiVersion": "2020-03-01", "sku": { "name": "Standard" }, "dependsOn": [ - "[concat('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]" + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('pipPrimaryName'))]" ], "tags":{ "displayName": "Load Balancer" @@ -471,7 +469,7 @@ } }, { - "apiVersion": "2018-07-01", + "apiVersion": "2019-06-01", "type": "Microsoft.Storage/storageAccounts", "name": "[variables('storageAccountName')]", "location": "[parameters('location')]", @@ -487,7 +485,7 @@ { "type": "Microsoft.Resources/deployments", "name": "deploySQLDB", - "apiVersion": "2018-07-01", + "apiVersion": "2019-09-01", "properties": { "mode": "Incremental", "templateLink": { @@ -522,13 +520,13 @@ "location": "[parameters('location')]", "apiVersion": "2018-10-01", "dependsOn": [ - "[concat('Microsoft.Network/loadBalancers/', variables('lbName'))]", - "[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", - "[concat('Microsoft.Resources/deployments/', 'deploySQLDB')]", - "[concat('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" + "[resourceId('Microsoft.Network/loadBalancers/', variables('lbName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]", + "[resourceId('Microsoft.Resources/deployments/', 'deploySQLDB')]", + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]" ], "plan": { - "name": "artifactory-jcr-private", + "name": "artifactory-jcr", "publisher": "jfrog", "product": "jfrogcontainerregistry-vm" }, diff --git a/JFrogContainerRegistry/AzureResourceManager/azuredeploy.parameters.json b/AzureResourceManager/JCR/azuredeploy.parameters.json similarity index 68% rename from JFrogContainerRegistry/AzureResourceManager/azuredeploy.parameters.json rename to AzureResourceManager/JCR/azuredeploy.parameters.json index 5c200f7..513b9d9 100644 --- a/JFrogContainerRegistry/AzureResourceManager/azuredeploy.parameters.json +++ b/AzureResourceManager/JCR/azuredeploy.parameters.json @@ -21,7 +21,13 @@ "value": "GEN-UNIQUE" }, "masterKey": { - "value": "35767fa0164bac66b6cccb8880babefb" + "value": "GENERATE_MASTER_KEY" + }, + "certificate": { + "value": "-----BEGIN CERTIFICATE----- -----END CERTIFICATE-----" + }, + "certificateKey": { + "value": "-----BEGIN PRIVATE KEY----- -----END PRIVATE KEY-----" } } } \ No newline at end of file diff --git a/JFrogContainerRegistry/AzureResourceManager/images/HA_Diagram.png b/AzureResourceManager/JCR/images/HA_Diagram.png similarity index 100% rename from JFrogContainerRegistry/AzureResourceManager/images/HA_Diagram.png rename to AzureResourceManager/JCR/images/HA_Diagram.png diff --git a/JFrogContainerRegistry/AzureResourceManager/images/add_licenses.png b/AzureResourceManager/JCR/images/add_licenses.png similarity index 100% rename from JFrogContainerRegistry/AzureResourceManager/images/add_licenses.png rename to AzureResourceManager/JCR/images/add_licenses.png diff --git a/JFrogContainerRegistry/AzureResourceManager/MP_submission_7/nested/azureDBDeploy.json b/AzureResourceManager/JCR/nested/azureDBDeploy.json similarity index 86% rename from JFrogContainerRegistry/AzureResourceManager/MP_submission_7/nested/azureDBDeploy.json rename to AzureResourceManager/JCR/nested/azureDBDeploy.json index 70c31a5..44b6f3d 100644 --- a/JFrogContainerRegistry/AzureResourceManager/MP_submission_7/nested/azureDBDeploy.json +++ b/AzureResourceManager/JCR/nested/azureDBDeploy.json @@ -43,7 +43,7 @@ "type": "Microsoft.Sql/servers", "kind": "v12.0", "location": "[variables('db_location')]", - "apiVersion": "2019-06-01-preview", + "apiVersion": "2020-02-02-preview", "tags": { "displayName": "artifactoryDB" }, @@ -57,9 +57,9 @@ "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", "type": "firewallrules", "location": "[variables('db_location')]", - "apiVersion": "2019-06-01-preview", + "apiVersion": "2020-02-02-preview", "dependsOn": [ - "[concat('Microsoft.Sql/servers/', parameters('db_server'))]" + "[resourceId('Microsoft.Sql/servers/', parameters('db_server'))]" ], "properties": { "startIpAddress": "0.0.0.0", @@ -71,7 +71,7 @@ "type": "databases", "kind": "v12.0,user", "location": "[variables('db_location')]", - "apiVersion": "2019-06-01-preview", + "apiVersion": "2020-02-02-preview", "dependsOn": [ "[parameters('db_server')]" ], @@ -90,7 +90,7 @@ "outputs": { "jdbcConnString": { "type": "string", - "value": "[concat('jdbc:sqlserver://', reference(concat('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]" + "value": "[concat('jdbc:sqlserver://', reference(resourceId('Microsoft.Sql/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':1433')]" } } } diff --git a/JFrogContainerRegistry/AzureResourceManager/scripts/install_artifactory.sh b/AzureResourceManager/JCR/scripts/install_artifactory.sh similarity index 100% rename from JFrogContainerRegistry/AzureResourceManager/scripts/install_artifactory.sh rename to AzureResourceManager/JCR/scripts/install_artifactory.sh diff --git a/JFrogContainerRegistry/AzureResourceManager/scripts/install_artifactory7.sh b/AzureResourceManager/JCR/scripts/install_artifactory7.sh similarity index 100% rename from JFrogContainerRegistry/AzureResourceManager/scripts/install_artifactory7.sh rename to AzureResourceManager/JCR/scripts/install_artifactory7.sh diff --git a/AzureResourceManager/JCR/vm_install/install_jcr7_to_vm.sh b/AzureResourceManager/JCR/vm_install/install_jcr7_to_vm.sh new file mode 100644 index 0000000..00e3894 --- /dev/null +++ b/AzureResourceManager/JCR/vm_install/install_jcr7_to_vm.sh @@ -0,0 +1,51 @@ +#!/bin/bash + +# Upgrade version for every release +ARTIFACTORY_VERSION=7.7.3 +UBUNTU_CODENAME=$(cat /etc/lsb-release | grep "^DISTRIB_CODENAME=" | sed "s/DISTRIB_CODENAME=//") + +export DEBIAN_FRONTEND=noninteractive + +# install the wget and curl +apt-get update +apt-get -y install wget curl>> /tmp/install-curl.log 2>&1 + +#Generate Self-Signed Cert +mkdir -p /etc/pki/tls/private/ /etc/pki/tls/certs/ +openssl req -nodes -x509 -newkey rsa:4096 -keyout /etc/pki/tls/private/example.key -out /etc/pki/tls/certs/example.pem -days 356 -subj "/C=US/ST=California/L=SantaClara/O=IT/CN=*.localhost" + +# install the Artifactory JCR and Nginx +echo "deb https://jfrog.bintray.com/artifactory-debs ${UBUNTU_CODENAME} main" | tee -a /etc/apt/sources.list +curl --retry 5 https://bintray.com/user/downloadSubjectPublicKey?username=jfrog | apt-key add - +apt-get update +apt-get -y install nginx>> /tmp/install-nginx.log 2>&1 +apt-get -y install jfrog-artifactory-jcr=${ARTIFACTORY_VERSION} >> /tmp/install-artifactory.log 2>&1 + +# Add callhome metadata (allow us to collect information) +mkdir -p /var/opt/jfrog/artifactory/etc/info +cat </var/opt/jfrog/artifactory/etc/info/installer-info.json +{ + "productId": "ARM_artifactory-jcr/1.0.0", + "features": [ + { + "featureId": "Partner/ACC-007221" + } + ] +} +EOF + +#Install database drivers (for Java 11, path is different for RT6 and RT7) +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/mysql-connector-java-5.1.38.jar https://bintray.com/artifact/download/bintray/jcenter/mysql/mysql-connector-java/5.1.38/mysql-connector-java-5.1.38.jar >> /tmp/install-databse-driver.log 2>&1 +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/mssql-jdbc-7.4.1.jre11.jar https://bintray.com/artifact/download/bintray/jcenter/com/microsoft/sqlserver/mssql-jdbc/7.4.1.jre11/mssql-jdbc-7.4.1.jre11.jar >> /tmp/install-databse-driver.log 2>&1 +curl --retry 5 -L -o /opt/jfrog/artifactory/app/artifactory/tomcat/lib/postgresql-9.4.1212.jar https://jdbc.postgresql.org/download/postgresql-9.4.1212.jar >> /tmp/install-databse-driver.log 2>&1 + +#Configuring nginx +rm /etc/nginx/sites-enabled/default + +printf "\nartifactory.ping.allowUnauthenticated=true" >> /var/opt/jfrog/artifactory/etc/artifactory/artifactory.system.properties + +chown artifactory:artifactory -R /var/opt/jfrog/artifactory/* && chown artifactory:artifactory -R /var/opt/jfrog/artifactory/etc/* + +# Remove Artifactory service from boot up run +systemctl disable artifactory +systemctl disable nginx \ No newline at end of file diff --git a/AzureResourceManager/Postgresql/azurePostgresDBDeploy.json b/AzureResourceManager/Postgresql/azurePostgresDBDeploy.json new file mode 100644 index 0000000..b06316e --- /dev/null +++ b/AzureResourceManager/Postgresql/azurePostgresDBDeploy.json @@ -0,0 +1,175 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "xray", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_name": { + "type": "string", + "defaultValue": "xrayrtdb", + "minLength": 1 + }, + "db_location": { + "type": "string", + "defaultValue": "" + }, + "skuCapacity": { + "type": "int", + "defaultValue": 2 + }, + "skuFamily": { + "type": "string", + "defaultValue": "Gen5" + }, + "skuName": { + "type": "string", + "defaultValue": "GP_Gen5_2" + }, + "skuSizeMB": { + "type": "int", + "defaultValue": 5120 + }, + "skuTier": { + "type": "string", + "defaultValue": "GeneralPurpose" + }, + "version": { + "type": "string", + "defaultValue": "9.6" + }, + "backupRetentionDays": { + "type": "int", + "defaultValue": 7 + }, + "geoRedundantBackup": { + "type": "string", + "defaultValue": "Disabled" + }, + "databases": { + "type": "object", + "defaultValue": + { + "name": "xray", + "charset": "UTF8", + "collation": "English_United States.1252" + } + }, + "sslEnforcement": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Disabled", + "metadata": { + "description": "SSL Enforcement" + } + }, + "publicNetworkAccess": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Enabled", + "metadata": { + "description": "Public Network Access" + } + } + }, + "variables": { + "db_location": "[if(equals(parameters('db_location'), ''), resourceGroup().location, parameters('db_location'))]" + }, + "resources": [ + { + "type": "Microsoft.DBforPostgreSQL/servers", + "apiVersion": "2017-12-01", + "location": "[variables('db_location')]", + "name": "[parameters('db_server')]", + "properties": { + "version": "[parameters('version')]", + "administratorLogin": "[parameters('db_user')]", + "administratorLoginPassword": "[parameters('db_password')]", + "publicNetworkAccess": "[parameters('publicNetworkAccess')]", + "sslEnforcement": "[parameters('sslEnforcement')]", + "storageProfile": { + "storageMB": "[parameters('skuSizeMB')]", + "backupRetentionDays": "[parameters('backupRetentionDays')]", + "geoRedundantBackup": "[parameters('geoRedundantBackup')]" + } + }, + "sku": { + "name": "[parameters('skuName')]", + "tier": "[parameters('skuTier')]", + "capacity": "[parameters('skuCapacity')]", + "size": "[parameters('skuSizeMB')]", + "family": "[parameters('skuFamily')]" + }, + "resources": [ + { + "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", + "type": "firewallRules", + "apiVersion": "2017-12-01", + "location": "[variables('db_location')]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[0].name)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[0].charset]", + "collation": "[parameters('databases').properties[0].collation]" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[1].name)]", + "condition": "[greater(length(parameters('databases').properties), 0)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[1].charset]", + "collation": "[parameters('databases').properties[1].collation]" + } + } + ] + } + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[concat('jdbc:postgresql://', reference(concat('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + }, + "dbServerName": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "xrayConnString": { + "type": "string", + "value": "[concat('postgres://', reference(concat('Microsoft.DBforPostgreSQL/servers/', parameters('db_server'))).fullyQualifiedDomainName, ':5432')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Postgresql/postgres.parameters.json b/AzureResourceManager/Postgresql/postgres.parameters.json new file mode 100644 index 0000000..a51a112 --- /dev/null +++ b/AzureResourceManager/Postgresql/postgres.parameters.json @@ -0,0 +1,31 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "value": "DB-USERNAME" + }, + "db_password": { + "value": "GENERATE-PASSWORD" + }, + "db_server": { + "value": "DB-SERVERNSME" + }, + "databases": { + "value": { + "properties": [ + { + "name": "artdb", + "charset": "UTF8", + "collation": "English_United States.1252" + }, + { + "name": "xray", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/LICENSE b/AzureResourceManager/Xray/LICENSE new file mode 100644 index 0000000..261eeb9 --- /dev/null +++ b/AzureResourceManager/Xray/LICENSE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + + 1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. diff --git a/AzureResourceManager/Xray/MP_submission/createUiDefinition.json b/AzureResourceManager/Xray/MP_submission/createUiDefinition.json new file mode 100644 index 0000000..80c03e4 --- /dev/null +++ b/AzureResourceManager/Xray/MP_submission/createUiDefinition.json @@ -0,0 +1,319 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/0.1.2-preview/CreateUIDefinition.MultiVm.json#", + "handler": "Microsoft.Azure.CreateUIDef", + "version": "0.1.2-preview", + "parameters": { + "basics": [], + "steps": [ + { + "name": "vmCredential", + "label": "VM Credential", + "bladeTitle": "VM Credential", + "subLabel": { + "preValidation": "Provide VM credentials", + "postValidation": "Great - let's move on!" + }, + "elements": [ + { + "name": "virtualMachine", + "type": "Microsoft.Common.Section", + "elements": [ + { + "name": "adminUsername", + "type": "Microsoft.Compute.UserNameTextBox", + "label": "Admin username", + "osPlatform": "Linux", + "constraints": { + "required": true, + "regex": "^[a-z0-9A-Z]{1,30}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long." + }, + "toolTip": "Provide admin username for the virtual machine" + }, + { + "name": "adminPassword", + "type": "Microsoft.Compute.CredentialsCombo", + "label": { + "password": "Password", + "confirmPassword": "Confirm password" + }, + "osPlatform": "Linux", + "constraints": { + "required": true, + "customPasswordRegex": "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{12,}$", + "customValidationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number." + }, + "options": { + "hideConfirmation": false + }, + "toolTip": { + "password": "Provide admin password for the virtual machine" + }, + "visible": true + } + ], + "visible": true + }, + { + "name": "vnet", + "type": "Microsoft.Network.VirtualNetworkCombo", + "toolTip": "Provide Virtual Network information", + "label": { + "virtualNetwork": "Virtual Network", + "subnets": "Subnets" + }, + "defaultValue": { + "name": "vmx-vnet", + "addressPrefixSize": "/16" + }, + "constraints": { + "minAddressPrefixSize": "/24" + }, + "subnets": { + "subnet1": { + "label": "Subnet", + "defaultValue": { + "name": "vmx-subnet", + "addressPrefixSize": "/24" + }, + "constraints": { + "minAddressPrefixSize": "/29", + "minAddressCount": 8, + "requireContiguousAddresses": true + } + } + } + }, + { + "name": "vmSku", + "type": "Microsoft.Compute.SizeSelector", + "label": "Virtual machine size", + "toolTip": "The size of the virtual machine for Xray", + "recommendedSizes": [ + "Standard_D4s_v3" + ], + "constraints": { + "allowedSizes": [ + "Standard_A4_v2", + "Standard_A4", + "Standard_D4s_v3", + "Standard_D8s_v3", + "Standard_D16s_v3", + "Standard_D32s_v3", + "Standard_DS3_v2", + "Standard_D3_v2", + "Standard_DC4s" + ] + }, + "osPlatform": "Linux", + "count": 1 + } + ] + }, + { + "name": "xrayConfig", + "label": "Xray settings", + "subLabel": { + "preValidation": "Configure Xray Deployment", + "postValidation": "Done!" + }, + "bladeTitle": "Xray Settings", + "elements": [ + { + "name": "xrayVersion", + "type": "Microsoft.Common.DropDown", + "label": "Xray-vm image version to deploy.", + "defaultValue": "3.8.2", + "toolTip": "Version of Xray to deploy", + "constraints": { + "allowedValues": [ + { + "label": "3.6.2", + "value": "0.0.3" + }, + { + "label": "3.8.2", + "value": "0.0.4" + } + ], + "required": true + }, + "visible": true + }, + { + "name": "clusterName", + "type": "Microsoft.Common.TextBox", + "label": "Cluster name", + "toolTip": "Cluster name", + "defaultValue": "", + "constraints": { + "required": true, + "regex": "^[a-z0-9A-Z]{1,30}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long." + } + }, + { + "name": "masterKey", + "type": "Microsoft.Common.PasswordBox", + "label": { + "password": "Xray master Key", + "confirmPassword": "Confirm master Key" + }, + "toolTip": "Master key for Xray instance. Generate master.key using command '$openssl rand -hex 16'", + "constraints": { + "required": true, + "regex": "^[a-z0-9A-Z]{12,32}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long." + }, + "options": { + "hideConfirmation": true + } + }, + { + "name": "joinKey", + "type": "Microsoft.Common.PasswordBox", + "label": { + "password": "Artifactory join Key", + "confirmPassword": "Confirm join Key" + }, + "toolTip": "Join key from Artifactory cluster. You can copy Join key from the Artifactory UI, Security -> Settings -> Connection details", + "constraints": { + "required": true, + "regex": "^[a-z0-9A-Z]{12,32}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-32 characters long." + }, + "options": { + "hideConfirmation": true + } + }, + { + "name": "artifactoryURL", + "type": "Microsoft.Common.TextBox", + "label": "Provide artifactory URL to connect Xray instance", + "defaultValue": "https://myorgartifactory.com", + "toolTip": "Provide Artifactory URL", + "constraints": { + "required": true, + "regex": "^(https?)://[^\\s/$.?#].[^\\s]*$", + "validationMessage": "URL is not valid" + } + } + ] + }, + { + "name": "databaseConfig", + "label": "Database Configuration", + "subLabel": { + "preValidation": "Configure the Database", + "postValidation": "Done" + }, + "bladeTitle": "Database Credential", + "elements": [ + { + "name": "infoMessage", + "type": "Microsoft.Common.InfoBox", + "visible": true, + "options": { + "icon": "Info", + "text": "You can deploy a new Postgresql server or use your existing Postgres server and database. Please make sure Postgresql instance is set up correctly before Xray deployment. Check README.md https://github.com/jfrog/JFrog-Cloud-Installers/blob/arm-xray/AzureResourceManager/Xray/README.md#postgresql-deployment. You can use Postgresql template from here https://github.com/jfrog/JFrog-Cloud-Installers/tree/arm-xray/AzureResourceManager/Postgresql" + } + }, + { + "name": "db_type", + "type": "Microsoft.Common.DropDown", + "label": "Database options", + "toolTip": "Deploy a new DB instance or use an existing DB", + "constraints": { + "required": true, + "allowedValues": [ + { + "label": "Deploy a new Postgresql instance", + "value": "Postgresql_deploy.json" + }, + { + "label": "Use existing Postgresql instance", + "value": "Postgresql_existing.json" + } + ] + }, + "visible": true + }, + { + "name": "db_server", + "type": "Microsoft.Common.TextBox", + "label": "Database server name. Skip if a new deployment is selected", + "toolTip": "Database server name", + "constraints": { + "required": false, + "regex": "^[a-z0-9A-Z]{1,15}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-15 characters long." + } + }, + { + "name": "manual_db_url", + "type": "Microsoft.Common.TextBox", + "label": "Database connection string. Skip if a new deployment is selected", + "toolTip": "Jdbc connection string for MSSQL or Postgresql", + "constraints": { + "required": false, + "regex": "..*", + "validationMessage": "DB connection string is not valid" + } + }, + { + "name": "db_user", + "type": "Microsoft.Compute.UserNameTextBox", + "label": "User name", + "toolTip": "Admin username for the database", + "osPlatform": "Linux", + "constraints": { + "required": true, + "regex": "^[a-z0-9A-Z]{1,30}$", + "validationMessage": "Only alphanumeric characters are allowed, and the value must be 1-30 characters long." + } + }, + { + "name": "db_password", + "type": "Microsoft.Common.PasswordBox", + "label": { + "password": "Password", + "confirmPassword": "Confirm password" + }, + "toolTip": "Admin password for the database", + "constraints": { + "required": true, + "regex": "^(?=.*[A-Za-z])(?=.*\\d)(?=.*[@$!%*#?&])[A-Za-z\\d@$!%*#?&]{12,}$", + "validationMessage": "The password must contain at least 12 characters, with at least 1 uppercase letter, 1 lowercase letter and 1 number." + }, + "options": { + "hideConfirmation": false + }, + "visible": true + } + ] + } + ], + "outputs": { + "location": "[location()]", + "adminUsername": "[steps('vmCredential').virtualMachine.adminUsername]", + "adminPassword": "[steps('vmCredential').virtualMachine.adminPassword.password]", + "virtualNetworkName": "[steps('vmCredential').vnet.name]", + "virtualNetworkNewOrExisting": "[steps('vmCredential').vnet.newOrExisting]", + "virtualNetworkAddressPrefix": "[first(steps('vmCredential').vnet.addressPrefixes)]", + "virtualNetworkResourceGroup": "[steps('vmCredential').vnet.resourceGroup]", + "virtualMachineSize": "[steps('vmCredential').vmSku]", + "subnetName": "[steps('vmCredential').vnet.subnets.subnet1.name]", + "subnetAddressPrefix": "[steps('vmCredential').vnet.subnets.subnet1.addressPrefix]", + "xrayVersion": "[steps('xrayConfig').xrayVersion]", + "clusterName": "[steps('xrayConfig').clusterName]", + "artifactoryURL": "[steps('xrayConfig').artifactoryURL]", + "masterKey": "[steps('xrayConfig').masterKey]", + "joinKey": "[steps('xrayConfig').joinKey]", + "db_type": "[steps('databaseConfig').db_type]", + "db_server": "[steps('databaseConfig').db_server]", + "manual_db_url": "[steps('databaseConfig').manual_db_url]", + "db_user": "[steps('databaseConfig').db_user]", + "db_password": "[steps('databaseConfig').db_password]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/MP_submission/mainTemplate.json b/AzureResourceManager/Xray/MP_submission/mainTemplate.json new file mode 100644 index 0000000..391dcd4 --- /dev/null +++ b/AzureResourceManager/Xray/MP_submission/mainTemplate.json @@ -0,0 +1,401 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for the resources." + } + }, + "clusterName": { + "type": "string", + "defaultValue": "xray", + "maxLength": 61, + "metadata": { + "description": "String used as a base for naming resources. Must be 3-61 characters in length and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended." + } + }, + "xrayVersion": { + "type": "string", + "defaultValue": "0.0.4", + "allowedValues": [ + "0.0.3", + "0.0.4" + ], + "metadata": { + "description": "Xray-vm image version to deploy." + } + }, + "artifactoryURL": { + "type": "string", + "metadata": { + "description": "Artifactory URL" + } + }, + "masterKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'" + } + }, + "joinKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'" + } + }, + "adminUsername": { + "type": "string", + "defaultValue": "testadmin", + "metadata": { + "description": "Username for the Virtual Machine." + } + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Password for the Virtual Machine." + } + }, + "virtualNetworkName": { + "type": "string", + "metadata": { + "description": "New or Existing VNet Name" + } + }, + "virtualNetworkNewOrExisting": { + "type": "string", + "metadata": { + "description": "Boolean indicating whether the VNet is new or existing" + } + }, + "virtualNetworkAddressPrefix": { + "type": "string", + "metadata": { + "description": "VNet address prefix" + } + }, + "virtualNetworkResourceGroup": { + "type": "string", + "metadata": { + "description": "Resource group of the VNet" + } + }, + "virtualMachineSize": { + "type": "string", + "metadata": { + "description": "The size of the VM" + } + }, + "subnetName": { + "type": "string", + "metadata": { + "description": "New or Existing subnet Name" + } + }, + "subnetAddressPrefix": { + "type": "string", + "metadata": { + "description": "Subnet address prefix" + } + }, + "db_type": { + "type": "string", + "defaultValue": "Postgresql_deploy.json", + "allowedValues": [ + "Postgresql_deploy.json", + "Postgresql_existing.json" + ], + "metadata": { + "description": "Deploy new Postgresql, MSSQL or use existing DB" + } + }, + "manual_db_url": { + "type": "string", + "metadata": { + "description": "DB server URL, if existing DB server is used instead of a new deployment (jdbc:sqlserver://.. or jdbc:postgresql://..)" + } + }, + "db_server": { + "type": "string", + "metadata": { + "description": "DB server name, if pre-existing DB is used" + } + }, + "db_user": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Database Admin user name" + } + }, + "db_password": { + "type": "securestring", + "minLength": 1, + "metadata": { + "description": "Database Admin password" + } + }, + "databases": { + "type": "object", + "defaultValue": { + "properties": [ + { + "name": "xray", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } + }, + "_artifactsLocation": { + "type": "string", + "metadata": { + "description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated." + }, + "defaultValue": "[deployment().properties.templateLink.uri]" + }, + "_artifactsLocationSasToken": { + "type": "securestring", + "metadata": { + "description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated." + }, + "defaultValue": "" + } + }, + "variables": { + "namingInfix": "[toLower(substring(concat(parameters('clusterName'), uniqueString(resourceGroup().id)), 0, 9))]", + "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'sawinvm')]", + "publicIPAddressName": "[concat(uniqueString(resourceGroup().id),'IP')]", + "clusterName": "[parameters('clusterName')]", + "nicName": "[concat(variables('clusterName'),'Nic')]", + "ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]", + "vnetId": { + "new": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]", + "existing": "[resourceId(parameters('virtualNetworkResourceGroup'),'Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]" + }, + "subnetId": "[concat(variables('vnetId')[parameters('virtualNetworkNewOrExisting')],'/subnets/',parameters('subnetName'))]", + "publicIPAddressType": "Dynamic", + "db_server": "[parameters('db_server')]", + "db_user": "[concat(parameters('db_user'), '@', parameters('db_server'))]", + "db_password": "[parameters('db_password')]", + "db_location": "[parameters('location')]", + "db_name": "[parameters('databases').properties[0].name]", + "masterKey": "[parameters('masterKey')]", + "joinKey": "[parameters('joinKey')]", + "osType": { + "publisher": "jfrog", + "offer": "x-ray-vm", + "sku": "x-ray-vm", + "version": "[parameters('xrayVersion')]" + }, + "imageReference": "[variables('osType')]", + "dbTemplate": "[parameters('db_type')]", + "dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]", + "artifactoryURL": "[parameters('artifactoryURL')]" + }, + "resources": [ + { + "apiVersion": "2019-05-01", + "name": "pid-04c1c376-5d4b-4771-9a7f-054f5910dcef", + "type": "Microsoft.Resources/deployments", + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [] + } + } + }, + { + "condition": "[equals(parameters('virtualNetworkNewOrExisting'),'new')]", + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2020-05-01", + "name": "[parameters('virtualNetworkName')]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[parameters('virtualNetworkAddressPrefix')]" + ] + }, + "subnets": [ + { + "name": "[parameters('subnetName')]", + "properties": { + "addressPrefix": "[parameters('subnetAddressPrefix')]" + } + } + ] + } + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('publicIPAddressName')]", + "apiVersion": "2020-05-01", + "location": "[parameters('location')]", + "properties": { + "publicIPAllocationMethod": "[variables('publicIPAddressType')]" + } + }, + { + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicName')]", + "apiVersion": "2020-05-01", + "location": "[parameters('location')]", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" + }, + "subnet": { + "id": "[variables('subnetId')]" + } + } + } + ], + "enableIPForwarding": true + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]" + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-11-01", + "name": "[variables('storageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage", + "properties": {} + }, + { + "type": "Microsoft.Resources/deployments", + "name": "deploySQLDB", + "apiVersion": "2019-09-01", + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('dbTemplateLocation')]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "db_user": { + "value": "[parameters('db_user')]" + }, + "db_password": { + "value": "[variables('db_password')]" + }, + "db_server": { + "value": "[variables('db_server')]" + }, + "db_location": { + "value": "[variables('db_location')]" + }, + "databases": { + "value": "[parameters('databases')]" + }, + "manual_db_url": { + "value": "[parameters('manual_db_url')]" + } + } + } + }, + { + "type": "Microsoft.Compute/virtualMachineScaleSets", + "name": "[concat(variables('namingInfix'), 'xrayScaleset')]", + "location": "[parameters('location')]", + "apiVersion": "2018-10-01", + "dependsOn": [ + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]", + "[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]" + ], + "plan": { + "name": "x-ray-vm", + "publisher": "jfrog", + "product": "x-ray-vm" + }, + "sku": { + "name": "[parameters('virtualMachineSize')]", + "tier": "Standard", + "capacity": 1 + }, + "properties": { + "singlePlacementGroup": true, + "overprovision": false, + "upgradePolicy": { + "mode": "Manual" + }, + "virtualMachineProfile": { + "storageProfile": { + "osDisk": { + "caching": "ReadWrite", + "diskSizeGB": 250, + "createOption": "FromImage" + }, + "imageReference": "[variables('imageReference')]" + }, + "osProfile": { + "computerNamePrefix": "[variables('namingInfix')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]", + "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nXRAY_VERSION=', parameters('xrayVersion'),'\nARTIFACTORY_URL=',variables('artifactoryURL'),'\nDB_SERVER=',variables('db_server'),'\nDB_NAME=',variables('db_name'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\n'))]" + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "[variables('nicName')]", + "properties": { + "primary": true, + "ipConfigurations": [ + { + "name": "[concat(variables('ipConfigName'),'1')]", + "properties": { + "subnet": { + "id": "[variables('subnetId')]" + } + } + } + ] + } + } + ] + }, + "extensionProfile": { + "extensions": [ + { + "name": "extension1", + "properties": { + "publisher": "Microsoft.Azure.Extensions", + "type": "CustomScript", + "typeHandlerVersion": "2.0", + "autoUpgradeMinorVersion": false, + "settings": { + "fileUris": [ + "[uri(parameters('_artifactsLocation'), concat('scripts/install_xray.sh', parameters('_artifactsLocationSasToken')))]" + ] + }, + "protectedSettings": { + "commandToExecute": "./install_xray.sh >> /opt/installation_log1.txt" + } + } + } + ] + } + } + } + } + ] +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/MP_submission/nested/Postgresql_deploy.json b/AzureResourceManager/Xray/MP_submission/nested/Postgresql_deploy.json new file mode 100644 index 0000000..4f6d8ce --- /dev/null +++ b/AzureResourceManager/Xray/MP_submission/nested/Postgresql_deploy.json @@ -0,0 +1,161 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "xray", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "skuCapacity": { + "type": "int", + "defaultValue": 2 + }, + "skuFamily": { + "type": "string", + "defaultValue": "Gen5" + }, + "skuName": { + "type": "string", + "defaultValue": "GP_Gen5_2" + }, + "skuSizeMB": { + "type": "int", + "defaultValue": 5120 + }, + "skuTier": { + "type": "string", + "defaultValue": "GeneralPurpose" + }, + "version": { + "type": "string", + "defaultValue": "9.6" + }, + "backupRetentionDays": { + "type": "int", + "defaultValue": 7 + }, + "geoRedundantBackup": { + "type": "string", + "defaultValue": "Disabled" + }, + "databases": { + "type": "object" + }, + "sslEnforcement": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Disabled", + "metadata": { + "description": "SSL Enforcement" + } + }, + "publicNetworkAccess": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Enabled", + "metadata": { + "description": "Public Network Access" + } + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + { + "type": "Microsoft.DBforPostgreSQL/servers", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "name": "[parameters('db_server')]", + "properties": { + "version": "[parameters('version')]", + "administratorLogin": "[parameters('db_user')]", + "administratorLoginPassword": "[parameters('db_password')]", + "publicNetworkAccess": "[parameters('publicNetworkAccess')]", + "sslEnforcement": "[parameters('sslEnforcement')]", + "storageProfile": { + "storageMB": "[parameters('skuSizeMB')]", + "backupRetentionDays": "[parameters('backupRetentionDays')]", + "geoRedundantBackup": "[parameters('geoRedundantBackup')]" + } + }, + "sku": { + "name": "[parameters('skuName')]", + "tier": "[parameters('skuTier')]", + "capacity": "[parameters('skuCapacity')]", + "size": "[parameters('skuSizeMB')]", + "family": "[parameters('skuFamily')]" + }, + "resources": [ + { + "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", + "type": "firewallRules", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[0].name)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[0].charset]", + "collation": "[parameters('databases').properties[0].collation]" + } + } + ] + } + ], + "outputs": { + "dbServerName": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "manual_db_url": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/MP_submission/nested/Postgresql_existing.json b/AzureResourceManager/Xray/MP_submission/nested/Postgresql_existing.json new file mode 100644 index 0000000..6e8be3a --- /dev/null +++ b/AzureResourceManager/Xray/MP_submission/nested/Postgresql_existing.json @@ -0,0 +1,54 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "artifactory", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh b/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh new file mode 100644 index 0000000..95db4a2 --- /dev/null +++ b/AzureResourceManager/Xray/MP_submission/scripts/install_xray.sh @@ -0,0 +1,40 @@ +#!/bin/bash +DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//") +DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//") +DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//") +DB_SERVER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_SERVER=" | sed "s/DB_SERVER=//") +MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//") +JOIN_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JOIN_KEY=" | sed "s/JOIN_KEY=//") +ARTIFACTORY_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_URL=" | sed "s/ARTIFACTORY_URL=//") + +export DEBIAN_FRONTEND=noninteractive + +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CC86BB64 +sudo add-apt-repository ppa:rmescandon/yq -y +sudo apt update -y +sudo apt install yq -y + +# Create master.key on each node +sudo mkdir -p /opt/jfrog/xray/var/etc/security/ +cat </opt/jfrog/xray/var/etc/security/master.key +${MASTER_KEY} +EOF + +# Xray should have the same join key as the Artifactory instance +# Both application should be deployed in the same Virtual Networks +HOSTNAME=$(hostname -i) +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.url postgres://${DB_SERVER}.postgres.database.azure.com:5432/${DB_NAME}?sslmode=disable +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.username ${DB_USER} +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.password ${DB_PASSWORD} +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.rabbitMq.password JFXR_RABBITMQ_COOKIE +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.jfrogUrl ${ARTIFACTORY_URL} +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.security.joinKey ${JOIN_KEY} +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.node.ip ${HOSTNAME} + +chown xray:xray -R /opt/jfrog/xray/var/etc/security/* && chown xray:xray -R /opt/jfrog/xray/var/etc/security/ + + +# Enable and start Xray service +sudo systemctl enable xray.service +sudo systemctl start xray.service +sudo systemctl restart xray.service diff --git a/AzureResourceManager/Xray/README.md b/AzureResourceManager/Xray/README.md new file mode 100644 index 0000000..6c6a61e --- /dev/null +++ b/AzureResourceManager/Xray/README.md @@ -0,0 +1,101 @@ +# Setup JFrog Xray +The recommended way of deploying is through the Azure marketplace. + + + + + +This template can help you setup [JFrog Xray](https://jfrog.com/xray/) on Azure. + +## Prerequisites +1. JFrog Xray is an addition to JFrog Artifactory. + * To be able to use it, you need to have an Artifactory instance deployed in Azure with the appropriate license. If you do not have an Xray compatible license, you can [get a free trial](https://jfrog.com/xray/free-trial/). + +2. Deployed Postgresql instance (if "existing DB" is selected as a parameter). + +## Postgresql deployment +Xray could fail to connect to "out of the box" Azure Postgresql. You can deploy a compatible Postgresql instance using this link: + + + + + +In the Databases field, use the object: + +``` + { + "properties": [ + { + "name": "xray", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } +``` +Before deploying Xray, please do following steps: +1. Use the admin role given by Azure that you initially connected with to PSDB (for example xray) - Remember the password of this role to connect when setting up with Xray. + +2. Create a new role named xray@{hostname}, where {hostname} is a DB server name. + +3. Add xray@{hostname} membership to the base Azure user. In the client tab (PgAdmin for example) right click on properties of role "azure_pg_admin" and under Membership tab, add the relevant "xray@{hostname}", click on the checkbox on the tag, save. + +4. Change ownership of Xray database. Right click On the name of the database and change owner to "xray@{hostname}" + +After these steps are done, run Xray deployment. + +## Installation +1. Click "Deploy to Azure" button. If you don't have an Azure subscription, it will guide you on how to signup for a free trial. + +2. Fill out the form. Make sure to use the Artifactory Join key, which you can copy from the Artifactory UI, Security -> Settings -> Connection details + +3. Click Review + Create, then click Create to start the deployment + +4. Once deployment is done, access Xray thru Artifactory UI, Security & Compliance menu + + + + +### Note: +1. This template only supports Xray versions 3.2.x and above. +2. Input values for 'adminUsername' and 'adminPassword' parameters needs to follow azure VM access rules. + +### Steps to upgrade JFrog Xray version + +ARM templates uses a debian installation and you can follow the [official instructions](https://www.jfrog.com/confluence/display/JFROG/Upgrading+Xray#UpgradingXray-InteractiveScriptUpgrade(recommended).1) but for your convenience, you can use this method. + +SSH to the Xray VM and CD to the /opt/ folder. Create an empty file upgrade.sh + +``touch upgrade.sh`` + +Make the file executable: + +```chmod +x upgrade.sh``` + +Open the file + +```vi upgrade.sh``` + +Paste the commands below (check the version of Xray you want to upgrade to): +``` +cd /opt/ +echo "### Stopping Xray service before upgrade ###" +systemctl stop xray.service +XRAY_VERSION=3.6.2 +wget -O jfrog-xray-${XRAY_VERSION}-deb.tar.gz https://api.bintray.com/content/jfrog/jfrog-xray/xray-deb/${XRAY_VERSION}/jfrog-xray-${XRAY_VERSION}-deb.tar.gz?bt_package=jfrog-xray +tar -xvf jfrog-xray-${XRAY_VERSION}-deb.tar.gz +rm jfrog-xray-${XRAY_VERSION}-deb.tar.gz +cd jfrog-xray-${XRAY_VERSION}-deb +echo "### Run Xray installation script ###" +echo "y" | ./install.sh +echo "### Start Xray service ###" +systemctl start xray.service +``` +Run the script + +```./upgrade.sh``` + +The script will upgrade existing 3.x version of Xray to the given version. Check /var/opt/jfrog/xray/console.log to make sure that the service was properly started. Look for the message: +```All services started successfully in 10.743 seconds``` +and check the application version in the log. + diff --git a/AzureResourceManager/Xray/azuredeploy_xray.parameters.json b/AzureResourceManager/Xray/azuredeploy_xray.parameters.json new file mode 100644 index 0000000..7979be9 --- /dev/null +++ b/AzureResourceManager/Xray/azuredeploy_xray.parameters.json @@ -0,0 +1,63 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "clusterName": { + "value": "GEN-UNIQUE" + }, + "adminUsername": { + "value": "GEN-UNIQUE" + }, + "adminPassword": { + "value": "GEN-UNIQUE" + }, + "virtualNetworkName": { + "value": "existing-vm-network-name" + }, + "subnetName": { + "value": "existing-subnet-name" + }, + "virtualNetworkNewOrExisting": { + "value": "existing" + }, + "virtualNetworkAddressPrefix": { + "value": "10.0.0.0/16" + }, + "virtualNetworkResourceGroup": { + "value": "resource-group-name" + }, + "virtualMachineSize": { + "value": "Standard_D4s_v3" + }, + "subnetAddressPrefix": { + "value": "10.0.1.0/24" + }, + "xrayVersion": { + "value": "0.0.4" + }, + "artifactoryURL": { + "value": "http://artifactory-url.cloudapp.azure.com" + }, + "masterKey": { + "value": "GEN-UNIQUE" + }, + "joinKey": { + "value": "GEN-UNIQUE" + }, + "db_type": { + "value": "Postgresql_existing.json" + }, + "db_user": { + "value": "GEN-UNIQUE" + }, + "db_password": { + "value": "GEN-UNIQUE" + }, + "manual_db_url": { + "value": "jdbc:postgresql://postgressrvr.postgres.database.azure.com:5432" + }, + "db_server": { + "value": "postgressrvr" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/azuredeploy_xray_vmss.json b/AzureResourceManager/Xray/azuredeploy_xray_vmss.json new file mode 100644 index 0000000..a495022 --- /dev/null +++ b/AzureResourceManager/Xray/azuredeploy_xray_vmss.json @@ -0,0 +1,401 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "location": { + "type": "string", + "defaultValue": "[resourceGroup().location]", + "metadata": { + "description": "Location for the resources." + } + }, + "clusterName": { + "type": "string", + "defaultValue": "xray", + "maxLength": 61, + "metadata": { + "description": "String used as a base for naming resources. Must be 3-61 characters in length and globally unique across Azure. A hash is prepended to this string for some resources, and resource-specific information is appended." + } + }, + "xrayVersion": { + "type": "string", + "defaultValue": "0.0.4", + "allowedValues": [ + "0.0.3", + "0.0.4" + ], + "metadata": { + "description": "Xray-vm image version to deploy." + } + }, + "artifactoryURL": { + "type": "string", + "metadata": { + "description": "Artifactory URL" + } + }, + "masterKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Master key for Artifactory cluster. Generate master.key using command '$openssl rand -hex 16'" + } + }, + "joinKey": { + "type": "securestring", + "maxLength": 64, + "metadata": { + "description": "Join key for Artifactory cluster. Generate join.key using command '$openssl rand -hex 16'" + } + }, + "adminUsername": { + "type": "string", + "defaultValue": "testadmin", + "metadata": { + "description": "Username for the Virtual Machine." + } + }, + "adminPassword": { + "type": "securestring", + "metadata": { + "description": "Password for the Virtual Machine." + } + }, + "virtualNetworkName": { + "type": "string", + "metadata": { + "description": "New or Existing VNet Name" + } + }, + "virtualNetworkNewOrExisting": { + "type": "string", + "metadata": { + "description": "Boolean indicating whether the VNet is new or existing" + } + }, + "virtualNetworkAddressPrefix": { + "type": "string", + "metadata": { + "description": "VNet address prefix" + } + }, + "virtualNetworkResourceGroup": { + "type": "string", + "metadata": { + "description": "Resource group of the VNet" + } + }, + "virtualMachineSize": { + "type": "string", + "metadata": { + "description": "The size of the VM" + } + }, + "subnetName": { + "type": "string", + "metadata": { + "description": "New or Existing subnet Name" + } + }, + "subnetAddressPrefix": { + "type": "string", + "metadata": { + "description": "Subnet address prefix" + } + }, + "db_type": { + "type": "string", + "defaultValue": "Postgresql_deploy.json", + "allowedValues": [ + "Postgresql_deploy.json", + "Postgresql_existing.json" + ], + "metadata": { + "description": "Deploy new Postgresql, MSSQL or use existing DB" + } + }, + "manual_db_url": { + "type": "string", + "metadata": { + "description": "DB server URL, if existing DB server is used instead of a new deployment (jdbc:sqlserver://.. or jdbc:postgresql://..)" + } + }, + "db_server": { + "type": "string", + "metadata": { + "description": "DB server name, if pre-existing DB is used" + } + }, + "db_user": { + "type": "string", + "minLength": 1, + "metadata": { + "description": "Database Admin user name" + } + }, + "db_password": { + "type": "securestring", + "minLength": 1, + "metadata": { + "description": "Database Admin password" + } + }, + "databases": { + "type": "object", + "defaultValue": { + "properties": [ + { + "name": "xray", + "charset": "UTF8", + "collation": "English_United States.1252" + } + ] + } + }, + "_artifactsLocation": { + "type": "string", + "metadata": { + "description": "The base URI where artifacts required by this template are located. When the template is deployed using the accompanying scripts, a private location in the subscription will be used and this value will be automatically generated." + }, + "defaultValue": "https://raw.githubusercontent.com/jfrog/JFrog-Cloud-Installers/master/AzureResourceManager/Xray/" + }, + "_artifactsLocationSasToken": { + "type": "securestring", + "metadata": { + "description": "The sasToken required to access _artifactsLocation. When the template is deployed using the accompanying scripts, a sasToken will be automatically generated." + }, + "defaultValue": "" + } + }, + "variables": { + "namingInfix": "[toLower(substring(concat(parameters('clusterName'), uniqueString(resourceGroup().id)), 0, 9))]", + "storageAccountName": "[concat(uniquestring(resourceGroup().id), 'sawinvm')]", + "publicIPAddressName": "[concat(uniqueString(resourceGroup().id),'IP')]", + "clusterName": "[parameters('clusterName')]", + "nicName": "[concat(variables('clusterName'),'Nic')]", + "ipConfigName": "[concat(variables('namingInfix'), 'ipconfig')]", + "vnetId": { + "new": "[resourceId('Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]", + "existing": "[resourceId(parameters('virtualNetworkResourceGroup'),'Microsoft.Network/virtualNetworks',parameters('virtualNetworkName'))]" + }, + "subnetId": "[concat(variables('vnetId')[parameters('virtualNetworkNewOrExisting')],'/subnets/',parameters('subnetName'))]", + "publicIPAddressType": "Dynamic", + "db_server": "[parameters('db_server')]", + "db_user": "[concat(parameters('db_user'), '@', parameters('db_server'))]", + "db_password": "[parameters('db_password')]", + "db_location": "[parameters('location')]", + "db_name": "[parameters('databases').properties[0].name]", + "masterKey": "[parameters('masterKey')]", + "joinKey": "[parameters('joinKey')]", + "osType": { + "publisher": "jfrog", + "offer": "x-ray-vm-preview", + "sku": "x-ray-vm", + "version": "[parameters('xrayVersion')]" + }, + "imageReference": "[variables('osType')]", + "dbTemplate": "[parameters('db_type')]", + "dbTemplateLocation": "[uri(parameters('_artifactsLocation'), concat('nested/', variables('dbTemplate'), parameters('_artifactsLocationSasToken')))]", + "artifactoryURL": "[parameters('artifactoryURL')]" + }, + "resources": [ + { + "apiVersion": "2019-05-01", + "name": "pid-04c1c376-5d4b-4771-9a7f-054f5910dcef", + "type": "Microsoft.Resources/deployments", + "properties": { + "mode": "Incremental", + "template": { + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "resources": [] + } + } + }, + { + "condition": "[equals(parameters('virtualNetworkNewOrExisting'),'new')]", + "type": "Microsoft.Network/virtualNetworks", + "apiVersion": "2020-05-01", + "name": "[parameters('virtualNetworkName')]", + "location": "[parameters('location')]", + "properties": { + "addressSpace": { + "addressPrefixes": [ + "[parameters('virtualNetworkAddressPrefix')]" + ] + }, + "subnets": [ + { + "name": "[parameters('subnetName')]", + "properties": { + "addressPrefix": "[parameters('subnetAddressPrefix')]" + } + } + ] + } + }, + { + "type": "Microsoft.Network/publicIPAddresses", + "name": "[variables('publicIPAddressName')]", + "apiVersion": "2020-05-01", + "location": "[parameters('location')]", + "properties": { + "publicIPAllocationMethod": "[variables('publicIPAddressType')]" + } + }, + { + "type": "Microsoft.Network/networkInterfaces", + "name": "[variables('nicName')]", + "apiVersion": "2020-05-01", + "location": "[parameters('location')]", + "properties": { + "ipConfigurations": [ + { + "name": "ipconfig1", + "properties": { + "privateIPAllocationMethod": "Dynamic", + "publicIPAddress": { + "id": "[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]" + }, + "subnet": { + "id": "[variables('subnetId')]" + } + } + } + ], + "enableIPForwarding": true + }, + "dependsOn": [ + "[resourceId('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]", + "[resourceId('Microsoft.Network/virtualNetworks/', parameters('virtualNetworkName'))]" + ] + }, + { + "type": "Microsoft.Storage/storageAccounts", + "apiVersion": "2018-11-01", + "name": "[variables('storageAccountName')]", + "location": "[parameters('location')]", + "sku": { + "name": "Standard_LRS" + }, + "kind": "Storage", + "properties": {} + }, + { + "type": "Microsoft.Resources/deployments", + "name": "deploySQLDB", + "apiVersion": "2019-09-01", + "properties": { + "mode": "Incremental", + "templateLink": { + "uri": "[variables('dbTemplateLocation')]", + "contentVersion": "1.0.0.0" + }, + "parameters": { + "db_user": { + "value": "[parameters('db_user')]" + }, + "db_password": { + "value": "[variables('db_password')]" + }, + "db_server": { + "value": "[variables('db_server')]" + }, + "db_location": { + "value": "[variables('db_location')]" + }, + "databases": { + "value": "[parameters('databases')]" + }, + "manual_db_url": { + "value": "[parameters('manual_db_url')]" + } + } + } + }, + { + "type": "Microsoft.Compute/virtualMachineScaleSets", + "name": "[concat(variables('namingInfix'), 'xrayScaleset')]", + "location": "[parameters('location')]", + "apiVersion": "2018-10-01", + "dependsOn": [ + "[resourceId('Microsoft.Storage/storageAccounts/', variables('storageAccountName'))]", + "[resourceId('Microsoft.Network/networkInterfaces/', variables('nicName'))]" + ], + "plan": { + "name": "x-ray-vm", + "publisher": "jfrog", + "product": "x-ray-vm-preview" + }, + "sku": { + "name": "[parameters('virtualMachineSize')]", + "tier": "Standard", + "capacity": 1 + }, + "properties": { + "singlePlacementGroup": true, + "overprovision": false, + "upgradePolicy": { + "mode": "Manual" + }, + "virtualMachineProfile": { + "storageProfile": { + "osDisk": { + "caching": "ReadWrite", + "diskSizeGB": 250, + "createOption": "FromImage" + }, + "imageReference": "[variables('imageReference')]" + }, + "osProfile": { + "computerNamePrefix": "[variables('namingInfix')]", + "adminUsername": "[parameters('adminUsername')]", + "adminPassword": "[parameters('adminPassword')]", + "customData": "[base64(concat('#INSTALL SCRIPT INPUTS\nXRAY_VERSION=', parameters('xrayVersion'),'\nARTIFACTORY_URL=',variables('artifactoryURL'),'\nDB_SERVER=',variables('db_server'),'\nDB_NAME=',variables('db_name'),'\nDB_ADMIN_USER=',variables('db_user'),'\nDB_ADMIN_PASSWD=',variables('db_password'),'\nMASTER_KEY=',variables('masterKey'),'\nJOIN_KEY=',variables('joinKey'),'\n'))]" + }, + "networkProfile": { + "networkInterfaceConfigurations": [ + { + "name": "[variables('nicName')]", + "properties": { + "primary": true, + "ipConfigurations": [ + { + "name": "[concat(variables('ipConfigName'),'1')]", + "properties": { + "subnet": { + "id": "[variables('subnetId')]" + } + } + } + ] + } + } + ] + }, + "extensionProfile": { + "extensions": [ + { + "name": "extension1", + "properties": { + "publisher": "Microsoft.Azure.Extensions", + "type": "CustomScript", + "typeHandlerVersion": "2.0", + "autoUpgradeMinorVersion": false, + "settings": { + "fileUris": [ + "[uri(parameters('_artifactsLocation'), concat('scripts/install_xray.sh', parameters('_artifactsLocationSasToken')))]" + ] + }, + "protectedSettings": { + "commandToExecute": "./install_xray.sh >> /opt/installation_log1.txt" + } + } + } + ] + } + } + } + } + ] +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/nested/Postgresql_deploy.json b/AzureResourceManager/Xray/nested/Postgresql_deploy.json new file mode 100644 index 0000000..4f6d8ce --- /dev/null +++ b/AzureResourceManager/Xray/nested/Postgresql_deploy.json @@ -0,0 +1,161 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "xray", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "skuCapacity": { + "type": "int", + "defaultValue": 2 + }, + "skuFamily": { + "type": "string", + "defaultValue": "Gen5" + }, + "skuName": { + "type": "string", + "defaultValue": "GP_Gen5_2" + }, + "skuSizeMB": { + "type": "int", + "defaultValue": 5120 + }, + "skuTier": { + "type": "string", + "defaultValue": "GeneralPurpose" + }, + "version": { + "type": "string", + "defaultValue": "9.6" + }, + "backupRetentionDays": { + "type": "int", + "defaultValue": 7 + }, + "geoRedundantBackup": { + "type": "string", + "defaultValue": "Disabled" + }, + "databases": { + "type": "object" + }, + "sslEnforcement": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Disabled", + "metadata": { + "description": "SSL Enforcement" + } + }, + "publicNetworkAccess": { + "type": "string", + "allowedValues": [ + "Enabled", + "Disabled" + ], + "defaultValue": "Enabled", + "metadata": { + "description": "Public Network Access" + } + }, + "db_edition": { + "type": "string", + "defaultValue": "Basic", + "allowedValues": [ + "Basic", + "Standard", + "Premium" + ] + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + { + "type": "Microsoft.DBforPostgreSQL/servers", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "name": "[parameters('db_server')]", + "properties": { + "version": "[parameters('version')]", + "administratorLogin": "[parameters('db_user')]", + "administratorLoginPassword": "[parameters('db_password')]", + "publicNetworkAccess": "[parameters('publicNetworkAccess')]", + "sslEnforcement": "[parameters('sslEnforcement')]", + "storageProfile": { + "storageMB": "[parameters('skuSizeMB')]", + "backupRetentionDays": "[parameters('backupRetentionDays')]", + "geoRedundantBackup": "[parameters('geoRedundantBackup')]" + } + }, + "sku": { + "name": "[parameters('skuName')]", + "tier": "[parameters('skuTier')]", + "capacity": "[parameters('skuCapacity')]", + "size": "[parameters('skuSizeMB')]", + "family": "[parameters('skuFamily')]" + }, + "resources": [ + { + "name": "[uniqueString(parameters('db_server'), 'AllowAllWindowsAzureIps' )]", + "type": "firewallRules", + "apiVersion": "2017-12-01", + "location": "[parameters('db_location')]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "startIpAddress": "0.0.0.0", + "endIpAddress": "0.0.0.0" + } + }, + { + "type": "Microsoft.DBforPostgreSQL/servers/databases", + "apiversion": "2017-12-01", + "name": "[concat(parameters('db_server'), '/', parameters('databases').properties[0].name)]", + "dependsOn": [ + "[resourceId('Microsoft.DBforPostgreSQL/servers', parameters('db_server'))]" + ], + "properties": { + "charset": "[parameters('databases').properties[0].charset]", + "collation": "[parameters('databases').properties[0].collation]" + } + } + ] + } + ], + "outputs": { + "dbServerName": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_edition": { + "type": "string", + "value": "[parameters('db_edition')]" + }, + "manual_db_url": { + "type": "string", + "value": "[parameters('manual_db_url')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/nested/Postgresql_existing.json b/AzureResourceManager/Xray/nested/Postgresql_existing.json new file mode 100644 index 0000000..6e8be3a --- /dev/null +++ b/AzureResourceManager/Xray/nested/Postgresql_existing.json @@ -0,0 +1,54 @@ +{ + "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#", + "contentVersion": "1.0.0.0", + "parameters": { + "db_user": { + "type": "string", + "defaultValue": "artifactory", + "minLength": 1 + }, + "db_password": { + "type": "securestring" + }, + "db_server": { + "type": "string", + "defaultValue": "xraypostgressrv", + "minLength": 1 + }, + "db_location": { + "type": "string" + }, + "databases": { + "type": "object" + }, + "manual_db_url": { + "type": "string" + } + }, + "variables": { + }, + "resources": [ + ], + "outputs": { + "jdbcConnString": { + "type": "string", + "value": "[parameters('manual_db_url')]" + }, + "db_user": { + "type": "string", + "value": "[parameters('db_user')]" + }, + "db_server": { + "type": "string", + "value": "[parameters('db_server')]" + }, + "db_location": { + "type": "string", + "value": "[parameters('db_location')]" + }, + "databases": { + "type": "object", + "value": "[parameters('databases')]" + } + } +} \ No newline at end of file diff --git a/AzureResourceManager/Xray/scripts/install_xray.sh b/AzureResourceManager/Xray/scripts/install_xray.sh new file mode 100644 index 0000000..95db4a2 --- /dev/null +++ b/AzureResourceManager/Xray/scripts/install_xray.sh @@ -0,0 +1,40 @@ +#!/bin/bash +DB_NAME=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_NAME=" | sed "s/DB_NAME=//") +DB_USER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_USER=" | sed "s/DB_ADMIN_USER=//") +DB_PASSWORD=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_ADMIN_PASSWD=" | sed "s/DB_ADMIN_PASSWD=//") +DB_SERVER=$(cat /var/lib/cloud/instance/user-data.txt | grep "^DB_SERVER=" | sed "s/DB_SERVER=//") +MASTER_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^MASTER_KEY=" | sed "s/MASTER_KEY=//") +JOIN_KEY=$(cat /var/lib/cloud/instance/user-data.txt | grep "^JOIN_KEY=" | sed "s/JOIN_KEY=//") +ARTIFACTORY_URL=$(cat /var/lib/cloud/instance/user-data.txt | grep "^ARTIFACTORY_URL=" | sed "s/ARTIFACTORY_URL=//") + +export DEBIAN_FRONTEND=noninteractive + +sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys CC86BB64 +sudo add-apt-repository ppa:rmescandon/yq -y +sudo apt update -y +sudo apt install yq -y + +# Create master.key on each node +sudo mkdir -p /opt/jfrog/xray/var/etc/security/ +cat </opt/jfrog/xray/var/etc/security/master.key +${MASTER_KEY} +EOF + +# Xray should have the same join key as the Artifactory instance +# Both application should be deployed in the same Virtual Networks +HOSTNAME=$(hostname -i) +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.url postgres://${DB_SERVER}.postgres.database.azure.com:5432/${DB_NAME}?sslmode=disable +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.username ${DB_USER} +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.database.password ${DB_PASSWORD} +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.rabbitMq.password JFXR_RABBITMQ_COOKIE +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.jfrogUrl ${ARTIFACTORY_URL} +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.security.joinKey ${JOIN_KEY} +yq w -i /var/opt/jfrog/xray/etc/system.yaml shared.node.ip ${HOSTNAME} + +chown xray:xray -R /opt/jfrog/xray/var/etc/security/* && chown xray:xray -R /opt/jfrog/xray/var/etc/security/ + + +# Enable and start Xray service +sudo systemctl enable xray.service +sudo systemctl start xray.service +sudo systemctl restart xray.service diff --git a/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh b/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh new file mode 100644 index 0000000..6827c90 --- /dev/null +++ b/AzureResourceManager/Xray/vm_install/install_xray_to_vm.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# Upgrade version for every release +XRAY_VERSION=3.8.2 + +export DEBIAN_FRONTEND=noninteractive + +apt-get update -y +apt-get upgrade -y + +# Download Xray +cd /opt/ +wget -O jfrog-xray-${XRAY_VERSION}-deb.tar.gz 'https://bintray.com/jfrog/jfrog-xray/download_file?agree=true&artifactPath=/jfrog/jfrog-xray/xray-deb/'${XRAY_VERSION}'/jfrog-xray-'${XRAY_VERSION}'-deb.tar.gz&callback_id=&product=org.grails.taglib.NamespacedTagDispatcher' \ +>> /var/log/download-xray.log 2>&1 +tar -xvf jfrog-xray-${XRAY_VERSION}-deb.tar.gz +rm jfrog-xray-${XRAY_VERSION}-deb.tar.gz +cd jfrog-xray-${XRAY_VERSION}-deb + +# Generate txt file with the parameters to use in the interactive installation script +cat </opt/jfrog-xray-${XRAY_VERSION}-deb/input.txt +/var/opt/jfrog/xray +http:// +Y +EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE +replace_with_host_ip +N +n +postgres://{postgres_server_name}.postgres.database.azure.com:5432/xray?sslmode=disable +xray@postgres_server_name +password +EOF + +# Run interactive installation script with default parameters +cat "/opt/jfrog-xray-${XRAY_VERSION}-deb/input.txt" | ./install.sh >> /var/log/install-xray.log 2>&1 + +# Add Callhome to the Xray instance +cat <>/opt/jfrog/xray/app/bin/xray.default +export PARTNER_ID=Partner/ACC-007221 +export INTEGRATION_NAME=ARM_xray/1.0.0 +EOF + +# Remove Xray service from boot up run +sudo systemctl disable xray.service \ No newline at end of file diff --git a/AzureResourceManager/azuredeploy.parameters.json b/AzureResourceManager/azuredeploy.parameters.json deleted file mode 100644 index e5c9929..0000000 --- a/AzureResourceManager/azuredeploy.parameters.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentParameters.json#", - "contentVersion": "1.0.0.0", - "parameters": { - "clusterName": { - "value": "GEN-UNIQUE" - }, - "adminUsername": { - "value": "GEN-UNIQUE" - }, - "adminPassword": { - "value": "GEN-PASSWORD" - }, - "DB_Admin_User": { - "value": "GEN-UNIQUE" - }, - "DB_Admin_Password": { - "value": "GEN-PASSWORD" - }, - "DB_Name": { - "value": "GEN-UNIQUE" - }, - "masterKey": { - "value": "35767fa0164bac66b6cccb8880babefb" - }, - "joinKey": { - "value": "3143bf2aa4db9c00077e0443c84d252e" - }, - "artifactoryLicense1": { - "value": "GEN-UNIQUE" - }, - "artifactoryLicense2": { - "value": "GEN-UNIQUE" - }, - "artifactoryLicense3": { - "value": "GEN-UNIQUE" - } - } -} \ No newline at end of file diff --git a/ansible.cfg b/ansible.cfg index f0524a4..3d08974 100644 --- a/ansible.cfg +++ b/ansible.cfg @@ -3,7 +3,7 @@ collections_paths = ~/.ansible/collections:/usr/share/ansible/collections:collection # Installs roles into [current dir]/roles/namespace.rolename -roles_path = Ansible/collection/jfrog/ansible/roles +roles_path = Ansible/ansible_collections/jfrog/installers/roles host_key_checking = false