Reputation: 31
I want to write a puppet script that can be installed on a machine and automatically check a git repo for changes and apply them to the hostfile.
In reading puppet documentation I commonly see the following explicit reference to a machine's hostname:
node 'node1'{ }
Is there a way for me to deploy this to a number of developer machines and have it update the hosts file without explicitly listing the hostname for each of those machines in the script? Or perhaps there is an even better approach I'm missing?
DNS server is out of the question so please don't suggest that :)
Upvotes: 1
Views: 433
Reputation: 8223
The node
block is meaningful only in a master
/agent
style Puppet setup.
While this is prevalent, there is a strong case for masterless operation.
In your special case, you should definitely solve your problem without a master. Just write either
mytask.pp
file that just declares all resources you care about
puppet apply /path/to/mytask.pp
on each machine orpuppet apply -e 'include mymodule'
The apply
subcommand is the counterpart to puppet agent
if you want to put Puppet to work without involving the puppet master
.
Upvotes: 2
Reputation: 11
If you want to apply to all machines, you can use the following:
node default { }
And you also can use regular expression to include a group of machines, like:
node /^workstation*/ { }
or
node /^workstation[1-8]/ { }
Upvotes: 1