]> Frank Brehm's Git Trees - pixelpark/admin-tools.git/commitdiff
add bmf, bmas dns cname script hf-dns-zones
authorRobert Waffen <rwaffen@gmail.com>
Wed, 22 Jan 2020 14:14:56 +0000 (15:14 +0100)
committerRobert Waffen <rwaffen@gmail.com>
Wed, 22 Jan 2020 14:14:56 +0000 (15:14 +0100)
Gemfile [new file with mode: 0644]
Gemfile.lock [new file with mode: 0644]
Readme.md [new file with mode: 0644]
bin/manage_records.rb [new file with mode: 0755]
etc/dns/dev_bmas.yaml [new file with mode: 0644]
etc/dns/dev_bmf.yaml [new file with mode: 0644]
etc/dns/dev_tst.yaml [new file with mode: 0644]
etc/dns/live_bmas.yaml [new file with mode: 0644]
etc/dns/live_bmf.yaml [new file with mode: 0644]
etc/dns/test_bmas.yaml [new file with mode: 0644]
etc/dns/test_bmf.yaml [new file with mode: 0644]

diff --git a/Gemfile b/Gemfile
new file mode 100644 (file)
index 0000000..8f2a63c
--- /dev/null
+++ b/Gemfile
@@ -0,0 +1,3 @@
+source 'https://rubygems.org' do
+  gem 'net-ssh', '>=5.2.0'
+end
diff --git a/Gemfile.lock b/Gemfile.lock
new file mode 100644 (file)
index 0000000..656b86f
--- /dev/null
@@ -0,0 +1,13 @@
+GEM
+  remote: https://rubygems.org/
+  specs:
+    net-ssh (5.2.0)
+
+PLATFORMS
+  ruby
+
+DEPENDENCIES
+  net-ssh (>= 5.2.0)!
+
+BUNDLED WITH
+   2.0.1
diff --git a/Readme.md b/Readme.md
new file mode 100644 (file)
index 0000000..d1c608a
--- /dev/null
+++ b/Readme.md
@@ -0,0 +1,22 @@
+# BMF / BMAS
+
+## bin/manage_records.rb
+
+Das script setzt anhand von yaml dateien cnames auf vorhandene a records
+
+yaml format:
+
+    ---
+    ein_a_record:
+      - ein_cname
+      - zwei_cnames
+
+    zwei_a_records:
+      - drei_cnames
+
+Die bisherig config liegt in etc/dns/\*.yaml
+
+Ausführung:
+
+    bundle install --path vendor/gems
+    bundle exec ruby bin/manage_records.rb etc/dns/test_bmas.yam
diff --git a/bin/manage_records.rb b/bin/manage_records.rb
new file mode 100755 (executable)
index 0000000..afc64cf
--- /dev/null
@@ -0,0 +1,56 @@
+#!/usr/bin/env ruby
+
+require 'yaml'
+require 'resolv'
+require 'net/ssh'
+require 'pp'
+
+################################################################################
+
+action      = 'add-record'
+data        = YAML.load_file(ARGV[0])
+debug       = true
+pdns_cmds   = []
+record_type = "CNAME"
+ssh_output  = []
+ttl         = "3600"
+user        = 'robert.waffen'
+zone        = "pixelpark.net"
+@dnsmaster   = "dnsmaster.pp-dns.com"
+
+################################################################################
+
+def check_rr_set(rrset)
+  Resolv::DNS.open({:nameserver=>[@dnsmaster]}) do |r|
+    r.getaddresses(rrset)
+  end
+end
+
+data.map do |key, value|
+  puts "canme target: #{key}" if debug
+
+  value.each do |cname|
+    puts "cname is #{cname}.#{zone}" if debug
+    test_record = check_rr_set "#{cname}.#{zone}"
+    pp test_record if debug
+
+    if test_record.empty?
+      pdns_cmds << "pdnsutil #{action} #{zone} #{cname} #{record_type} #{ttl} #{key}.#{zone}."
+    end
+  end
+end
+
+unless pdns_cmds.empty?
+  pdns_cmds << "pdnsutil increase-serial #{zone}"
+  pdns_cmds << "pdns_control notify #{zone}"
+end
+
+puts pdns_cmds if debug
+
+Net::SSH.start(@dnsmaster, user) do |ssh|
+  pdns_cmds.each do |command|
+    ssh_output << ssh.exec!("sudo #{command}")
+  end
+end
+
+puts ssh_output
diff --git a/etc/dns/dev_bmas.yaml b/etc/dns/dev_bmas.yaml
new file mode 100644 (file)
index 0000000..a405695
--- /dev/null
@@ -0,0 +1,45 @@
+---
+dev-bmas10:
+  - dev-standardlsg-preview-bmas10
+  - dev-standardlsg-editor-bmas10
+  - dev-standardlsg-www-bmas10
+  - dev-bmas-preview-bmas10
+  - dev-bmas-editor-bmas10
+  - dev-bmas-www-bmas10
+  - dev-repository-preview-bmas10
+  - dev-editor-preview-bmas10
+  - dev-service-preview-bmas10
+  - dev-solr-preview-bmas10
+  - dev-delivery-preview-bmas10
+  - dev-workflow-preview-bmas10
+  - dev-newsletter-preview-bmas10
+  - dev-repository-master-bmas10
+  - dev-service-master-bmas10
+  - dev-solr-master-bmas10
+  - dev-delivery1-master-bmas10
+  - dev-delivery2-master-bmas10
+  - dev-repository-replication-bmas10
+  - dev-solr-replication-bmas10
+  - dev-delivery1-replication-bmas10
+  - dev-delivery2-replication-bmas10
+  - dev-adminportal-database-bmas10
+  - dev-site-database-bmas10
+  - dev-preview-database-bmas10
+  - dev-master-database-bmas10
+  - dev-replication-database-bmas10
+  - dev-maildistributor-database-bmas10
+  - dev-workflow-database-bmas10
+  - dev-adminportal-service-bmas10
+  - dev-serviceportal-service-bmas10
+  - dev-maildistributor-service-bmas10
+  - dev-cas-preview-service-bmas10
+  - dev-cas-live-service-bmas10
+  - dev-ldap-preview-service-bmas10
+  - dev-ldap-live-service-bmas10
+  - dev-mail-extern-bmas10
+  - dev-esf-preview-bmas10
+  - dev-esf-editor-bmas10
+  - dev-esf-www-bmas10
+  - dev-inqa-preview-bmas10
+  - dev-inqa-editor-bmas10
+  - dev-inqa-www-bmas10
diff --git a/etc/dns/dev_bmf.yaml b/etc/dns/dev_bmf.yaml
new file mode 100644 (file)
index 0000000..7911c0d
--- /dev/null
@@ -0,0 +1,52 @@
+---
+dev-bmf10:
+  - dev-standardlsg-preview-bmf10
+  - dev-standardlsg-editor-bmf10
+  - dev-standardlsg-www-bmf10
+  - dev-bmf-preview-bmf10
+  - dev-bmf-editor-bmf10
+  - dev-bmf-www-bmf10
+  - dev-amthb-preview-bmf10
+  - dev-amthb-editor-bmf10
+  - dev-amthb-www-bmf10
+  - dev-lsth-preview-bmf10
+  - dev-lsth-www-bmf10
+  - dev-esth-preview-bmf10
+  - dev-esth-www-bmf10
+  - dev-ksth-preview-bmf10
+  - dev-ksth-www-bmf10
+  - dev-gewsth-preview-bmf10
+  - dev-gewsth-www-bmf10
+  - dev-repository-preview-bmf10
+  - dev-editor-preview-bmf10
+  - dev-service-preview-bmf10
+  - dev-solr-preview-bmf10
+  - dev-delivery-preview-bmf10
+  - dev-workflow-preview-bmf10
+  - dev-newsletter-preview-bmf10
+  - dev-repository-master-bmf10
+  - dev-service-master-bmf10
+  - dev-solr-master-bmf10
+  - dev-delivery1-master-bmf10
+  - dev-delivery2-master-bmf10
+  - dev-repository-replication-bmf10
+  - dev-solr-replication-bmf10
+  - dev-delivery1-replication-bmf10
+  - dev-delivery2-replication-bmf10
+  - dev-adminportal-database-bmf10
+  - dev-site-database-bmf10
+  - dev-preview-database-bmf10
+  - dev-master-database-bmf10
+  - dev-replication-database-bmf10
+  - dev-maildistributor-database-bmf10
+  - dev-workflow-database-bmf10
+  - dev-adminportal-service-bmf10
+  - dev-serviceportal-service-bmf10
+  - dev-maildistributor-service-bmf10
+  - dev-cas-preview-service-bmf10
+  - dev-cas-live-service-bmf10
+  - dev-ldap-preview-service-bmf10
+  - dev-ldap-live-service-bmf10
+  - dev-mail-extern-bmf10
+  - dev-usth-preview-bmf10
+  - dev-usth-www-bmf10
diff --git a/etc/dns/dev_tst.yaml b/etc/dns/dev_tst.yaml
new file mode 100644 (file)
index 0000000..83220fc
--- /dev/null
@@ -0,0 +1,4 @@
+---
+www:
+  - robert
+  - waffen
diff --git a/etc/dns/live_bmas.yaml b/etc/dns/live_bmas.yaml
new file mode 100644 (file)
index 0000000..027b0b0
--- /dev/null
@@ -0,0 +1,63 @@
+---
+master01-bmas10-de:
+  - master-database-bmas10
+  - repository-master-bmas10
+  - service-master-bmas10
+  - site-database-bmas10
+  - solr-master-bmas10
+
+red-bmas10-de:
+  - adminportal-database-bmas10
+  - adminportal-service-bmas10
+  - amthb-editor-bmas10
+  - amthb-preview-bmas10
+  - bmas-editor-bmas10
+  - bmas-preview-bmas10
+  - cas-live-service-bmas10
+  - cas-preview-service-bmas10
+  - delivery-preview-bmas10
+  - editor-preview-bmas10
+  - maildistributor-database-bmas10
+  - maildistributor-service-bmas10
+  - newsletter-preview-bmas10
+  - preview-database-bmas10
+  - repository-preview-bmas10
+  - service-preview-bmas10
+  - serviceportal-service-bmas10
+  - solr-preview-bmas10
+  - workflow-database-bmas10
+  - workflow-preview-bmas10
+  - ldap-preview-service-bmas10
+  - ldap-live-service-bmas10
+  - esf-preview-bmas10
+  - esf-editor-bmas10
+  - inqa-preview-bmas10
+  - inqa-editor-bmas10
+
+slave01-bmas10-de:
+  - replication-database-bmas10
+  - repository-replication-bmas10
+
+www01-bmas10-de:
+  - bmas-www01-bmas10
+  - delivery1-master-bmas10
+  - esf-www01-bmas10
+  - inqa-www01-bmas10
+
+www02-bmas10-de:
+  - bmas-www02-bmas10
+  - delivery2-master-bmas10
+  - esf-www02-bmas10
+  - inqa-www02-bmas10
+
+www03-bmas10-de:
+  - bmas-www03-bmas10
+  - delivery1-replication-bmas10
+  - esf-www03-bmas10
+  - inqa-www03-bmas10
+
+www04-bmas10-de:
+  - bmas-www04-bmas10
+  - delivery2-replication-bmas10
+  - esf-www04-bmas10
+  - inqa-www04-bmas10
diff --git a/etc/dns/live_bmf.yaml b/etc/dns/live_bmf.yaml
new file mode 100644 (file)
index 0000000..b6e3884
--- /dev/null
@@ -0,0 +1,78 @@
+---
+master01-bmf10-de:
+  - master-database-bmf10
+  - repository-master-bmf10
+  - service-master-bmf10
+  - site-database-bmf10
+  - solr-master-bmf10
+
+red-bmf10-de:
+  - adminportal-database-bmf10
+  - adminportal-service-bmf10
+  - amthb-editor-bmf10
+  - amthb-preview-bmf10
+  - bmf-editor-bmf10
+  - bmf-preview-bmf10
+  - cas-live-service-bmf10
+  - cas-preview-service-bmf10
+  - delivery-preview-bmf10
+  - editor-preview-bmf10
+  - esth-preview-bmf10
+  - gewsth-preview-bmf10
+  - ksth-preview-bmf10
+  - lsth-preview-bmf10
+  - maildistributor-database-bmf10
+  - maildistributor-service-bmf10
+  - newsletter-preview-bmf10
+  - preview-database-bmf10
+  - repository-preview-bmf10
+  - service-preview-bmf10
+  - serviceportal-service-bmf10
+  - solr-preview-bmf10
+  - usth-preview-bmf10
+  - workflow-database-bmf10
+  - workflow-preview-bmf10
+
+slave01-bmf10-de:
+  - replication-database-bmf10
+  - repository-replication-bmf10
+
+www01-bmf10-de:
+  - amthb-www01-bmf10
+  - bmf-www01-bmf10
+  - delivery1-master-bmf10
+  - esth-www01-bmf10
+  - gewsth-www01-bmf10
+  - ksth-www01-bmf10
+  - lsth-www01-bmf10
+  - usth-www01-bmf10
+
+www02-bmf10-de:
+  - amthb-www02-bmf10
+  - bmf-www02-bmf10
+  - delivery2-master-bmf10
+  - esth-www02-bmf10
+  - gewsth-www02-bmf10
+  - ksth-www02-bmf10
+  - lsth-www02-bmf10
+  - usth-www02-bmf10
+
+www03-bmf10-de:
+  - amthb-www03-bmf10
+  - bmf-www03-bmf10
+  - delivery1-replication-bmf10
+  - esth-www03-bmf10
+  - gewsth-www03-bmf10
+  - ksth-www03-bmf10
+  - lsth-www03-bmf10
+  - usth-www03-bmf10
+
+www04-bmf10-de:
+  - amthb-www04-bmf10
+  - bmf-www04-bmf10
+  - delivery2-replication-bmf10
+  - esth-www04-bmf10
+  - gewsth-www04-bmf10
+  - ksth-www04-bmf10
+  - lsth-www04-bmf10
+  - usth-www04-bmf10
diff --git a/etc/dns/test_bmas.yaml b/etc/dns/test_bmas.yaml
new file mode 100644 (file)
index 0000000..5f0d930
--- /dev/null
@@ -0,0 +1,51 @@
+---
+test-master01-bmas10-de:
+  - test-master-database-bmas10
+  - test-site-database-bmas10
+  - test-repository-master-bmas10
+  - test-service-master-bmas10
+  - test-solr-master-bmas10
+
+test-red-bmas10-de:
+  - test-preview-database-bmas10
+  - test-adminportal-database-bmas10
+  - test-maildistributor-database-bmas10
+  - test-workflow-database-bmas10
+  - test-adminportal-service-bmas10
+  - test-cas-preview-service-bmas10
+  - test-cas-live-service-bmas10
+  - test-service-preview-bmas10
+  - test-solr-preview-bmas10
+  - test-maildistributor-service-bmas10
+  - test-editor-preview-bmas10
+  - test-workflow-preview-bmas10
+  - test-repository-preview-bmas10
+  - test-delivery-preview-bmas10
+  - test-newsletter-preview-bmas10
+  - test-serviceportal-service-bmas10
+  - test-bmas-preview-bmas10
+  - test-bmas-editor-bmas10
+  - test-ldap-preview-service-bmas10
+  - test-ldap-live-service-bmas10
+  - test-esf-preview-bmas10
+  - test-esf-editor-bmas10
+  - test-inqa-preview-bmas10
+  - test-inqa-editor-bmas10
+
+test-slave01-bmas10-de:
+  - test-replication-database-bmas10
+  - test-repository-replication-bmas10
+
+test-www01-bmas10-de:
+  - test-delivery1-master-bmas10
+  - test-bmas-www01-bmas10
+  - test-bmas-www01-bmas10
+  - test-esf-www01-bmas10
+  - test-inqa-www01-bmas10
+
+test-www02-bmas10-de:
+  - test-delivery1-replication-bmas10
+  - test-bmas-www02-bmas10
+  - test-bmas-www02-bmas10
+  - test-esf-www02-bmas10
+  - test-inqa-www02-bmas10
diff --git a/etc/dns/test_bmf.yaml b/etc/dns/test_bmf.yaml
new file mode 100644 (file)
index 0000000..5c57f83
--- /dev/null
@@ -0,0 +1,66 @@
+---
+test-master01-bmf10-de:
+  - test-master-database-bmf10
+  - test-site-database-bmf10
+  - test-repository-master-bmf10
+  - test-service-master-bmf10
+  - test-solr-master-bmf10
+
+test-red-bmf10-de:
+  - test-preview-database-bmf10
+  - test-adminportal-database-bmf10
+  - test-maildistributor-database-bmf10
+  - test-workflow-database-bmf10
+  - test-adminportal-service-bmf10
+  - test-cas-preview-service-bmf10
+  - test-cas-live-service-bmf10
+  - test-service-preview-bmf10
+  - test-solr-preview-bmf10
+  - test-maildistributor-service-bmf10
+  - test-editor-preview-bmf10
+  - test-workflow-preview-bmf10
+  - test-repository-preview-bmf10
+  - test-delivery-preview-bmf10
+  - test-newsletter-preview-bmf10
+  - test-serviceportal-service-bmf10
+  - test-bmf-preview-bmf10
+  - test-bmf-editor-bmf10
+  - test-ldap-preview-service-bmf10
+  - test-ldap-live-service-bmf10
+
+# customer
+  - test-bmf-preview-bmf10
+  - test-lsth-preview-bmf10
+  - test-amthb-preview-bmf10
+  - test-esth-preview-bmf10
+  - test-ksth-preview-bmf10
+  - test-gewsth-preview-bmf10
+  - test-usth-preview-bmf10
+  - test-bmf-editor-bmf10
+  - test-amthb-editor-bmf10
+
+test-slave01-bmf10-de:
+  - test-replication-database-bmf10
+  - test-repository-replication-bmf10
+
+test-www01-bmf10-de:
+  - test-delivery1-master-bmf10
+  - test-bmf-www01-bmf10
+  - test-bmf-www01-bmf10
+  - test-amthb-www01-bmf10
+  - test-lsth-www01-bmf10
+  - test-esth-www01-bmf10
+  - test-ksth-www01-bmf10
+  - test-gewsth-www01-bmf10
+  - test-usth-www01-bmf10
+
+test-www02-bmf10-de:
+  - test-delivery1-replication-bmf10
+  - test-bmf-www02-bmf10
+  - test-bmf-www02-bmf10
+  - test-amthb-www02-bmf10
+  - test-lsth-www02-bmf10
+  - test-esth-www02-bmf10
+  - test-ksth-www02-bmf10
+  - test-gewsth-www02-bmf10
+  - test-usth-www02-bmf10