def deploy(ref): """Deploy a new version""" localdeploy(ref) instance = ec2.get_instances_by_tags({'Type': 'aggregator'}) if not instance: aws.create_server('aggregator', subnet_id=fabconfig.SUBNET_ID) elif len(instance) > 1: raise Exception('More than one aggregator instance exists') else: with settings(hosts=[instance[0].private_ip_address]): execute(remote_install_app)
def print_type(instance_type): output.status = False # easier to use in bash scripts with this. instances = ec2.get_instances_by_tags({'Type': instance_type}) for i in instances: print i.private_ip_address
def run_puppet(instance_type='*'): """Runs puppetd -t all hosts specified by type""" instances = ec2.get_instances_by_tags({'Type': instance_type}) with settings(hosts=[i.private_ip_address for i in instances if i.private_ip_address]): execute(_run_puppet)