Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 40b5820

Browse files
committed
Merge pull request alphagov#107 from alphagov/lookup-hiera
Add a task to lookup hieradata
2 parents 9314c4f + ac8e48f commit 40b5820

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

puppet.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,3 +36,11 @@ def check_disabled():
3636
def dryrun(*args):
3737
"""Run puppet agent but make no changes to the system"""
3838
puppet('--noop', *args)
39+
40+
@task
41+
@hosts('puppetmaster-1.management')
42+
def lookup_hieradata(key):
43+
puppet_directory = '/usr/share/puppet/production/current'
44+
config_file = '{0}/hiera.yml'.format(puppet_directory)
45+
variables = '::environment=production ::lsbdistcodename=precise ::settings::manifestdir={0}/manifests'.format(puppet_directory)
46+
run('hiera --config {0} {1} {2}'.format(config_file, key, variables))

0 commit comments

Comments
 (0)