Returns the name of a init system (upstart, sysvinit ...).
"""
- return 'sysvinit'
+ if module.normalized_release.int_major < 7:
+ return 'sysvinit'
+
+ if not module.conn.remote_module.path_exists("/usr/lib/systemd/system/ceph.target"):
+ return 'sysvinit'
+
+ return 'systemd'
def get_packager(module):
return pkg_managers.Yum(module)
def create(distro, args, monitor_keyring):
hostname = distro.conn.remote_module.shortname()
common.mon_create(distro, args, monitor_keyring, hostname)
- service = distro.conn.remote_module.which_service()
- remoto.process.run(
- distro.conn,
- [
- service,
- 'ceph',
- '-c',
- '/etc/ceph/{cluster}.conf'.format(cluster=args.cluster),
- 'start',
- 'mon.{hostname}'.format(hostname=hostname)
- ],
- timeout=7,
- )
+ if distro.init == 'sysvinit':
+ service = distro.conn.remote_module.which_service()
+ remoto.process.run(
+ distro.conn,
+ [
+ service,
+ 'ceph',
+ '-c',
+ '/etc/ceph/{cluster}.conf'.format(cluster=args.cluster),
+ 'start',
+ 'mon.{hostname}'.format(hostname=hostname)
+ ],
+ timeout=7,
+ )
- system.enable_service(distro.conn)
+ system.enable_service(distro.conn)
+ elif distro.init == 'systemd':
+ # enable ceph target for this host (in case it isn't already enabled)
+ remoto.process.run(
+ distro.conn,
+ [
+ 'systemctl',
+ 'enable',
+ 'ceph.target'
+ ],
+ timeout=7,
+ )
+
+ # enable and start this mon instance
+ remoto.process.run(
+ distro.conn,
+ [
+ 'systemctl',
+ 'enable',
+ 'ceph-mon@{hostname}'.format(hostname=hostname),
+ ],
+ timeout=7,
+ )
+ remoto.process.run(
+ distro.conn,
+ [
+ 'systemctl',
+ 'start',
+ 'ceph-mon@{hostname}'.format(hostname=hostname),
+ ],
+ timeout=7,
+ )
Returns the name of a init system (upstart, sysvinit ...).
"""
- if module.normalized_release.int_major >= 22:
- return 'systemd'
- else:
+
+ if not module.conn.remote_module.path_exists("/usr/lib/systemd/system/ceph.target"):
return 'sysvinit'
+ return 'systemd'
+
def get_packager(module):
if module.normalized_release.int_major >= 22:
return pkg_managers.DNF(module)
from ceph_deploy.hosts import common
+from ceph_deploy.util import system
from ceph_deploy.lib import remoto
hostname = distro.conn.remote_module.shortname()
common.mon_create(distro, args, monitor_keyring, hostname)
- # enable ceph target for this host (in case it isn't already enabled)
- remoto.process.run(
- distro.conn,
- [
- 'systemctl',
- 'enable',
- 'ceph.target'
- ],
- timeout=7,
- )
+ if distro.init == 'sysvinit':
+ service = distro.conn.remote_module.which_service()
+ remoto.process.run(
+ distro.conn,
+ [
+ service,
+ 'ceph',
+ '-c',
+ '/etc/ceph/{cluster}.conf'.format(cluster=args.cluster),
+ 'start',
+ 'mon.{hostname}'.format(hostname=hostname)
+ ],
+ timeout=7,
+ )
- # enable and start this mon instance
- remoto.process.run(
- distro.conn,
- [
- 'systemctl',
- 'enable',
- 'ceph-mon@{hostname}'.format(hostname=hostname),
- ],
- timeout=7,
- )
- remoto.process.run(
- distro.conn,
- [
- 'systemctl',
- 'start',
- 'ceph-mon@{hostname}'.format(hostname=hostname),
- ],
- timeout=7,
- )
+ system.enable_service(distro.conn)
+ elif distro.init == 'systemd':
+ # enable ceph target for this host (in case it isn't already enabled)
+ remoto.process.run(
+ distro.conn,
+ [
+ 'systemctl',
+ 'enable',
+ 'ceph.target'
+ ],
+ timeout=7,
+ )
+
+ # enable and start this mon instance
+ remoto.process.run(
+ distro.conn,
+ [
+ 'systemctl',
+ 'enable',
+ 'ceph-mon@{hostname}'.format(hostname=hostname),
+ ],
+ timeout=7,
+ )
+ remoto.process.run(
+ distro.conn,
+ [
+ 'systemctl',
+ 'start',
+ 'ceph-mon@{hostname}'.format(hostname=hostname),
+ ],
+ timeout=7,
+ )
Returns the name of a init system (upstart, sysvinit ...).
"""
- return 'sysvinit'
+ if module.normalized_release.int_major < 7:
+ return 'sysvinit'
+
+ if not module.conn.remote_module.path_exists("/usr/lib/systemd/system/ceph.target"):
+ return 'sysvinit'
+
+ return 'systemd'
def get_packager(module):
return pkg_managers.Yum(module)
def create(distro, args, monitor_keyring):
hostname = distro.conn.remote_module.shortname()
common.mon_create(distro, args, monitor_keyring, hostname)
- service = distro.conn.remote_module.which_service()
- remoto.process.run(
- distro.conn,
- [
- service,
- 'ceph',
- '-c',
- '/etc/ceph/{cluster}.conf'.format(cluster=args.cluster),
- 'start',
- 'mon.{hostname}'.format(hostname=hostname)
- ],
- timeout=7,
- )
+ if distro.init == 'sysvinit':
+ service = distro.conn.remote_module.which_service()
+ remoto.process.run(
+ distro.conn,
+ [
+ service,
+ 'ceph',
+ '-c',
+ '/etc/ceph/{cluster}.conf'.format(cluster=args.cluster),
+ 'start',
+ 'mon.{hostname}'.format(hostname=hostname)
+ ],
+ timeout=7,
+ )
- system.enable_service(distro.conn)
+ system.enable_service(distro.conn)
+ elif distro.init == 'systemd':
+ # enable ceph target for this host (in case it isn't already enabled)
+ remoto.process.run(
+ distro.conn,
+ [
+ 'systemctl',
+ 'enable',
+ 'ceph.target'
+ ],
+ timeout=7,
+ )
+
+ # enable and start this mon instance
+ remoto.process.run(
+ distro.conn,
+ [
+ 'systemctl',
+ 'enable',
+ 'ceph-mon@{hostname}'.format(hostname=hostname),
+ ],
+ timeout=7,
+ )
+ remoto.process.run(
+ distro.conn,
+ [
+ 'systemctl',
+ 'start',
+ 'ceph-mon@{hostname}'.format(hostname=hostname),
+ ],
+ timeout=7,
+ )