Giter VIP home page Giter VIP logo

ansible-role-sonar's Introduction

Ansible Role: SonarQube

Build Status

DEPRECATED: This role is no longer actively maintained. It may still work, but I have marked it as 'deprecated' on Ansible Galaxy, and recommend you find a new role to replace it, or fork it and use your fork.

An Ansible Role that installs SonarQube on RedHat/CentOS and Debian/Ubuntu Linux servers.

Requirements

Requires the unzip utility to be installed on the server. Also, different SonarQube versions require different minimum versions of Java:

  • SonarQube 5.0-5.5 requires Java 1.7+
  • SonarQube 5.6+ requires Java 1.8+

Finally, recent versions of SonarQube also require MySQL 5.6 or later.

Role Variables

Available variables are listed below, along with default values:

workspace: /root

Directory where downloaded files will be temporarily stored.

sonar_download_validate_certs: true

Controls whether to validate certificates when downloading SonarQube.

sonar_download_url: http://dist.sonar.codehaus.org/sonarqube-4.5.4.zip
sonar_version_directory: sonarqube-4.5.4

The URL from which SonarQube will be downloaded, and the resulting directory name (should match the download archive, without the archive extension).

sonar_web_context: ''

The value of sonar.web.context. Setting this to something like /sonar allows you to set the context where Sonar can be accessed (e.g. hostname/sonar instead of hostname).

sonar_mysql_username: sonar
sonar_mysql_password: sonar

sonar_mysql_host: localhost
sonar_mysql_port: "3306"
sonar_mysql_database: sonar

sonar_mysql_allowed_hosts:
  - 127.0.0.1
  - ::1
  - localhost

JDBC settings for a connection to a MySQL database. Defaults presume the database resides on localhost and is only accessible on the SonarQube server itself.

Dependencies

  • geerlingguy.java
  • geerlingguy.mysql

Example Playbook

- hosts: all
  roles:
    - geerlingguy.sonar

Using the defaults, you can view the SonarQube home at http://localhost:9000/ (default System administrator credentials are admin/admin).

License

MIT / BSD

Author Information

This role was created in 2014 by Jeff Geerling, author of Ansible for DevOps.

ansible-role-sonar's People

Contributors

geerlingguy avatar xavierbourguignon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-sonar's Issues

Support for postgres

Hi,

I wonder if a MR adding support for postgesql with geerlinguy.postgresql role would be accepted. The idea is to have both mysql and postgres dependencies and set a variable to use one or another database backend.

Regards.

Ansible 2.0 linting - fix 'Unzip sonar' task.

See the output from 2.0.0:

TASK [geerlingguy.sonar : Unzip Sonar.] ****************************************
changed: [sonarqube]
 [WARNING]: Consider using unarchive module rather than running unzip

Sonar runs as root.

Hi,

Thanks for this role, a real timesaver.
I never run services like this as root (and it seems your other roles like Jenkins don't do this either)
I've gone ahead and forked the role, made a change and tested it locally in a feature branch.
Would you be interested in my pull request that changes this to a configurable user? Fixed by #6

Installing SonarQube fails when unzip is not installed

Thanks a lot for your role!
A minor glitch:

TASK: [geerlingguy.sonar | Unzip Sonar.] ************************************** 
failed: [debian-cd-server] => {"changed": true, "cmd": "unzip -o /root/sonar-3.7.4.zip", "delta": "0:00:00.015357", "end": "2015-01-08 17:21:45.906189", "rc": 127, "start": "2015-01-08 17:21:45.890832", "warnings": ["Consider using unarchive module rather than running unzip"]}
stderr: /bin/sh: 1: unzip: not found

It would be convenient if the role wouldn't rely on unzip being installed on the host.

Thanks!

Make web settings configurable again

The following settings are no longer configurable after the changes were made to support the latest LTS release of SonarQube in #2. I'd like to make them easily configurable again (so downstream playbooks don't have to add their own lineinfile tasks to configure them).

sonar_web_host: ""
sonar_web_port: ""
sonar_web_port_https: ""
sonar_web_context: ""

Default install fails mysql login

Just tried this recently:

This is run from ubuntu 14, via vagrant so it was a clean install of mysql using the mysql role. /root/.my.cfg has root:root entry, and I can get in there with mysql -u root -p root

Deleting .my.cnf does not work

failed: [localhost] (item=DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')) => {"changed": false, "cmd": ["mysql", "-NBe", "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')"], "delta": "0:00:00.005109", "end": "2017-01-20 04:08:58.633002", "failed": true, "item": "DELETE FROM mysql.user WHERE User='root' AND Host NOT IN ('localhost', '127.0.0.1', '::1')", "rc": 1, "start": "2017-01-20 04:08:58.627893", "stderr": "ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)", "stdout": "", "stdout_lines": [], "warnings": []}

Permissions on sonar.service

I launch this ansible role, so I have checked the log file and get this misconfiguration.

May 20 01:53:55 sonar systemd[1]: Configuration file /etc/systemd/system/sonar.service is marked executable. Please remove
May 20 01:53:55 sonar systemd[1]: Started SonarQube.

https://unix.stackexchange.com/questions/433886/what-are-the-correct-permissions-for-a-systemd-service

It is possible to remove this warning changing the permissions on this subtask:

  • name: Copy SonarQube systemd unit file into place (for systemd systems).
    template:
    src: sonar.unit.j2
    dest: /etc/systemd/system/sonar.service
    owner: root
    group: root
    mode: 0744
    when: "ansible_service_mgr == 'systemd'"

insserv: warning: script 'S99runlcactivator' missing LSB tags and overrides insserv: warning: script 'runlcactivator' missing LSB tags and overrides insserv: There is a loop at service plymouth if started insserv: There is a loop between service plymouth and procps if started insserv: loop involving service procps at depth 2

etting up util-linux (2.27.1-6ubuntu3.2) ...
insserv: warning: script 'S99runlcactivator' missing LSB tags and overrides
insserv: warning: script 'runlcactivator' missing LSB tags and overrides
insserv: There is a loop at service plymouth if started
insserv: There is a loop between service plymouth and procps if started
insserv: loop involving service procps at depth 2
insserv: loop involving service udev at depth 1
insserv: There is a loop at service runlcactivator if started
insserv: There is a loop between service runlcactivator and hwclock if started
insserv: loop involving service hwclock at depth 1
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Max recursions depth 99 reached insserv: loop involving service bluetooth at depth 1 insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: There is a loop between service plymouth and urandom if started insserv: loop involving service urandom at depth 4 insserv: loop involving service mountdevsubfs at depth 2 insserv: There is a loop between service runlcactivator and udev if started insserv: loop involving service mountkernfs at depth 1 insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true! insserv: Starting runlcactivator depends on plymouth and therefore on system facility $all' which can not be true!
insserv: There is a loop between service runlcactivator and dns-clean if started
insserv: loop involving service dns-clean at depth 1
insserv: Starting runlcactivator depends on plymouth and therefore on system facility `$all' which can not be true!
insserv: exiting now without changing boot order!
update-rc.d: error: insserv rejected the script header
dpkg: error processing package util-linux (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
util-linux
E: Sub-process /usr/bin/dpkg returned an error code (1)
pulkit@hp:~$

Download Certificate_Verify_Failed

On my sandbox Debian GNU/Linux 8.4 (jessie), I am stuck with this error message:

TASK [geerlingguy.sonar : Download Sonar.] *************************************
fatal: [sandbox-sonar]: FAILED! => {"changed": false, "dest": "/root/sonarqube-4.5.6.zip", "failed": true, "msg": "Request failed", "response": "Request failed: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)>", "state": "absent", "status_code": -1, "url": "https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-4.5.6.zip"}

I tried and succeed with wget https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-4.5.6.zip
I am a bit confused with this, I beg your pardon I cannot help on this.

CI tests have multiple failures currently

See: https://travis-ci.org/geerlingguy/ansible-role-sonar/builds/653934193

Ubuntu 18.04:

TASK [geerlingguy.sonar : Make sure Sonar is responding on the configured port.] ***
fatal: [instance]: FAILED! => {"changed": false, "elapsed": 300, "msg": "Timeout when waiting for 127.0.0.1:9000"}

CentOS 7:

TASK [geerlingguy.mysql : Ensure MySQL is started and enabled on boot.] ********

No output has been received in the last 10m0s, this potentially indicates a stalled build or something wrong with the build itself.
Check the details on how to adjust your build configuration on: https://docs.travis-ci.com/user/common-build-problems/#build-times-out-because-no-output-was-received

The build has been terminated

service sonar cannot start by ansible task on CentOS 7

This role works well on Debian. But on CentOS 7, failed.

TASK [geerlingguy.sonar : Ensure Sonar is running and set to start on boot.] ***
fatal: [target1]: FAILED! => {"changed": false, "failed": true, "msg": "systemd could not find the requested service "'sonar'": "}

NO MORE HOSTS LEFT *************************************************************
to retry, use: --limit @site.retry

default sonar download URL is invalid now, then generate invalid sonarqube-4.5.5.zip

Now sonarqube dist URL http://dist.sonar.codehaus.org/ would redirect to http://downloads.sonarsource.com/sonarqube/. So http://dist.sonar.codehaus.org/sonarqube-4.5.5.zip is invalid. But ansible task still generate one sonarqube-4.5.5.zip and put it under directory /root/. Then unzip task would be failed.

TASK [geerlingguy.sonar : Unzip Sonar.] ****************************************

fatal: [target1]: FAILED! => {"changed": false, "failed": true, "msg": "Failed t
o find handler for "/root/sonarqube-4.5.5.zip". Make sure the required command
to extract the file is installed.", "stat": {"exists": false}}

The error message seems that the root cause is extract command is not installed. It tricks users.

So update the variable default value is necessary.

insserv: missing LSB tags and overrides

On my sandbox Debian GNU/Linux 8.4 (jessie), I am stuck with this error message:

TASK [geerlingguy.sonar : Ensure Sonar is running and set to start on boot.] ***
fatal: [sandbox-sonar]: FAILED! => {"changed": false, "failed": true, "msg": "Error when trying to enable sonar: rc=1 Synchronizing state for sonar.service with sysvinit using update-rc.d...\nExecuting /usr/sbin/update-rc.d sonar defaults\ninsserv: warning: script 'sonar' missing LSB tags and overrides\nExecuting /usr/sbin/update-rc.d sonar enable\nupdate-rc.d: error: sonar Default-Start contains no runlevels, aborting.\n"}

this is due to the lack of the header below in the /etc/init.d/sonar (the script you link actually):

### BEGIN INIT INFO
# Provides:          scriptname
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: Start daemon at boot time
# Description:       Enable service provided by daemon.
### END INIT INFO

I am not quite sure of the best workaround. I prefer to insert these lines if they are missing just after the #!/bin/bash, instead of a replacement static file.

Source: https://wiki.debian.org/LSBInitScripts

Is this project abandonned?

Hi!

I just willing to know if the project's maintainer is accepting PRs or suggestions for features since there is some PRs with very nice proposals still waiting for approval after some time.

I wonder if @geerlingguy have the time to look into it or if he's looking for contributors to maintain this repo. This is such a nice project, so it's bad to see contributions going nowhere.

Thanks!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.