Open jdhanasekar opened 5 years ago
Hi! Thanks for filling this issue. I'll take a closer look late this week. If you already have figured out a fix, I'll gladly merge your PR. :)
Hi Ricardo Zanini,
Thanks for your reply. I am debugging the issue, If I
fixed the issue, I will inform you.
Thanks, Dhanasekar
On Mon, Jul 15, 2019 at 8:58 PM Ricardo Zanini notifications@github.com wrote:
Hi! Thanks for filling this issue. I'll take a closer look late this week. If you already have figured out a fix, I'll gladly merge your PR. :)
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ricardozanini/vagrant-alm/issues/8?email_source=notifications&email_token=AMHB6B7JQ2IKBGBO6WOOW4TP7SJRDA5CNFSM4ICAORW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODZ6BWWY#issuecomment-511449947, or mute the thread https://github.com/notifications/unsubscribe-auth/AMHB6B7FZ4QZAQ2YZD7HCP3P7SJRDANCNFSM4ICAORWQ .
We can try to upgrade the Sonar version. If you have the time, please let me know the outcomes.
I am new Ansible automation project. How much time will it take?. I am keen to help you.
On Tue, Jul 16, 2019 at 4:53 PM Ricardo Zanini notifications@github.com wrote:
We can try to upgrade the Sonar version. If you have the time, please let me know the outcomes.
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ricardozanini/vagrant-alm/issues/8?email_source=notifications&email_token=AMHB6B4CLNMUCGFFVSLOBI3P7WVSHA5CNFSM4ICAORW2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOD2ARIQA#issuecomment-511775808, or mute the thread https://github.com/notifications/unsubscribe-auth/AMHB6BZEADW2KV5D3JTLSQLP7WVSHANCNFSM4ICAORWQ .
It's been a long time since I touched this project, but I guess that it's just a small change in the Sonar vagrant section to upgrade the version to the last one: https://github.com/ricardozanini/vagrant-alm/blob/master/ansible/roles/zanini.sonar/defaults/main.yml#L6
Or you can just replace the zanini.sonar
for other role. :)
vagrant-alm project playbook using this lean_delivery.sonarqube
for sonar. I am not seeing zanini.sonar
or geerlingguy.sonar
in alm.yml file. So, I need to added zanini.sonar
under Deploy Sonar Server
task.
Please Correct me, I am wrong.
Yes, that's it.
After adding zanini.sonar
in alm.yml playbook file,
- name: Deploy Sonar Server
hosts: sonar_server
remote_user: "{{ ansible_ssh_user | default('vagrant') }}"
become: yes
# added by dhanasekar start
vars:
ssl_certs_common_name: "{{ ansible_fqdn }}"
# added by dhanasekar end
pre_tasks:
- name: "install epel"
package:
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
state: "present"
when: ansible_distribution == 'RedHat'
# delete plugins installed on previous run to prevent conflict in case if any plugin is updated
- name: "delete plugins"
file:
path: "{{ sonar_path }}/sonarqube-{{ sonar_major_version }}.{{ sonar_minor_version }}/extensions/plugins"
state: absent
roles:
# - role: geerlingguy.java #commneted by dhanasekar
- role: /home/user/.ansible/roles/geerlingguy.java
- role: /home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar
I am getting below build error,
TASK [/home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar : Download Sonar.] ***
task path: /home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar/tasks/main.yml:2
fatal: [sonar_box]: FAILED! => {"changed": false, "dest": "/root/sonarqube-4.5.6.zip", "elapsed": 2, "msg": "Request failed", "response": "HTTP Error 404: Not Found", "status_code": 404, "url": "https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-4.5.6.zip"}
RUNNING HANDLER [ANXS.postgresql : restart postgresql] *************************
task path: /root/.ansible/roles/ANXS.postgresql/handlers/main.yml:3
PLAY RECAP *********************************************************************
sonar_box : ok=30 changed=10 unreachable=0 failed=1 skipped=30 rescued=0 ignored=0
Ansible failed to complete successfully. Any error output should be
visible above. Please fix these errors and try again.
That's because this version is too old. You have to upgrade it to a newer one.
This is my content of /home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar/defaults/main.yml
---
workspace: /root
sonar_download_validate_certs: yes
# Default to the latest LTS release.
sonar_version: 4.5.6
sonar_download_url: "https://sonarsource.bintray.com/Distribution/sonarqube/sonarqube-{{ sonar_version }}.zip"
sonar_version_directory: "sonarqube-{{ sonar_version }}"
sonar_web_context: ''
# The Database engine.
# possible values: postgres and mysql
sonar_database_engine: postgres
# Database connection details
sonar_database_username: sonar
sonar_database_password: sonar
sonar_database_host: localhost
# mysqlsql default port is 3306 and the postgres' is 5432
sonar_database_port: "5432"
sonar_database_name: sonar
# MySQL database connection details.
sonar_mysql_allowed_hosts:
- "127.0.0.1"
- "::1"
- "localhost"
My file has sonar version as 4.5.6
. This is not latest version?.
Hmm no, I guess not. They're in 7.x: https://www.sonarqube.org/downloads/
:(
Because of using your zanini.sonar
role in playbook, I have removed nginxinc.nginx
and lean_delivery.sonarqube
.
Am I correct ?
I have removed nginxinc.nginx
and lean_delivery.sonarqube
role, using your zanini.sonar
in alm.yml like below,
- name: Deploy Sonar Server
hosts: sonar_server
remote_user: "{{ ansible_ssh_user | default('vagrant') }}"
become: yes
# added by dhanasekar start
vars:
ssl_certs_common_name: "{{ ansible_fqdn }}"
# added by dhanasekar end
pre_tasks:
- name: "install epel"
package:
name: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
state: "present"
when: ansible_distribution == 'RedHat'
# delete plugins installed on previous run to prevent conflict in case if any plugin is updated
- name: "delete plugins"
file:
path: "{{ sonar_path }}/sonarqube-{{ sonar_major_version }}.{{ sonar_minor_version }}/extensions/plugins"
state: absent
roles:
# - role: geerlingguy.java #commneted by dhanasekar
- role: /home/user/.ansible/roles/geerlingguy.java
# - role: /home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar
- role: ANXS.postgresql
postgresql_users:
- name: sonar
pass: sonar
postgresql_databases:
- name: sonar
owner: sonar
# - role: /home/user/.ansible/roles/nginxinc.nginx
# - role: /home/user/.ansible/roles/lean_delivery.sonarqube
- role: /home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar
After that , I am getting below issue. It seems zanini.sonar
calling geerlingguy.postgresql
which is throwing error,
TASK [geerlingguy.postgresql : Ensure PostgreSQL database is initialized.] *****
task path: /root/.ansible/roles/geerlingguy.postgresql/tasks/initialize.yml:22
fatal: [sonar_box]: FAILED! => {"changed": false, "cmd": "/usr/bin/initdb -D /var/lib/pgsql/data", "msg": "[Errno 2] No such file or directory", "rc": 2}
RUNNING HANDLER [geerlingguy.postgresql : restart postgresql] ******************
task path: /root/.ansible/roles/geerlingguy.postgresql/handlers/main.yml:2
PLAY RECAP *********************************************************************
sonar_box : ok=50 changed=19 unreachable=0 failed=1 skipped=69 rescued=0 ignored=0
After commenting ANXS.postgresql
role and I can able to download latest version sonar. But, I am getting below error, lt seems ansible looking for handler to unzip the downloaded image,
TASK [/home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar : Unzip Sonar.] ***
task path: /home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar/tasks/main.yml:8
fatal: [sonar_box]: FAILED! => {"changed": false, "msg": "Failed to find handler for \"/root/sonarqube-7.9.1.zip\". Make sure the required command to extract the file is installed. Command \"unzip\" not found. Command \"/bin/gtar\" could not handle archive."}
RUNNING HANDLER [geerlingguy.postgresql : restart postgresql] ******************
task path: /root/.ansible/roles/geerlingguy.postgresql/handlers/main.yml:2
Correct me, If I am wrong
After adding task for unzip installation in task/main.yml
, I have solved error in previous thread,
- name: Install requirement unzip
package:
name: unzip
state: present
register: install_unzip_result
until: install_unzip_result is succeeded
retries: 3
delay: 5
But I am getting new error,
TASK [/home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar : Create a database for Sonar.] ***
task path: /home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar/tasks/configure_postgres.yml:2
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: HINT: Use the same encoding as in the template database, or use template0 as template.
fatal: [sonar_box]: FAILED! => {"changed": false, "msg": "Database query failed: new encoding (SQL_ASCII) is incompatible with the encoding of the template database (UTF8)\nHINT: Use the same encoding as in the template database, or use template0 as template.\n"}
After changing encoding to UTF-8, I have solved error in previous thread,
- name: Create a database for Sonar.
become: yes
become_user: "{{ postgresql_user }}"
postgresql_db:
name: "{{ sonar_database_name }}"
# encoding: SQL_ASCII
encoding: UTF-8
state: present
I am having a doubt regarding IP address
In vagrant file, you are using two IP addresses , one is 192.168.XX
for virtual box
and other is 172.16.10.XX
for libvirt
. In .INI file, you have mentioned only IP address of libvirt.
Why you did not mention IP address of virtual box?
Why we need these two type IP address in vagrant file?
Can I have both IP address in host inventory?.
I am getting below error,
TASK [/home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar : Make sure Sonar is responding on the configured port.] ***
task path: /home/user/dhanasekar/Automation/vagrant-alm-master/ansible/roles/zanini.sonar/tasks/main.yml:77
fatal: [sonar_box]: FAILED! => {"changed": false, "elapsed": 300, "msg": "Timeout when waiting for 127.0.0.1:9000"}
I have removed firewall on port 9000. Still I am getting error. May be problem with inventory host?.
Hi Ricardo,
I have debugged and found that nginx.service
is not installed. After installing nginx in sonar VM, I am observing two issues.
I have observed Nginx is in inactive state in Sonar VM. So I have added task to restarting nginx service. And then also, Nginx is still in inactive state in Sonar VM. After giving vagrant provision sonar_box
, nginx service is went to Active
state.
Ansible is taking vagrant auto generated inventory file instead of inventory.ini. Even, i have explicity mention path of inventory.ini in alm.yml playbook, still Anisble is not taking my invintory.ini file. Because of this, "Timeout when waiting for 127.0.0.1:9000
issue is happening. Ansible should look at sonar port 192.168.56.4
, instead of 127.0.0.1:9000
Please provide your comments. I am waiting for your feedback. I think I am in last phase of ALM lab. Please solve the issues.
Hi Ricardo,
I am observing sonar
is failing in VM.
[vagrant@sonar ~]$ sudo systemctl status sonar.service
● sonar.service - SonarQube
Loaded: loaded (/etc/systemd/system/sonar.service; enabled; vendor preset: disabled)
Active: failed (Result: exit-code) since Fri 2019-07-19 11:10:24 UTC; 13s ago
Process: 10023 ExecStop=/usr/bin/sonar stop (code=exited, status=0/SUCCESS)
Process: 10000 ExecStart=/usr/bin/sonar start (code=exited, status=1/FAILURE)
Main PID: 10000 (code=exited, status=1/FAILURE)
Jul 19 11:10:21 sonar.local systemd[1]: Started SonarQube.
Jul 19 11:10:21 sonar.local sonar[9930]: Starting SonarQube...
Jul 19 11:10:21 sonar.local sonar[9930]: Started SonarQube.
Jul 19 11:10:23 sonar.local systemd[1]: sonar.service: main process exited, code=exited, status=1/FAILURE
Jul 19 11:10:24 sonar.local sonar[10023]: Gracefully stopping SonarQube...
Jul 19 11:10:24 sonar.local sonar[10023]: SonarQube was not running.
Jul 19 11:10:24 sonar.local systemd[1]: Unit sonar.service entered failed state.
Jul 19 11:10:24 sonar.local systemd[1]: sonar.service failed.
Because of sonar failure, sonar is not available at port 9000 Please provide your comments.
Hi Ricardo,
I have been waiting for your input. Can you please provide your comments?.
Hi Ricardo,
Now I have progressed to deployment stage in VLM Automation lab. In Your soccer-stats project, geerlingguy.role is not available in https://github.com/ricardozanini/soccer-stats/tree/master/provision/roles.
Because of this, I am getting below error,
[0;31mERROR! the role 'geerlingguy.java' was not found in /var/lib/awx/projects/_6__soccer_project/provision/roles:/var/lib/awx/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/var/lib/awx/projects/_6__soccer_project/provision[0m
[0;31m - geerlingguy.java[0m
[0;31mThe error appears to be in '/var/lib/awx/projects/_6__soccer_project/provision/playbook.yml': line 16, column 7, but may[0m
[0;31m[0m
[0;31mThe offending line appears to be:[0m
[0;31m ^ here[0m
Can you please add geerlingguy.java
to soccer-stats git repository ?. If any work around is there, Please provided me. If I am wrong, please correct me.
Hi! I'm sorry to not give you the attention that you need. :(
I'm with my hands full of work and I can't get to this right now. You can clone the repo and add yourself the roles to see if this works. :)
Actually, I have cloned the repo into VirtualBox. But Jenkins Pipeline is not taking the local repo and downloading source from git. I have used file:\\\
protocol and I am getting error.
If you have any workaroung, Please provide me. Meanwhile, I am debugging this issue.
You can fork the repo and upload your changes there. Then just configure Jenkins to pull from your fork instead.
I have created the Fork and added geerlingguy.java
in provision/roles/
. Now I am observing below error,
[0;31mERROR! the role 'geerlingguy.java' was not found in /var/lib/awx/projects/_6__soccer_project/provision/roles:/var/lib/awx/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/var/lib/awx/projects/_6__soccer_project/provision[0m
[0;31mbe elsewhere in the file depending on the exact syntax problem.[0m
[0;31mThe error appears to be in '/var/lib/awx/projects/_6__soccer_project/provision/playbook.yml': line 16, column 7, but may[0m
[0;31m[0m
Same error, I am observing in AnsibleTower Portal also.
I have mentioned full path location of geerlingguy.java in playbook.yml. But it is not working
Hi Ricardo,
Can I use Ansible AWX
instead of Ansible/Tower
in vagram-alm-master
project?
Please provide your comments.
Sure! Go ahead.
Hi Ricardo,
In Artifact stage, I am getting error in repository declaration. I am getting below error,
“Failed to deploy artifacts: Could not find artifact br.com.meetup.ansible:soccer-stats:war:0.0.2-18 in ansible-meetup”
I have solved this issue by changing repository to “maven-release” instead of “ansible-meet”. Like this
//repository: 'ansible-meetup',
repository: 'maven-releases',
Is it right way to solve the issue?. Will it impact in deployment stage?
@jdhanasekar How did you download the latest version of Sonar ?
i was facing some issue in Sonar part. So, I have dropped the sonar part, because it was not need to me at development phase...
SUMMARY
I am new to ANSIBLE. I am building my automation system with Ansible. With this article as referece "https://www.redhat.com/en/blog/integrating-ansible-jenkins-cicd-process" and I have downloaded vagrant-alm-master source from this location "https://github.com/ricardozanini/vagrant-alm"
After entering command "vagrant up", I am getting below issue.
Vagrant build process stopped because of nginx service is not started in sonar virtual box. Vagrant build process able to produce TOWER and JENKINS virtual box without error.
I have entered into sonar virtual box by giving this command " vagrant up sonar_box". I have observed that nginx service is not started because of "sonar.local.pem" certificate unavailable at this location "/etc/ssl/sonar.local/" . I am getting below error for nginx status
I have observed "sonar.local" folder is not created under "/etc/ssl" in SONAR virtual box.
I have commented SSL certification path in the below roles, but it is not fixing the issue,
_1.leandelivery.sonarqube 2.nginxinc.nginx
ISSUE TYPE
COMPONENT NAME
_1.leandelivery.sonarqube 2.nginxinc.nginx 3.geerlingguy.sonar
ANSIBLE VERSION
CONFIGURATION
OS / ENVIRONMENT
OS: Ubuntu 18.04
STEPS TO REPRODUCE
FYR, I have shared my alm.yaml file
EXPECTED RESULTS
Build process should pass. Should created SONAR virtual box completely without error NGINX service should start in SONAR virtual box
ACTUAL RESULTS
Build process is failing SONAR virtual box is not creating completely NGINX service is not starting in SONAR virtual box because of sonar.local.pem certificate is not available .