From 416f957e798e79d0f7615030747f3a7cf483453d Mon Sep 17 00:00:00 2001 From: Kyle Anderson Date: Thu, 11 Sep 2014 22:10:10 -0700 Subject: [PATCH 1/2] Updated the readme for style and syntax highlighting --- README.md | 184 +++++++++++++++++++++++++++++------------------------- 1 file changed, 99 insertions(+), 85 deletions(-) diff --git a/README.md b/README.md index a6c7fc88..111dd388 100644 --- a/README.md +++ b/README.md @@ -22,99 +22,113 @@ or Tweak and add the following to your site manifest: - node 'server.example.com' { - include dns::server - - # Forwarders - dns::server::options{ '/etc/bind/named.conf.options': - forwarders => [ '8.8.8.8', '8.8.4.4' ] - } - - # Forward Zone - dns::zone { 'example.com': - soa => "ns1.example.com", - soa_email => 'admin.example.com', - nameservers => ["ns1"] - } - - # Reverse Zone - dns::zone { '1.168.192.IN-ADDR.ARPA': - soa => "ns1.example.com", - soa_email => 'admin.example.com', - nameservers => ["ns1"] - } - - # A Records: - dns::record::a { - 'huey': - zone => 'example.com', - data => ["98.76.54.32"]; - 'duey': - zone => 'example.com', - data => ["12.34.56.78", "12.23.34.45"]; - 'luey': - zone => 'example.com', - data => ["192.168.1.25"], - ptr => true; # Creates a matching reverse zone record. Make sure you've added the proper reverse zone in the manifest. - } - - # MX Records: - dns::record::mx { - 'mx,0': - zone => 'example.com', - preference => 0, - data => 'ASPMX.L.GOOGLE.com'; - 'mx,10': - zone => 'example.com', - preference => 10, - data => 'ALT1.ASPMX.L.GOOGLE.com'; - } - - # CNAME Record: - dns::record::cname { 'www': - zone => 'example.com', - data => 'huey.example.com', - } - - # TXT Record: - dns::record::txt { 'www': - zone => 'example.com', - data => 'Hello World', - } - } +```puppet +node 'server.example.com' { + include dns::server + + # Forwarders + dns::server::options { '/etc/bind/named.conf.options': + forwarders => [ '8.8.8.8', '8.8.4.4' ] + } + + # Forward Zone + dns::zone { 'example.com': + soa => 'ns1.example.com', + soa_email => 'admin.example.com', + nameservers => ['ns1'] + } + + # Reverse Zone + dns::zone { '1.168.192.IN-ADDR.ARPA': + soa => 'ns1.example.com', + soa_email => 'admin.example.com', + nameservers => ['ns1'] + } + + # A Records: + dns::record::a { + 'huey': + zone => 'example.com', + data => ['98.76.54.32']; + 'duey': + zone => 'example.com', + data => ['12.34.56.78', "12.23.34.45']; + 'luey': + zone => 'example.com', + data => ['192.168.1.25'], + ptr => true; # Creates a matching reverse zone record. Make sure you've added the proper reverse zone in the manifest. + } + + # MX Records: + dns::record::mx { + 'mx,0': + zone => 'example.com', + preference => 0, + data => 'ASPMX.L.GOOGLE.com'; + 'mx,10': + zone => 'example.com', + preference => 10, + data => 'ALT1.ASPMX.L.GOOGLE.com'; + } + + # CNAME Record: + dns::record::cname { 'www': + zone => 'example.com', + data => 'huey.example.com', + } + + # TXT Record: + dns::record::txt { 'www': + zone => 'example.com', + data => 'Hello World', + } +} +``` You can also declare forwarders for a specific zone, if you don't have one in the dns::option. - dns::zone { 'example.com': - soa => "ns1.example.com", - soa_email => 'admin.example.com', - allow_forwarder => ['8.8.8.8'], - forward_policy => 'first' - nameservers => ["ns1"] - } +```puppet +dns::zone { 'example.com': + soa => 'ns1.example.com', + soa_email => 'admin.example.com', + allow_forwarder => ['8.8.8.8'], + forward_policy => 'first', + nameservers => ['ns1'], +} +``` You can change the checking of the domain name. The policy can be either warn fail or ignore. - dns::option { - check_name_master = 'fail' - check_name_slave = 'warn' - check_name_remote = 'ignore' - } +```puppet +dns::server::options { '/etc/bind/named.conf.options': + check_name_master => 'fail', + check_name_slave => 'warn', + check_name_remote => 'ignore', + forwarders => [ '8.8.8.8', '4.4.4.4' ], +} +``` ### Exported resource patterns - node default { - # Other nodes export an A record for thier hostname - @@dns::record::a { $hostname: zone => $::domain, data => $::ipaddress, } - } - node 'ns1.xkyle.com' { - dns::zone { $::domain: - soa => $::fqdn, - soa_email => "admin.${::domain}", - nameservers => [ 'ns1' ], - } - # Collect all the records from other nodes - Dns::Record::A <<||>> - } + +```puppet +node default { + # Other nodes export an A record for thier hostname + @@dns::record::a { $::hostname: + zone => $::domain, + data => $::ipaddress, + } +} + +node 'ns1.xkyle.com' { + dns::zone { $::domain: + soa => $::fqdn, + soa_email => "admin.${::domain}", + nameservers => [ 'ns1' ], + } + # Collect all the records from other nodes + Dns::Record::A <<||>> +} +``` ## Contributing From c8824291b8c2cf842987d87f85c64c76733dbe8d Mon Sep 17 00:00:00 2001 From: Kyle Anderson Date: Thu, 11 Sep 2014 22:13:00 -0700 Subject: [PATCH 2/2] Added contributing doc to try to help with testing --- CONTRIBUTING.md | 81 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..4afeb579 --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,81 @@ +Checklist +================================================= + + - Fork the repository on GitHub. + + - Make changes on a branch *with tests* + + - Run tests `bundle exec rake spec` + + - Check for style `bundle exec rake lint` + + - Push your changes to a topic branch in your fork of the + repository. (the format ticket/1234-short_description_of_change is + usually preferred for this project). + + - Submit a pull request to the repository + + +Testing +======= + +Getting Started +--------------- + +Our puppet modules provide [`Gemfile`](./Gemfile)s which can tell a ruby +package manager such as [bundler](http://bundler.io/) what Ruby packages, +or Gems, are required to build, develop, and test this software. + +Please make sure you have [bundler installed](http://bundler.io/#getting-started) +on your system, then use it to install all dependencies needed for this project, +by running + +```shell +% bundle install +Fetching gem metadata from https://rubygems.org/........ +Fetching gem metadata from https://rubygems.org/.. +Using rake (10.1.0) +Using builder (3.2.2) +-- 8><-- many more --><8 -- +Using rspec-system-puppet (2.2.0) +Using serverspec (0.6.3) +Using rspec-system-serverspec (1.0.0) +Using bundler (1.3.5) +Your bundle is complete! +Use `bundle show [gemname]` to see where a bundled gem is installed. +``` + +NOTE some systems may require you to run this command with sudo. + + +Running Tests +------------- + +```shell +$ bundle exec rake spec +Cloning into 'spec/fixtures/modules/stdlib'... +remote: Counting objects: 5550, done. +remote: Total 5550 (delta 0), reused 0 (delta 0) +Receiving objects: 100% (5550/5550), 1.09 MiB | 271.00 KiB/s, done. +Resolving deltas: 100% (2302/2302), done. +Checking connectivity... done. +HEAD is now at 9e8127b Merge pull request #313 from mhaskel/spec_updates +Cloning into 'spec/fixtures/modules/concat'... +remote: Counting objects: 1467, done. +remote: Compressing objects: 100% (87/87), done. +remote: Total 1467 (delta 52), reused 2 (delta 0) +Receiving objects: 100% (1467/1467), 319.82 KiB | 256.00 KiB/s, done. +Resolving deltas: 100% (688/688), done. +..................................................................... + +Finished in 4.59 seconds +69 examples, 0 failures + +Total resources: 72 +Touched resources: 22 +Resource coverage: 30.56% +``` + +Writing Tests +------------ +See the [tutorial](http://rspec-puppet.com/tutorial/)