From a79c9135fc2ed27b8d2374ab9728124f2357d2f1 Mon Sep 17 00:00:00 2001 From: Kristian Lyngstol Date: Fri, 13 May 2016 20:18:36 +0200 Subject: Move stuff from /opt/nms to /opt/gondul etc Still lots to do --- README.rst | 2 +- ansible/roles/basics/tasks/main.yml | 4 +-- build/test/gondul-collector-test.Dockerfile | 17 ++++++++++++ build/test/gondul-db-test.Dockerfile | 10 +++++++ build/test/gondul-front-test.Dockerfile | 43 +++++++++++++++++++++++++++++ build/test/gondul-snmp-test.Dockerfile | 20 ++++++++++++++ build/test/gondul-varnish-test.Dockerfile | 8 ++++++ build/test/nms-collector-test.Dockerfile | 17 ------------ build/test/nms-db-test.Dockerfile | 10 ------- build/test/nms-front-test.Dockerfile | 43 ----------------------------- build/test/nms-snmp-test.Dockerfile | 20 -------------- build/test/nms-varnish-test.Dockerfile | 8 ------ build/test/snmpfetch-misc.sh | 2 +- collectors/ping.pl | 2 +- collectors/snmpfetchng.pl | 8 +++--- extras/misc/apache2.conf | 16 +++++------ extras/misc/varnish.vcl | 2 +- web/api/public/dhcp | 2 +- web/api/public/dhcp-summary | 2 +- web/api/public/location | 2 +- web/api/public/ping | 2 +- web/api/public/switch-state | 2 +- web/api/public/switches | 2 +- web/api/read/comments | 2 +- web/api/read/snmp | 2 +- web/api/read/switches-management | 2 +- web/api/write/comment-add | 2 +- web/api/write/comment-change | 2 +- web/api/write/switch-add | 2 +- web/api/write/switch-update | 2 +- 30 files changed, 129 insertions(+), 129 deletions(-) create mode 100644 build/test/gondul-collector-test.Dockerfile create mode 100644 build/test/gondul-db-test.Dockerfile create mode 100644 build/test/gondul-front-test.Dockerfile create mode 100644 build/test/gondul-snmp-test.Dockerfile create mode 100644 build/test/gondul-varnish-test.Dockerfile delete mode 100644 build/test/nms-collector-test.Dockerfile delete mode 100644 build/test/nms-db-test.Dockerfile delete mode 100644 build/test/nms-front-test.Dockerfile delete mode 100644 build/test/nms-snmp-test.Dockerfile delete mode 100644 build/test/nms-varnish-test.Dockerfile diff --git a/README.rst b/README.rst index 98d3b7f..f142e82 100644 --- a/README.rst +++ b/README.rst @@ -95,7 +95,7 @@ It will build and run 5 containers: The IP of the Varnish instance is reported and can be used. The credentials used are 'demo/demo'. -The repository is mounted as a docker volume under /opt/nms on all +The repository is mounted as a docker volume under /opt/gondul on all containers, which means you can do your editing outside of the containers. The last part of the test ansible playbook adds a handfull of diff --git a/ansible/roles/basics/tasks/main.yml b/ansible/roles/basics/tasks/main.yml index dc13f2e..ec2f45e 100644 --- a/ansible/roles/basics/tasks/main.yml +++ b/ansible/roles/basics/tasks/main.yml @@ -35,12 +35,12 @@ tags: - start - name: workaround to get gondul-varnish-front-ip - shell: "docker inspect gondul-varnish | grep IPAddress | sed 's/[^0-9.]//g'" + shell: "docker inspect gondul-varnish-test | grep IPAddress | sed 's/[^0-9.]//g'" register: ip tags: - start - name: workaround to get gondul-front-ip - shell: "docker inspect gondul-front | grep IPAddress | sed 's/[^0-9.]//g'" + shell: "docker inspect gondul-front-test | grep IPAddress | sed 's/[^0-9.]//g'" register: ipfront tags: - start diff --git a/build/test/gondul-collector-test.Dockerfile b/build/test/gondul-collector-test.Dockerfile new file mode 100644 index 0000000..0af8f75 --- /dev/null +++ b/build/test/gondul-collector-test.Dockerfile @@ -0,0 +1,17 @@ +FROM debian:jessie +RUN apt-get update +RUN apt-get -y install \ + libdata-dumper-simple-perl \ + libdbd-pg-perl \ + libdbi-perl \ + libnet-oping-perl \ + libsocket-perl \ + libswitch-perl \ + libtimedate-perl \ + perl \ + libjson-xs-perl \ + libjson-perl \ + perl-base \ + perl-modules +RUN mkdir -p /opt/gondul +CMD /opt/gondul/collectors/ping.pl diff --git a/build/test/gondul-db-test.Dockerfile b/build/test/gondul-db-test.Dockerfile new file mode 100644 index 0000000..2e0e0ce --- /dev/null +++ b/build/test/gondul-db-test.Dockerfile @@ -0,0 +1,10 @@ +FROM debian:jessie +RUN apt-get update && apt-get install -y postgresql-9.4 +ADD build/test/pg_hba.tail /pg_hba.tail +RUN cat /pg_hba.tail >> /etc/postgresql/9.4/main/pg_hba.conf +RUN service postgresql start && su postgres -c "psql --command=\"CREATE ROLE nms PASSWORD 'risbrod' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\"" && su postgres -c "createdb -O nms nms" && service postgresql stop +ADD build/schema.sql /schema.sql +RUN service postgresql start && su postgres -c "cat /schema.sql | psql nms" && service postgresql stop +RUN echo "listen_addresses = '*'" >> /etc/postgresql/9.4/main/postgresql.conf +CMD pg_ctlcluster --foreground 9.4 main start +EXPOSE 5432 diff --git a/build/test/gondul-front-test.Dockerfile b/build/test/gondul-front-test.Dockerfile new file mode 100644 index 0000000..90687cf --- /dev/null +++ b/build/test/gondul-front-test.Dockerfile @@ -0,0 +1,43 @@ +FROM debian:jessie +RUN apt-get update +RUN apt-get -y install \ + libcapture-tiny-perl \ + libcommon-sense-perl \ + libdata-dumper-simple-perl \ + libdbd-pg-perl \ + libdbi-perl \ + libdigest-perl \ + libgd-perl \ + libgeo-ip-perl \ + libhtml-parser-perl \ + libhtml-template-perl \ + libjson-perl \ + libjson-xs-perl \ + libnetaddr-ip-perl \ + libnet-cidr-perl \ + libnet-ip-perl \ + libnet-oping-perl \ + libnet-rawip-perl \ + libsnmp-perl \ + libsocket6-perl \ + libsocket-perl \ + libswitch-perl \ + libtimedate-perl \ + perl \ + perl-base \ + perl-modules \ + libfreezethaw-perl \ + apache2 + +RUN mkdir -p /opt/gondul + +RUN a2dissite 000-default +RUN a2enmod cgi +RUN ln -s /opt/gondul/extras/misc/apache2.conf /etc/apache2/sites-enabled/nms.conf +RUN mkdir -p /opt/gondul/etc +RUN echo 'demo:$apr1$IKrQYF6x$0zmRciLR7Clc2tEEosyHV.' > /htpasswd-read +RUN echo 'demo:$apr1$IKrQYF6x$0zmRciLR7Clc2tEEosyHV.' > /htpasswd-write +ADD build/test/dummy-apache2.start / +RUN chmod 0755 /dummy-apache2.start +CMD /dummy-apache2.start +EXPOSE 80 diff --git a/build/test/gondul-snmp-test.Dockerfile b/build/test/gondul-snmp-test.Dockerfile new file mode 100644 index 0000000..a99a943 --- /dev/null +++ b/build/test/gondul-snmp-test.Dockerfile @@ -0,0 +1,20 @@ +FROM debian:jessie +RUN apt-get update +RUN apt-get -y install \ + libdata-dumper-simple-perl \ + libdbd-pg-perl \ + libdbi-perl \ + libnet-oping-perl \ + libsocket-perl \ + libswitch-perl \ + libtimedate-perl \ + perl \ + libjson-xs-perl \ + libjson-perl \ + perl-base \ + snmpd \ + libsnmp-perl \ + perl-modules +RUN mkdir -p /opt/gondul +COPY build/test/snmpd.conf /etc/snmp/ +CMD /opt/gondul/build/test/snmpfetch-misc.sh diff --git a/build/test/gondul-varnish-test.Dockerfile b/build/test/gondul-varnish-test.Dockerfile new file mode 100644 index 0000000..7e75b86 --- /dev/null +++ b/build/test/gondul-varnish-test.Dockerfile @@ -0,0 +1,8 @@ +FROM debian:jessie +RUN apt-get update +RUN apt-get -y install varnish + +RUN rm /etc/varnish/default.vcl +ADD extras/misc/varnish.vcl /etc/varnish/default.vcl +CMD varnishd -a :80 -f /etc/varnish/default.vcl -F +EXPOSE 80 diff --git a/build/test/nms-collector-test.Dockerfile b/build/test/nms-collector-test.Dockerfile deleted file mode 100644 index 4b08f05..0000000 --- a/build/test/nms-collector-test.Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -FROM debian:jessie -RUN apt-get update -RUN apt-get -y install \ - libdata-dumper-simple-perl \ - libdbd-pg-perl \ - libdbi-perl \ - libnet-oping-perl \ - libsocket-perl \ - libswitch-perl \ - libtimedate-perl \ - perl \ - libjson-xs-perl \ - libjson-perl \ - perl-base \ - perl-modules -RUN mkdir -p /opt/nms -CMD /opt/nms/collectors/ping.pl diff --git a/build/test/nms-db-test.Dockerfile b/build/test/nms-db-test.Dockerfile deleted file mode 100644 index 2e0e0ce..0000000 --- a/build/test/nms-db-test.Dockerfile +++ /dev/null @@ -1,10 +0,0 @@ -FROM debian:jessie -RUN apt-get update && apt-get install -y postgresql-9.4 -ADD build/test/pg_hba.tail /pg_hba.tail -RUN cat /pg_hba.tail >> /etc/postgresql/9.4/main/pg_hba.conf -RUN service postgresql start && su postgres -c "psql --command=\"CREATE ROLE nms PASSWORD 'risbrod' NOSUPERUSER NOCREATEDB NOCREATEROLE INHERIT LOGIN;\"" && su postgres -c "createdb -O nms nms" && service postgresql stop -ADD build/schema.sql /schema.sql -RUN service postgresql start && su postgres -c "cat /schema.sql | psql nms" && service postgresql stop -RUN echo "listen_addresses = '*'" >> /etc/postgresql/9.4/main/postgresql.conf -CMD pg_ctlcluster --foreground 9.4 main start -EXPOSE 5432 diff --git a/build/test/nms-front-test.Dockerfile b/build/test/nms-front-test.Dockerfile deleted file mode 100644 index e9d7ef8..0000000 --- a/build/test/nms-front-test.Dockerfile +++ /dev/null @@ -1,43 +0,0 @@ -FROM debian:jessie -RUN apt-get update -RUN apt-get -y install \ - libcapture-tiny-perl \ - libcommon-sense-perl \ - libdata-dumper-simple-perl \ - libdbd-pg-perl \ - libdbi-perl \ - libdigest-perl \ - libgd-perl \ - libgeo-ip-perl \ - libhtml-parser-perl \ - libhtml-template-perl \ - libjson-perl \ - libjson-xs-perl \ - libnetaddr-ip-perl \ - libnet-cidr-perl \ - libnet-ip-perl \ - libnet-oping-perl \ - libnet-rawip-perl \ - libsnmp-perl \ - libsocket6-perl \ - libsocket-perl \ - libswitch-perl \ - libtimedate-perl \ - perl \ - perl-base \ - perl-modules \ - libfreezethaw-perl \ - apache2 - -RUN mkdir -p /opt/nms - -RUN a2dissite 000-default -RUN a2enmod cgi -RUN ln -s /opt/nms/extras/misc/apache2.conf /etc/apache2/sites-enabled/nms.conf -RUN mkdir -p /opt/nms/etc -RUN echo 'demo:$apr1$IKrQYF6x$0zmRciLR7Clc2tEEosyHV.' > /htpasswd-read -RUN echo 'demo:$apr1$IKrQYF6x$0zmRciLR7Clc2tEEosyHV.' > /htpasswd-write -ADD build/test/dummy-apache2.start / -RUN chmod 0755 /dummy-apache2.start -CMD /dummy-apache2.start -EXPOSE 80 diff --git a/build/test/nms-snmp-test.Dockerfile b/build/test/nms-snmp-test.Dockerfile deleted file mode 100644 index f7bb30e..0000000 --- a/build/test/nms-snmp-test.Dockerfile +++ /dev/null @@ -1,20 +0,0 @@ -FROM debian:jessie -RUN apt-get update -RUN apt-get -y install \ - libdata-dumper-simple-perl \ - libdbd-pg-perl \ - libdbi-perl \ - libnet-oping-perl \ - libsocket-perl \ - libswitch-perl \ - libtimedate-perl \ - perl \ - libjson-xs-perl \ - libjson-perl \ - perl-base \ - snmpd \ - libsnmp-perl \ - perl-modules -RUN mkdir -p /opt/nms -COPY build/test/snmpd.conf /etc/snmp/ -CMD /opt/nms/build/test/snmpfetch-misc.sh diff --git a/build/test/nms-varnish-test.Dockerfile b/build/test/nms-varnish-test.Dockerfile deleted file mode 100644 index 7e75b86..0000000 --- a/build/test/nms-varnish-test.Dockerfile +++ /dev/null @@ -1,8 +0,0 @@ -FROM debian:jessie -RUN apt-get update -RUN apt-get -y install varnish - -RUN rm /etc/varnish/default.vcl -ADD extras/misc/varnish.vcl /etc/varnish/default.vcl -CMD varnishd -a :80 -f /etc/varnish/default.vcl -F -EXPOSE 80 diff --git a/build/test/snmpfetch-misc.sh b/build/test/snmpfetch-misc.sh index 55c024d..95b005f 100755 --- a/build/test/snmpfetch-misc.sh +++ b/build/test/snmpfetch-misc.sh @@ -1,3 +1,3 @@ #!/bin/bash service snmpd start -exec /opt/nms/collectors/snmpfetchng.pl +exec /opt/gondul/collectors/snmpfetchng.pl diff --git a/collectors/ping.pl b/collectors/ping.pl index b5f7bbf..590379c 100755 --- a/collectors/ping.pl +++ b/collectors/ping.pl @@ -7,7 +7,7 @@ use strict; use warnings; use Data::Dumper; -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use nms; $|++; diff --git a/collectors/snmpfetchng.pl b/collectors/snmpfetchng.pl index 14561c2..5c4b053 100755 --- a/collectors/snmpfetchng.pl +++ b/collectors/snmpfetchng.pl @@ -6,13 +6,13 @@ use POSIX; #use Time::HiRes qw(time); use SNMP; use Data::Dumper; -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use nms; SNMP::initMib(); -SNMP::addMibDirs("/opt/nms/mibs/StandardMibs"); -SNMP::addMibDirs("/opt/nms/mibs/JuniperMibs"); -SNMP::addMibDirs("/opt/nms/mibs/CiscoMibs"); +SNMP::addMibDirs("/opt/gondul/mibs/StandardMibs"); +SNMP::addMibDirs("/opt/gondul/mibs/JuniperMibs"); +SNMP::addMibDirs("/opt/gondul/mibs/CiscoMibs"); SNMP::loadModules('ALL'); our $dbh = nms::db_connect(); diff --git a/extras/misc/apache2.conf b/extras/misc/apache2.conf index 9d5cd41..10817cf 100644 --- a/extras/misc/apache2.conf +++ b/extras/misc/apache2.conf @@ -3,11 +3,11 @@ ServerName nms.example.com ServerAlias nms.example.com - DocumentRoot /opt/nms/web - ScriptAlias /api/write/ /opt/nms/web/api/write/ - ScriptAlias /api/read/ /opt/nms/web/api/read/ - ScriptAlias /api/public/ /opt/nms/web/api/public/ - + DocumentRoot /opt/gondul/web + ScriptAlias /api/write/ /opt/gondul/web/api/write/ + ScriptAlias /api/read/ /opt/gondul/web/api/read/ + ScriptAlias /api/public/ /opt/gondul/web/api/public/ + AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch @@ -17,7 +17,7 @@ Require valid-user - + AllowOverride None Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch @@ -27,12 +27,12 @@ Require valid-user - + AllowOverride None Options +ExecCGI -MultiViews +Indexes +SymLinksIfOwnerMatch Require all granted - + AllowOverride None Options Indexes FollowSymLinks MultiViews AddDefaultCharset UTF-8 diff --git a/extras/misc/varnish.vcl b/extras/misc/varnish.vcl index c7c402f..addef0d 100644 --- a/extras/misc/varnish.vcl +++ b/extras/misc/varnish.vcl @@ -3,7 +3,7 @@ vcl 4.0; backend default { - .host = "nms-front"; + .host = "gondul-front"; .port = "80"; } diff --git a/web/api/public/dhcp b/web/api/public/dhcp index d998c59..ea42b8f 100755 --- a/web/api/public/dhcp +++ b/web/api/public/dhcp @@ -1,7 +1,7 @@ #! /usr/bin/perl # vim:ts=8:sw=8 -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use nms::web qw (%json finalize_output); use strict; use warnings; diff --git a/web/api/public/dhcp-summary b/web/api/public/dhcp-summary index 73460e7..18a7f69 100755 --- a/web/api/public/dhcp-summary +++ b/web/api/public/dhcp-summary @@ -1,5 +1,5 @@ #! /usr/bin/perl -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use strict; use warnings; use nms::web; diff --git a/web/api/public/location b/web/api/public/location index 70b6ffd..2247f73 100755 --- a/web/api/public/location +++ b/web/api/public/location @@ -1,7 +1,7 @@ #! /usr/bin/perl # vim:ts=8:sw=8 -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use nms::web; use strict; use warnings; diff --git a/web/api/public/ping b/web/api/public/ping index 27a8933..36e3334 100755 --- a/web/api/public/ping +++ b/web/api/public/ping @@ -1,5 +1,5 @@ #! /usr/bin/perl -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use strict; use warnings; use nms::web; diff --git a/web/api/public/switch-state b/web/api/public/switch-state index 5cc7e73..eaa8be3 100755 --- a/web/api/public/switch-state +++ b/web/api/public/switch-state @@ -1,7 +1,7 @@ #! /usr/bin/perl # vim:ts=8:sw=8 -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use nms::web qw (%json finalize_output); use strict; use warnings; diff --git a/web/api/public/switches b/web/api/public/switches index 1322ba6..e6a37f8 100755 --- a/web/api/public/switches +++ b/web/api/public/switches @@ -3,7 +3,7 @@ use CGI qw(fatalsToBrowser); use DBI; -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use nms; use nms::web; use strict; diff --git a/web/api/read/comments b/web/api/read/comments index eb3b45a..d7c8cdb 100755 --- a/web/api/read/comments +++ b/web/api/read/comments @@ -1,7 +1,7 @@ #! /usr/bin/perl # vim:ts=8:sw=8 -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use nms::web; use strict; use warnings; diff --git a/web/api/read/snmp b/web/api/read/snmp index 711de65..0865107 100755 --- a/web/api/read/snmp +++ b/web/api/read/snmp @@ -3,7 +3,7 @@ use CGI qw(fatalsToBrowser); use DBI; -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use nms; use nms::web; use strict; diff --git a/web/api/read/switches-management b/web/api/read/switches-management index 94ab5f5..2dd329c 100755 --- a/web/api/read/switches-management +++ b/web/api/read/switches-management @@ -3,7 +3,7 @@ use CGI qw(fatalsToBrowser); use DBI; -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use nms; use nms::web; use strict; diff --git a/web/api/write/comment-add b/web/api/write/comment-add index 8d4899c..f87a28c 100755 --- a/web/api/write/comment-add +++ b/web/api/write/comment-add @@ -1,6 +1,6 @@ #! /usr/bin/perl # vim:ts=8:sw=8 -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use utf8; use nms::web qw($dbh db_safe_quote get_input finalize_output); use strict; diff --git a/web/api/write/comment-change b/web/api/write/comment-change index 91b9824..6318723 100755 --- a/web/api/write/comment-change +++ b/web/api/write/comment-change @@ -1,6 +1,6 @@ #! /usr/bin/perl # vim:ts=8:sw=8 -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use utf8; use nms; use nms::web qw($dbh db_safe_quote get_input finalize_output); diff --git a/web/api/write/switch-add b/web/api/write/switch-add index 3950b10..56e5cb2 100755 --- a/web/api/write/switch-add +++ b/web/api/write/switch-add @@ -3,7 +3,7 @@ #use CGI qw(fatalsToBrowser); use DBI; -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use nms; use nms::web qw(%get_params %json finalize_output get_input $dbh); use nms::util qw(guess_placement); diff --git a/web/api/write/switch-update b/web/api/write/switch-update index a463390..15b85ae 100755 --- a/web/api/write/switch-update +++ b/web/api/write/switch-update @@ -3,7 +3,7 @@ #use CGI qw(fatalsToBrowser); use DBI; -use lib '/opt/nms/include'; +use lib '/opt/gondul/include'; use nms; use nms::web qw(%get_params %json finalize_output get_input $dbh); use nms::util qw(guess_placement); -- cgit v1.2.3