To bootstrap the cluster,::
- sudo ceph-daemon bootstrap --mon-ip *<mon-ip>* --output-config ceph.conf --output-keyring ceph.keyring --output-pub-ssh-key ceph.pub
+ sudo ceph-daemon bootstrap --mon-ip *<mon-ip>*
This command does a few things:
local host. A minimal configuration file needed to communicate with
the new cluster is written to ``ceph.conf`` in the local directory.
* A copy of the ``client.admin`` administrative (privileged!) secret
- key is written to ``ceph.keyring`` in the local directory.
+ key is written to ``ceph.client.admin.keyring`` in the local directory.
* Generates a new SSH key, and adds the public key to the local root user's
``/root/.ssh/authorized_keys`` file. A copy of the public key is written
to ``ceph.pub`` in the local directory.
def command_bootstrap():
# type: () -> int
+
+ # verify output files
+ if not args.allow_overwrite:
+ for f in [args.output_config, args.output_keyring, args.output_pub_ssh_key]:
+ if os.path.exists(f):
+ raise RuntimeError('%s already exists; delete or pass '
+ '--allow-overwrite to overwrite' % f)
+
+ # initial vars
fsid = args.fsid or make_fsid()
hostname = get_hostname()
mon_id = args.mon_id or hostname
'[client.crash.%s]\n\tkey = %s\n' % (hostname, crash_key))
# output files
- if args.output_keyring:
- with open(args.output_keyring, 'w') as f:
- os.fchmod(f.fileno(), 0o600)
- f.write('[client.admin]\n'
- '\tkey = ' + admin_key + '\n')
- logger.info('Wrote keyring to %s' % args.output_keyring)
- if args.output_config:
- with open(args.output_config, 'w') as f:
- f.write(config)
- logger.info('Wrote config to %s' % args.output_config)
+ with open(args.output_keyring, 'w') as f:
+ os.fchmod(f.fileno(), 0o600)
+ f.write('[client.admin]\n'
+ '\tkey = ' + admin_key + '\n')
+ logger.info('Wrote keyring to %s' % args.output_keyring)
+
+ with open(args.output_config, 'w') as f:
+ f.write(config)
+ logger.info('Wrote config to %s' % args.output_config)
logger.info('Waiting for mgr to start...')
while True:
tmp_pub.write(ssh_pub)
tmp_pub.flush()
- if args.output_pub_ssh_key:
- with open(args.output_pub_ssh_key, 'w') as f:
- f.write(ssh_pub)
- logger.info('Wrote public SSH key to to %s' % args.output_pub_ssh_key)
+ with open(args.output_pub_ssh_key, 'w') as f:
+ f.write(ssh_pub)
+ logger.info('Wrote public SSH key to to %s' % args.output_pub_ssh_key)
cli([
'config-key',
args.initial_dashboard_user,
password))
- if args.output_config and args.output_keyring:
- logger.info('You can access the Ceph CLI with:\n\n'
- '\tsudo %s shell -c %s -k %s\n' % (
- sys.argv[0],
- args.output_config,
- args.output_keyring))
+ logger.info('You can access the Ceph CLI with:\n\n'
+ '\tsudo %s shell -c %s -k %s\n' % (
+ sys.argv[0],
+ args.output_config,
+ args.output_keyring))
+
logger.info('Bootstrap complete.')
return 0
help='cluster FSID')
parser_bootstrap.add_argument(
'--output-keyring',
+ default='ceph.client.admin.keyring',
help='location to write keyring file with new cluster admin and mon keys')
parser_bootstrap.add_argument(
'--output-config',
+ default='ceph.conf',
help='location to write conf file to connect to new cluster')
parser_bootstrap.add_argument(
'--output-pub-ssh-key',
+ default='ceph.pub',
help='location to write the cluster\'s public SSH key')
parser_bootstrap.add_argument(
'--skip-ssh',
'--skip-pull',
action='store_true',
help='do not pull the latest image before bootstrapping')
+ parser_bootstrap.add_argument(
+ '--allow-overwrite',
+ action='store_true',
+ help='allow overwrite of existing --output-* config/keyring/ssh files')
parser_deploy = subparsers.add_parser(
'deploy', help='deploy a daemon')