Book Image

Puppet Cookbook - Third Edition

Book Image

Puppet Cookbook - Third Edition

Overview of this book

Table of Contents (17 chapters)
Puppet Cookbook Third Edition
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Storing secret data with hiera-gpg


If you're using Hiera to store your configuration data, there's a gem available called hiera-gpg that adds an encryption backend to Hiera to allow you to protect values stored in Hiera.

Getting ready

To set up hiera-gpg, follow these steps:

  1. Install the ruby-dev package; it will be required to build the hiera-gpg gem as follows:

    root@puppet:~# puppet resource package ruby-dev ensure=installed
    Notice: /Package[ruby-dev]/ensure: ensure changed 'purged' to 'present'
    package { 'ruby-dev':
      ensure => '1:1.9.3',
    }
    
  2. Install the hiera-gpg gem using the gem provider:

    root@puppet:~# puppet resource package hiera-gpg ensure=installed provider=gem
    Notice: /Package[hiera-gpg]/ensure: created
    package { 'hiera-gpg':
      ensure => ['1.1.0'],
    }
    
  3. Modify your hiera.yaml file as follows:

        :hierarchy:
            - secret
            - common
        :backends:
            - yaml
            - gpg
        :yaml:
            :datadir: '/etc/puppet/hieradata'
        :gpg:
            :datadir: '/etc/puppet/secret...