Fix launch-node for non-official environments.
Infrastructures derived from the OpenStack CI infrastructure currently need to fork launch-node.py, better if it just takes an option ;). Change-Id: Iad94451ed2b4da425f059595ae727dcf2847733a
This commit is contained in:
parent
0e5baad93f
commit
5f717e6ec9
@ -44,6 +44,11 @@ automatically). Note that this example assumes you've already
|
|||||||
exported a relevant FQDN and sourced the appropriate API credentials
|
exported a relevant FQDN and sourced the appropriate API credentials
|
||||||
above.
|
above.
|
||||||
|
|
||||||
|
When running outside the official OpenStack CI infrastructure, you
|
||||||
|
will want to pass --server ci-puppetmaster.example.com otherwise the
|
||||||
|
new node wil try to register with ci-puppetmaster.openstack.org - and
|
||||||
|
fail hilariously.
|
||||||
|
|
||||||
Add DNS Records
|
Add DNS Records
|
||||||
===============
|
===============
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ def get_client():
|
|||||||
return client
|
return client
|
||||||
|
|
||||||
def bootstrap_server(server, admin_pass, key, cert, environment, name,
|
def bootstrap_server(server, admin_pass, key, cert, environment, name,
|
||||||
salt_priv, salt_pub):
|
salt_priv, salt_pub, puppetmaster):
|
||||||
client = server.manager.api
|
client = server.manager.api
|
||||||
ip = utils.get_public_ip(server)
|
ip = utils.get_public_ip(server)
|
||||||
if not ip:
|
if not ip:
|
||||||
@ -122,13 +122,14 @@ def bootstrap_server(server, admin_pass, key, cert, environment, name,
|
|||||||
|
|
||||||
ssh_client.ssh("puppet agent "
|
ssh_client.ssh("puppet agent "
|
||||||
"--environment %s "
|
"--environment %s "
|
||||||
"--server ci-puppetmaster.openstack.org "
|
"--server %s "
|
||||||
"--no-daemonize --verbose --onetime --pluginsync true "
|
"--no-daemonize --verbose --onetime --pluginsync true "
|
||||||
"--certname %s" % (environment, certname))
|
"--certname %s" % (environment, puppetmaster, certname))
|
||||||
|
|
||||||
ssh_client.ssh("reboot")
|
ssh_client.ssh("reboot")
|
||||||
|
|
||||||
def build_server(client, name, image, flavor, cert, environment, salt):
|
def build_server(
|
||||||
|
client, name, image, flavor, cert, environment, salt, puppetmaster):
|
||||||
key = None
|
key = None
|
||||||
server = None
|
server = None
|
||||||
|
|
||||||
@ -156,7 +157,7 @@ def build_server(client, name, image, flavor, cert, environment, salt):
|
|||||||
admin_pass = server.adminPass
|
admin_pass = server.adminPass
|
||||||
server = utils.wait_for_resource(server)
|
server = utils.wait_for_resource(server)
|
||||||
bootstrap_server(server, admin_pass, key, cert, environment, name,
|
bootstrap_server(server, admin_pass, key, cert, environment, name,
|
||||||
salt_priv, salt_pub)
|
salt_priv, salt_pub, puppetmaster)
|
||||||
print('UUID=%s\nIPV4=%s\nIPV6=%s\n' % (server.id,
|
print('UUID=%s\nIPV4=%s\nIPV6=%s\n' % (server.id,
|
||||||
server.accessIPv4,
|
server.accessIPv4,
|
||||||
server.accessIPv6))
|
server.accessIPv6))
|
||||||
@ -187,6 +188,8 @@ def main():
|
|||||||
"hostname.example.com.pem)")
|
"hostname.example.com.pem)")
|
||||||
parser.add_argument("--salt", dest="salt", action="store_true",
|
parser.add_argument("--salt", dest="salt", action="store_true",
|
||||||
help="Manage salt keys for this host.")
|
help="Manage salt keys for this host.")
|
||||||
|
parser.add_argument("--server", dest="server", help="Puppetmaster to use.",
|
||||||
|
default="ci-puppetmaster.openstack.org")
|
||||||
options = parser.parse_args()
|
options = parser.parse_args()
|
||||||
|
|
||||||
client = get_client()
|
client = get_client()
|
||||||
@ -226,7 +229,7 @@ def main():
|
|||||||
print "Found image", image
|
print "Found image", image
|
||||||
|
|
||||||
build_server(client, options.name, image, flavor, cert,
|
build_server(client, options.name, image, flavor, cert,
|
||||||
options.environment, options.salt)
|
options.environment, options.salt, options.server)
|
||||||
dns.print_dns(client, options.name)
|
dns.print_dns(client, options.name)
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
Loading…
Reference in New Issue
Block a user