Merge "launch: add puppet environment option"
This commit is contained in:
commit
44f909dc7c
@ -94,7 +94,7 @@ def stream_syslog(ssh_client):
|
||||
|
||||
|
||||
def bootstrap_server(server, key, name, volume_device, keep,
|
||||
mount_path, fs_label):
|
||||
mount_path, fs_label, environment):
|
||||
|
||||
ip = server.public_v4
|
||||
ssh_kwargs = dict(pkey=key)
|
||||
@ -199,6 +199,10 @@ def bootstrap_server(server, key, name, volume_device, keep,
|
||||
'-e', 'target={name}'.format(name=name),
|
||||
]
|
||||
|
||||
if environment is not None:
|
||||
ansible_cmd += [
|
||||
'-e',
|
||||
'puppet_environment={env}'.format(env=environment)]
|
||||
# Run the remote puppet apply playbook limited to just this server
|
||||
# we just created
|
||||
for playbook in [
|
||||
@ -221,7 +225,7 @@ def bootstrap_server(server, key, name, volume_device, keep,
|
||||
|
||||
def build_server(cloud, name, image, flavor,
|
||||
volume, keep, network, boot_from_volume, config_drive,
|
||||
mount_path, fs_label, availability_zone):
|
||||
mount_path, fs_label, availability_zone, environment):
|
||||
key = None
|
||||
server = None
|
||||
|
||||
@ -264,7 +268,7 @@ def build_server(cloud, name, image, flavor,
|
||||
else:
|
||||
volume_device = None
|
||||
bootstrap_server(server, key, name, volume_device, keep,
|
||||
mount_path, fs_label)
|
||||
mount_path, fs_label, environment)
|
||||
print('UUID=%s\nIPV4=%s\nIPV6=%s\n' % (
|
||||
server.id, server.public_v4, server.public_v6))
|
||||
except Exception:
|
||||
@ -306,6 +310,9 @@ def main():
|
||||
parser.add_argument("--image", dest="image",
|
||||
default="Ubuntu 14.04 LTS (Trusty Tahr) (PVHVM)",
|
||||
help="image name")
|
||||
parser.add_argument("--environment", dest="environment",
|
||||
help="Puppet environment to use",
|
||||
default=None)
|
||||
parser.add_argument("--volume", dest="volume",
|
||||
help="UUID of volume to attach to the new server.",
|
||||
default=None)
|
||||
@ -369,7 +376,8 @@ def main():
|
||||
options.network, options.boot_from_volume,
|
||||
options.config_drive,
|
||||
options.mount_path, options.fs_label,
|
||||
options.availability_zone)
|
||||
options.availability_zone,
|
||||
options.environment)
|
||||
dns.print_dns(cloud, server)
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user