GVM 11 from the Source with ansible

I installed GVM 11 from the source … I wrote an ansible playbook. If anybody are interested, I will share it at github

2 Likes

hui :+1: :clap:
link?

For which OS did you make it?

I would definitely be interested in this :slight_smile:

Sounds interesting!
Do you mind to share the link?

Would be nice to see how others did this. I tried to do it with some bash script to have it compile from source automated by jenkins. Might be fine to have an idea what I could do better …!

Yes I’m interested on it. Please could you send the link? Thank you

yes, please do. I’m interested to see it.

Also I’m very interested… Please, post it on github!!

Here is the playbook. It works for me but i can’t guarantee for everyone. It based on the howto

https://sadsloth.net/post/install-gvm11-src-on-debian/

feedbacks are welcome

1 Like

I’ll be taking a look at that. Thanks for your contribution!

1 Like

Just started looking at this, and it’s really gonna be a time saver for me, so thank you very much.
I do have one question. In tasks/main.yml, you have a couple of spots where you are checking if a file exists, and only running a task if it doesn’t. Was there a reason you chose to do it that way, instead of achieving idempotency using the “creates” keyword? Was this a style choice? My bias is usually to make playbooks as short and sweet as possible, which is the only reason I ask.

For example, instead of doing this:

- name: check if /opt/gvm/lib/libgvm_base.so  exist
  stat:
    path: /opt/gvm/lib/libgvm_base.so 
  register: libgvm

- name: make gvm-libs 
  command: /opt/gvm/install-stuff/build.sh
  become: yes
  become_user: gvm
  args:
    chdir:  /opt/gvm/src/gvm-libs
  when: libgvm.stat.exists == False

Do this:

- name: make gvm-libs 
  command: /opt/gvm/install-stuff/build.sh
  become: yes
  become_user: gvm
  args:
    chdir:  /opt/gvm/src/gvm-libs
    creates: /opt/gvm/lib/libgvm_base.so
2 Likes

Thanks for the hint. I am working with ansible only a couple of days … so there is a lot of room to make it better … I will change this

I borrowed your playbook and I’m adapting it to Centos 8.1. I’ll share it when I’ve got it working, and perhaps someone can make it ansible_os_family aware.

1 Like

Here’s my work in progress:

There are a couple of kludges in there, and I’ve still not gotten it to run start-to-finish with no errors, but it’s getting there.

1 Like

It’s done. Even passes ansible-lint (except rule #403, which I don’t care for anyway). Just ran it against a clean CentOS 8.2 “minimal” install.

1 Like

For some reasons I cannot get it work… Service gvmd.service doesn’t start…
(I’m on Centos 8.2.2004)

Job for gvmd.service failed because a timeout was exceeded.
See “systemctl status gvmd.service” and “journalctl -xe” for details.

(no details useful in journalctl…)

What do you see in the gvmd log? (/opt/gvm/var/log/gvm/gvmd.log)

md main:MESSAGE:2020-06-26 14h23.31 utc:178301: Greenbone Vulnerability Manager version 9.0.1~git-f17f9a71-gvmd-9.0 (GIT revision f17f9a71-gvmd-9.0) (DB revision 221)
md manage:WARNING:2020-06-26 14h23.31 utc:178302: sql_exec_internal: PQexec failed: ERROR: permission denied to set role “dba”
(7)
md manage:WARNING:2020-06-26 14h23.31 utc:178302: sql_exec_internal: SQL: SET role dba;
md manage:WARNING:2020-06-26 14h23.31 utc:178302: sqlv: sql_exec_internal failed

Assuming you are doing this on a test system, do you have /etc/ld.so.conf.d/gvm.conf configured? It should have /opt/gvm/lib in it, and you should run ldconfig to make the system aware of it.

Also, you might check that the database is configured correctly for the gvm user.

how can I check the database?
ld.so.conf is as you say: /opt/gvm/lib is in gvm.conf