Skip to content

Instantly share code, notes, and snippets.

@devsecfranklin
Last active January 6, 2018 02:13
Show Gist options
  • Save devsecfranklin/e93dd1abd58015318c3eba95bcc93c67 to your computer and use it in GitHub Desktop.
Save devsecfranklin/e93dd1abd58015318c3eba95bcc93c67 to your computer and use it in GitHub Desktop.

Edit file common.yaml

iac_workshop/puppetlabs/code/environments/production/data/common.yaml needs two new lines.

dnsserver    :  ‘8.8.4.4’
searchdomain : ‘amazonaws.com’

Create new Puppet Manifest

iac_workshop/puppetlabs/code/environments/production/modules/profile/manifests/dns.pp`

class dns {
  $dnsserver    = hiera('dnsserver')
  $searchdomain = hiera('searchdomain')

  file { '/etc/resolv.conf':
    content => "search ${searchdomain}\n nameserver ${dnsserver}\n",
  }
}

Don't Forget to Update the Role

Finally, we need to update the file iac_workshop/puppetlabs/code/environments/production/modules/role/manifest/iac_node.pp

Add this line to the end:

include profile::dns

Check the Formatting

puppet parser validate iac_node.pp
puppet parser validate dns.pp
puppet-lint -f iac-node.pp
puppet-lint -f dns.pp

Apply Puppet

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment