Merge "Improve launch-node deps and fix script bugs"
This commit is contained in:
commit
6ba92c3a52
@ -14,11 +14,11 @@ classifiers = [
|
||||
]
|
||||
dependencies = [
|
||||
"paramiko>=2.9.1",
|
||||
# This is a very specific list which is known to work
|
||||
# with RAX storage...
|
||||
"python-openstackclient==4.0.2",
|
||||
"python-cinderclient==9.1.0",
|
||||
"openstacksdk==0.102.0"
|
||||
"python-openstackclient",
|
||||
# Minimum to work with clouds like RAX that don't take network:auto
|
||||
"openstacksdk>=0.103",
|
||||
# Pin to a version of cinderclient known to work with RAX storage...
|
||||
"python-cinderclient<8",
|
||||
]
|
||||
|
||||
[project.urls]
|
||||
|
@ -96,7 +96,8 @@ def stream_syslog(ssh_client):
|
||||
|
||||
|
||||
def bootstrap_server(server, key, name, volume_device, keep,
|
||||
mount_path, fs_label, environment, timeout, ignore_ipv6):
|
||||
mount_path, fs_label, environment, timeout, ignore_ipv6,
|
||||
playbooks):
|
||||
|
||||
ip = server.public_v4
|
||||
ssh_kwargs = dict(pkey=key)
|
||||
@ -156,8 +157,11 @@ def bootstrap_server(server, key, name, volume_device, keep,
|
||||
|
||||
# Zero the ansible inventory cache so that next run finds the new server
|
||||
inventory_cache_dir = '/var/cache/ansible/inventory'
|
||||
for inventory_cache in os.listdir(inventory_cache_dir):
|
||||
os.unlink(os.path.join(inventory_cache_dir, inventory_cache))
|
||||
try:
|
||||
for inventory_cache in os.listdir(inventory_cache_dir):
|
||||
os.unlink(os.path.join(inventory_cache_dir, inventory_cache))
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
|
||||
with JobDir(keep) as jobdir:
|
||||
# Update the generated-groups file globally and incorporate it
|
||||
@ -211,8 +215,7 @@ def bootstrap_server(server, key, name, volume_device, keep,
|
||||
'base.yaml',
|
||||
'apply-package-updates.yaml',
|
||||
]:
|
||||
run(ansible_cmd + [
|
||||
os.path.join(SCRIPT_DIR, '..', 'playbooks', playbook)],
|
||||
run(ansible_cmd + [os.path.join(playbooks, playbook)],
|
||||
env=jobdir.env)
|
||||
|
||||
try:
|
||||
@ -229,7 +232,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, environment,
|
||||
volume_size, timeout, ignore_ipv6):
|
||||
volume_size, timeout, ignore_ipv6, playbooks):
|
||||
key = None
|
||||
server = None
|
||||
|
||||
@ -275,7 +278,8 @@ def build_server(cloud, name, image, flavor,
|
||||
else:
|
||||
volume_device = None
|
||||
bootstrap_server(server, key, name, volume_device, keep,
|
||||
mount_path, fs_label, environment, timeout, ignore_ipv6)
|
||||
mount_path, fs_label, environment, timeout,
|
||||
ignore_ipv6, playbooks)
|
||||
print('UUID=%s\nIPV4=%s\nIPV6=%s\n' % (
|
||||
server.id, server.public_v4, server.public_v6))
|
||||
except Exception:
|
||||
@ -322,7 +326,7 @@ def main():
|
||||
parser.add_argument("--flavor", dest="flavor", default='1GB',
|
||||
help="name (or substring) of flavor")
|
||||
parser.add_argument("--image", dest="image",
|
||||
default="Ubuntu 20.04 LTS (Focal Fossa) (Cloud)",
|
||||
default="Ubuntu 22.04 LTS (Jammy Jellyfish) (Cloud)",
|
||||
help="image name")
|
||||
parser.add_argument("--environment", dest="environment",
|
||||
help="Puppet environment to use",
|
||||
@ -362,9 +366,12 @@ def main():
|
||||
parser.add_argument("--ignore_ipv6", dest="ignore_ipv6",
|
||||
help="Ignore IPv6 addresses from API",
|
||||
action='store_true', default=False)
|
||||
|
||||
parser.add_argument("--az", dest="availability_zone", default=None,
|
||||
help="AZ to boot in.")
|
||||
parser.add_argument("--playbooks", dest="playbooks",
|
||||
default="/home/zuul/src/opendev.org/opendev/"
|
||||
"system-config/playbooks",
|
||||
help="alternative playbook directory")
|
||||
options = parser.parse_args()
|
||||
|
||||
openstack.enable_logging(debug=options.verbose)
|
||||
@ -407,7 +414,8 @@ def main():
|
||||
options.mount_path, options.fs_label,
|
||||
options.availability_zone,
|
||||
options.environment, options.volume_size,
|
||||
options.timeout, options.ignore_ipv6)
|
||||
options.timeout, options.ignore_ipv6,
|
||||
options.playbooks)
|
||||
dns.print_dns(cloud, server)
|
||||
print("If this is a server that is expected to send email (ask, review,")
|
||||
print("lists, etc) double check that the server's IPs are not listed on")
|
||||
|
Loading…
Reference in New Issue
Block a user