Created
December 21, 2012 21:19
-
-
Save jasonthomas/4355909 to your computer and use it in GitHub Desktop.
autosign.conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/env python | |
| ## populate /etc/puppet/autosign.conf based on tags | |
| from boto.ec2 import connect_to_region, regions | |
| region = 'us-west-2' | |
| autosign = '/etc/puppet/autosign.conf' | |
| filters = {'tag:Project': 'amo'} | |
| conn = connect_to_region(region) | |
| reservations = conn.get_all_instances(filters=filters) | |
| private_dns = [i.private_dns_name for r in reservations for i in r.instances] | |
| with open(autosign, 'w') as fp: | |
| for i in private_dns: | |
| fp.write(i + '\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment