Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Add support for developer/enterprise edition #43

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,11 @@ Available variables along with default values are listed below (see `defaults/ma
# Paths to temporary files
sonar_temp_dir: "{{ sonar_base_dir }}/temp"

# SonarQube edition to install
sonar_edition: community
# sonar_edition: developer
# sonar_edition: enterprise

# SonarQube version to install
sonar_version: 5.6.7

Expand Down
5 changes: 5 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ sonar_data_dir: "{{ sonar_base_dir }}/data"
# Paths to temporary files
sonar_temp_dir: "{{ sonar_base_dir }}/temp"

# SonarQube edition to install
sonar_edition: community
# sonar_edition: developer
# sonar_edition: enterprise

# SonarQube version to install
sonar_version: 7.3

Expand Down
2 changes: 2 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
# tasks file for ansible-role-sonarqube/

- include_tasks: validate_configuration.yaml

- name: "Create SonarQube system group"
group:
name: "{{ sonar_group }}"
Expand Down
7 changes: 4 additions & 3 deletions tasks/setup_prepare.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
---

- name: "Overwrite SonarQube download url"
- name: "Overwrite SonarQube download url for community edition"
set_fact:
sonar_download_url: "{{ __sonar_download_url }}"
when: sonar_download_url is not defined
sonar_download_url: "{{ __sonar_download_url[sonar_edition] }}"
when:
- sonar_download_url is not defined

- name: "Overwrite SonarQube plugin base url"
set_fact:
Expand Down
7 changes: 7 additions & 0 deletions tasks/validate_configuration.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

- name: Validate sonar_edition
assert:
that:
- sonar_edition in __sonar_download_url
fail_msg: "'sonar_edition' must be one of 'community', 'developer', 'enterprise'"
13 changes: 10 additions & 3 deletions vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,15 @@
__sonarsource_url: "https://binaries.sonarsource.com"
__sonar_marketplace_url: "https://update.sonarsource.org"
__sonar_distribution_url: "{{ __sonarsource_url }}/Distribution"
__sonar_archive: "sonarqube-{{ sonar_version }}.zip"
__sonar_download_url: "{{ __sonar_distribution_url }}/sonarqube/{{ __sonar_archive }}"
__sonar_commercial_distribution_url: "{{ __sonarsource_url }}/CommercialDistribution"
__sonar_archive:
community: "sonarqube-{{ sonar_version }}.zip"
developer: "sonarqube-developer-{{ sonar_version }}.zip"
enterprise: "sonarqube-enterprise-{{ sonar_version }}.zip"
__sonar_download_url:
community: "{{ __sonar_distribution_url }}/sonarqube/{{ __sonar_archive['community'] }}"
developer: "{{ __sonar_commercial_distribution_url }}/sonarqube-developer/{{ __sonar_archive['developer'] }}"
enterprise: "{{ __sonar_commercial_distribution_url }}/sonarqube-enterprise/{{ __sonar_archive['enterprise'] }}"
__sonar_plugin_home: "{{ sonar_base_dir }}/extensions/plugins"
__sonar_plugin_baseurl: "{{ __sonar_distribution_url }}"
__sonar_commercial_plugin_baseurl: "{{ __sonarsource_url }}/CommercialDistribution"
__sonar_commercial_plugin_baseurl: "{{ __sonar_commercial_distribution_url }}"