Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit20bbbfb

Browse files
committed
[#43121095] Add puppet.loadhosts task
Loads hosts that use given Puppet class(es). This differs from the `class` taskwhich only returns nodes of a given "role". It uses the functionality addedto `govuk_node_list` in:https://github.gds/gds/puppet/commit/d986313df235af0ac225f8e7f3e5838574a3dec0For example, to run a command on machines that include the `redis` and`govuk::apps::govuk_crawler_worker` hosts. Note there is `logs-redis-N` inaddition to `redis-N`: (fabric)➜ fabric-scripts git:(puppet_loadhosts_by_classes) fab --hide=running,status preview puppet.loadhosts:redis,govuk::apps::govuk_crawler_worker hosts logs-redis-1.management.production logs-redis-2.management.production mirrorer-1.management.production redis-1.backend.production redis-2.backend.production
1 parent3831dba commit20bbbfb

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
@@ -1,5 +1,13 @@
11
fromfabric.apiimport*
22

3+
@task
4+
defloadhosts(*classnames):
5+
"""Load hosts that include given Puppet class(es)"""
6+
classnames=','.join(classnames)
7+
withhide('running','stdout'):
8+
withsettings(host_string=env.gateway,gateway=None):
9+
env.hosts=run('govuk_node_list -C %s'%classnames).splitlines()
10+
311
defpuppet(*args):
412
sudo('govuk_puppet %s'%' '.join(args))
513

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp