Add bifrost-cli enroll
command
Change-Id: I14979136e8c3befaabce9c6b169b5d6659f42812
This commit is contained in:
parent
27da1c25da
commit
a93cb48663
@ -171,6 +171,21 @@ def cmd_install(args):
|
|||||||
"See documentation for next steps")
|
"See documentation for next steps")
|
||||||
|
|
||||||
|
|
||||||
|
def cmd_enroll(args):
|
||||||
|
inventory = os.path.join(PLAYBOOKS, 'inventory', 'bifrost_inventory.py')
|
||||||
|
if os.path.exists(args.inventory):
|
||||||
|
nodes_inventory = os.path.abspath(args.inventory)
|
||||||
|
os.environ['BIFROST_INVENTORY_SOURCE'] = nodes_inventory
|
||||||
|
else:
|
||||||
|
sys.exit('Inventory file %s cannot be found' % args.inventory)
|
||||||
|
|
||||||
|
ansible('enroll-dynamic.yaml',
|
||||||
|
inventory=inventory,
|
||||||
|
verbose=args.debug,
|
||||||
|
inspect_nodes=args.inspect,
|
||||||
|
extra_vars=args.extra_vars)
|
||||||
|
|
||||||
|
|
||||||
def parse_args():
|
def parse_args():
|
||||||
parser = argparse.ArgumentParser("Bifrost CLI")
|
parser = argparse.ArgumentParser("Bifrost CLI")
|
||||||
parser.add_argument('--debug', action='store_true',
|
parser.add_argument('--debug', action='store_true',
|
||||||
@ -243,6 +258,16 @@ def parse_args():
|
|||||||
install.add_argument('-e', '--extra-vars', action='append',
|
install.add_argument('-e', '--extra-vars', action='append',
|
||||||
help='additional vars to pass to ansible')
|
help='additional vars to pass to ansible')
|
||||||
|
|
||||||
|
enroll = subparsers.add_parser(
|
||||||
|
'enroll', help='Enroll bare metal nodes')
|
||||||
|
enroll.set_defaults(func=cmd_enroll)
|
||||||
|
enroll.add_argument('inventory', default='baremetal-inventory.json',
|
||||||
|
help='file with the inventory')
|
||||||
|
enroll.add_argument('--inspect', action='store_true',
|
||||||
|
help='inspect nodes while enrolling')
|
||||||
|
enroll.add_argument('-e', '--extra-vars', action='append',
|
||||||
|
help='additional vars to pass to ansible')
|
||||||
|
|
||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
if getattr(args, 'func', None) is None:
|
if getattr(args, 'func', None) is None:
|
||||||
parser.print_usage(file=sys.stderr)
|
parser.print_usage(file=sys.stderr)
|
||||||
|
@ -123,6 +123,10 @@ injection can be found in the ``playbooks/inventory/`` folder.
|
|||||||
How this works?
|
How this works?
|
||||||
---------------
|
---------------
|
||||||
|
|
||||||
|
Starting with the Wallaby cycle, you can use ``bifrost-cli`` for enrolling::
|
||||||
|
|
||||||
|
./bifrost-cli enroll /tmp/baremetal.json
|
||||||
|
|
||||||
Utilizing the dynamic inventory module, enrollment is as simple as setting
|
Utilizing the dynamic inventory module, enrollment is as simple as setting
|
||||||
the ``BIFROST_INVENTORY_SOURCE`` environment variable to your inventory data
|
the ``BIFROST_INVENTORY_SOURCE`` environment variable to your inventory data
|
||||||
source, and then executing the enrollment playbook.::
|
source, and then executing the enrollment playbook.::
|
||||||
|
@ -0,0 +1,4 @@
|
|||||||
|
---
|
||||||
|
features:
|
||||||
|
- |
|
||||||
|
Adds a new command ``bifrost-cli enroll`` to simplify enrolling nodes.
|
Loading…
x
Reference in New Issue
Block a user