def install(distro, version_kind, version, adjust_repos, **kw): packages = map_components( NON_SPLIT_COMPONENTS, kw.pop('components', []) ) codename = distro.codename machine = distro.machine_type if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' distro.packager.install(['ca-certificates', 'apt-transport-https']) if adjust_repos: # Wheezy does not like the download.ceph.com SSL cert protocol = 'https' if codename == 'wheezy': protocol = 'http' distro.packager.add_repo_gpg_key(gpg.url(key, protocol=protocol)) if version_kind == 'stable': url = '{protocol}://download.ceph.com/debian-{version}/'.format( protocol=protocol, version=version, ) elif version_kind == 'testing': url = '{protocol}://download.ceph.com/debian-testing/'.format( protocol=protocol, ) elif version_kind in ['dev', 'dev_commit']: url = 'http://gitbuilder.ceph.com/ceph-deb-{codename}-{machine}-basic/{sub}/{version}'.format( codename=codename, machine=machine, sub='ref' if version_kind == 'dev' else 'sha1', version=version, ) else: raise RuntimeError('Unknown version kind: %r' % version_kind) # set the repo priority for the right domain fqdn = urlparse(url).hostname distro.conn.remote_module.set_apt_priority(fqdn) distro.conn.remote_module.write_sources_list(url, codename) distro.packager.clean() # TODO this does not downgrade -- should it? if packages: distro.packager.install( packages, extra_install_flags=['-o', 'Dpkg::Options::=--force-confnew'] )
def install(distro, version_kind, version, adjust_repos, **kw): # note: when split packages for ceph land for Suse, # `kw['components']` will have those. Unused for now. release = distro.release machine = distro.machine_type if version_kind in ["stable", "testing"]: key = "release" else: key = "autobuild" distro_name = None if distro.codename == "Mantis": distro_name = "opensuse12.2" if (distro.name == "SUSE Linux Enterprise Server") and (str(distro.release) == "11"): distro_name = "sles11" if distro_name == None: LOG.warning("Untested version of %s: assuming compatible with SUSE Linux Enterprise Server 11", distro.name) distro_name = "sles11" if adjust_repos: # Work around code due to bug in SLE 11 # https://bugzilla.novell.com/show_bug.cgi?id=875170 protocol = "https" if distro_name == "sles11": protocol = "http" remoto.process.run(distro.conn, ["rpm", "--import", gpg.url(key, protocol=protocol)]) if version_kind == "stable": url = "http://ceph.com/rpm-{version}/{distro}/".format(version=version, distro=distro_name) elif version_kind == "testing": url = "http://ceph.com/rpm-testing/{distro}/".format(distro=distro_name) elif version_kind == "dev": url = "http://gitbuilder.ceph.com/ceph-rpm-{distro}{release}-{machine}-basic/ref/{version}/".format( distro=distro_name, release=release.split(".", 1)[0], machine=machine, version=version ) remoto.process.run( distro.conn, ["rpm", "-Uvh", "--replacepkgs", "--force", "--quiet", "{url}ceph-release-1-0.noarch.rpm".format(url=url)], ) remoto.process.run(distro.conn, ["zypper", "--non-interactive", "refresh"]) remoto.process.run(distro.conn, ["zypper", "--non-interactive", "--quiet", "install", "ceph", "ceph-radosgw"])
def install(distro, version_kind, version, adjust_repos, **kw): packages = kw.pop('components', []) codename = distro.codename machine = distro.machine_type extra_install_flags = [] if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' distro.packager.install(['ca-certificates', 'apt-transport-https']) if adjust_repos: # Wheezy does not like the download.ceph.com SSL cert protocol = 'https' if codename == 'wheezy': protocol = 'http' if version_kind in ['dev', 'dev_commit']: shaman_url = 'https://shaman.ceph.com/api/repos/ceph/{version}/{sha1}/{distro}/{distro_version}/repo/?arch={arch}'.format( distro=distro.normalized_name, distro_version=distro.codename, version=kw['args'].dev, sha1=kw['args'].dev_commit or 'latest', arch=machine) LOG.debug('fetching repo information from: %s' % shaman_url) chacra_url = net.get_request(shaman_url).geturl() content = net.get_chacra_repo(shaman_url) # set the repo priority for the right domain fqdn = urlparse(chacra_url).hostname distro.conn.remote_module.set_apt_priority(fqdn) distro.conn.remote_module.write_sources_list_content(content) extra_install_flags = [ '-o', 'Dpkg::Options::=--force-confnew', '--allow-unauthenticated' ] else: distro.packager.add_repo_gpg_key(gpg.url(key, protocol=protocol)) if version_kind == 'stable': url = '{protocol}://download.ceph.com/debian-{version}/'.format( protocol=protocol, version=version, ) elif version_kind == 'testing': url = '{protocol}://download.ceph.com/debian-testing/'.format( protocol=protocol, ) else: raise RuntimeError('Unknown version kind: %r' % version_kind) # set the repo priority for the right domain fqdn = urlparse(url).hostname distro.conn.remote_module.set_apt_priority(fqdn) distro.conn.remote_module.write_sources_list(url, codename) extra_install_flags = ['-o', 'Dpkg::Options::=--force-confnew'] distro.packager.clean() # TODO this does not downgrade -- should it? if packages: distro.packager.install(packages, extra_install_flags=extra_install_flags)
def install(distro, version_kind, version, adjust_repos, **kw): packages = map_components(NON_SPLIT_PACKAGES, kw.pop("components", [])) logger = distro.conn.logger release = distro.release machine = distro.machine_type repo_part = repository_url_part(distro) dist = rpm_dist(distro) distro.packager.clean() # Get EPEL installed before we continue: if adjust_repos: distro.packager.install("epel-release") distro.packager.install("yum-plugin-priorities") distro.conn.remote_module.enable_yum_priority_obsoletes() logger.warning("check_obsoletes has been enabled for Yum priorities plugin") if version_kind in ["stable", "testing"]: key = "release" else: key = "autobuild" if adjust_repos: if version_kind in ["stable", "testing"]: distro.packager.add_repo_gpg_key(gpg.url(key)) if version_kind == "stable": url = "http://ceph.com/rpm-{version}/{repo}/".format(version=version, repo=repo_part) elif version_kind == "testing": url = "http://ceph.com/rpm-testing/{repo}/".format(repo=repo_part) remoto.process.run( distro.conn, [ "rpm", "-Uvh", "--replacepkgs", "{url}noarch/ceph-release-1-0.{dist}.noarch.rpm".format(url=url, dist=dist), ], ) elif version_kind in ["dev", "dev_commit"]: logger.info("skipping install of ceph-release package") logger.info("repo file will be created manually") mirror_install( distro, "http://gitbuilder.ceph.com/ceph-rpm-centos{release}-{machine}-basic/{sub}/{version}/".format( release=release.split(".", 1)[0], machine=machine, sub="ref" if version_kind == "dev" else "sha1", version=version, ), gpg.url(key), adjust_repos=True, extra_installs=False, ) else: raise Exception("unrecognized version_kind %s" % version_kind) # set the right priority logger.warning("ensuring that /etc/yum.repos.d/ceph.repo contains a high priority") distro.conn.remote_module.set_repo_priority(["Ceph", "Ceph-noarch", "ceph-source"]) logger.warning("altered ceph.repo priorities to contain: priority=1") if packages: distro.packager.install(packages)
# enabled=1 # gpgcheck=1 # type=rpm-md # gpgkey={gpg_url_release} # apt repos: # [myrepo] # baseurl = http://gitbuilder.ceph.com/ceph-deb-trusty-x86_64-basic/ref/hammer # gpgurl = {gpg_url_autobuild} # default = True # extra-repos = cephrepo # will install the cephrepo file too # # [cephrepo] # baseurl=http://download.ceph.com/debian-hammer # gpgkey={gpg_url_release} """.format(gpg_url_release=gpg.url('release'), gpg_url_autobuild=gpg.url('autobuild')) def location(): """ Find and return the location of the ceph-deploy configuration file. If this file does not exist, create one in a default location. """ return _locate_or_create() def load(): parser = Conf() parser.read(location()) return parser
def install(distro, version_kind, version, adjust_repos, **kw): packages = map_components(NON_SPLIT_PACKAGES, kw.pop('components', [])) logger = distro.conn.logger release = distro.release machine = distro.machine_type repo_part = repository_url_part(distro) dist = rpm_dist(distro) distro.packager.clean() # Get EPEL installed before we continue: if adjust_repos: distro.packager.install('epel-release') distro.packager.install('yum-plugin-priorities') distro.conn.remote_module.enable_yum_priority_obsoletes() logger.warning( 'check_obsoletes has been enabled for Yum priorities plugin') if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' if adjust_repos: if version_kind != 'dev': distro.packager.add_repo_gpg_key(gpg.url(key)) if version_kind == 'stable': url = 'http://ceph.com/rpm-{version}/{repo}/'.format( version=version, repo=repo_part, ) elif version_kind == 'testing': url = 'http://ceph.com/rpm-testing/{repo}/'.format( repo=repo_part) remoto.process.run( distro.conn, [ 'rpm', '-Uvh', '--replacepkgs', '{url}noarch/ceph-release-1-0.{dist}.noarch.rpm'.format( url=url, dist=dist), ], ) if version_kind == 'dev': logger.info('skipping install of ceph-release package') logger.info('repo file will be created manually') mirror_install( distro, 'http://gitbuilder.ceph.com/ceph-rpm-centos{release}-{machine}-basic/ref/{version}/' .format(release=release.split(".", 1)[0], machine=machine, version=version), gpg.url(key), adjust_repos=True, extra_installs=False) # set the right priority logger.warning( 'ensuring that /etc/yum.repos.d/ceph.repo contains a high priority' ) distro.conn.remote_module.set_repo_priority( ['Ceph', 'Ceph-noarch', 'ceph-source']) logger.warning('altered ceph.repo priorities to contain: priority=1') if packages: distro.packager.install(packages)
def install(distro, version_kind, version, adjust_repos, **kw): packages = map_components(NON_SPLIT_PACKAGES, kw.pop('components', [])) gpgcheck = kw.pop('gpgcheck', 1) logger = distro.conn.logger machine = distro.machine_type repo_part = repository_url_part(distro) dist = rpm_dist(distro) distro.packager.clean() # Get EPEL installed before we continue: if adjust_repos: distro.packager.install('epel-release') distro.packager.install('yum-plugin-priorities') distro.conn.remote_module.enable_yum_priority_obsoletes() logger.warning( 'check_obsoletes has been enabled for Yum priorities plugin') if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' if adjust_repos: if version_kind in ['stable', 'testing']: distro.packager.add_repo_gpg_key(gpg.url(key)) if version_kind == 'stable': url = 'https://download.ceph.com/rpm-{version}/{repo}/'.format( version=version, repo=repo_part, ) elif version_kind == 'testing': url = 'https://download.ceph.com/rpm-testing/{repo}/'.format( repo=repo_part) remoto.process.run( distro.conn, [ 'rpm', '-Uvh', '--replacepkgs', '{url}noarch/ceph-release-1-0.{dist}.noarch.rpm'.format( url=url, dist=dist), ], ) elif version_kind in ['dev', 'dev_commit']: logger.info('skipping install of ceph-release package') logger.info('repo file will be created manually') shaman_url = 'https://shaman.ceph.com/api/repos/ceph/{version}/{sha1}/{distro}/{distro_version}/repo/?arch={arch}'.format( distro=distro.normalized_name, distro_version=distro.normalized_release.major, version=kw['args'].dev, sha1=kw['args'].dev_commit or 'latest', arch=machine) LOG.debug('fetching repo information from: %s' % shaman_url) content = net.get_chacra_repo(shaman_url) mirror_install( distro, '', # empty repo_url None, # no need to use gpg here, repos are unsigned adjust_repos=True, extra_installs=False, gpgcheck=gpgcheck, repo_content=content) else: raise Exception('unrecognized version_kind %s' % version_kind) # set the right priority logger.warning( 'ensuring that /etc/yum.repos.d/ceph.repo contains a high priority' ) distro.conn.remote_module.set_repo_priority( ['Ceph', 'Ceph-noarch', 'ceph-source']) logger.warning('altered ceph.repo priorities to contain: priority=1') if packages: distro.packager.install(packages)
def install(args): args = sanitize_args(args) if args.repo: return install_repo(args) gpgcheck = 0 if args.nogpgcheck else 1 if args.version_kind == 'stable': version = args.release else: version = getattr(args, args.version_kind) version_str = args.version_kind if version: version_str += ' version {version}'.format(version=version) LOG.debug( 'Installing %s on cluster %s hosts %s', version_str, args.cluster, ' '.join(args.host), ) for hostname in args.host: LOG.debug('Detecting platform for host %s ...', hostname) distro = hosts.get( hostname, username=args.username, # XXX this should get removed once ceph packages are split for # upstream. If default_release is True, it means that the user is # trying to install on a RHEL machine and should expect to get RHEL # packages. Otherwise, it will need to specify either a specific # version, or repo, or a development branch. Other distro users # should not see any differences. use_rhceph=args.default_release, ) LOG.info( 'Distro info: %s %s %s', distro.name, distro.release, distro.codename ) components = detect_components(args, distro) if distro.init == 'sysvinit' and args.cluster != 'ceph': LOG.error('refusing to install on host: %s, with custom cluster name: %s' % ( hostname, args.cluster, ) ) LOG.error('custom cluster names are not supported on sysvinit hosts') continue rlogger = logging.getLogger(hostname) rlogger.info('installing Ceph on %s' % hostname) cd_conf = getattr(args, 'cd_conf', None) # custom repo arguments repo_url = os.environ.get('CEPH_DEPLOY_REPO_URL') or args.repo_url gpg_url = os.environ.get('CEPH_DEPLOY_GPG_URL') or args.gpg_url gpg_fallback = gpg.url('release') if gpg_url is None and repo_url: LOG.warning('--gpg-url was not used, will fallback') LOG.warning('using GPG fallback: %s', gpg_fallback) gpg_url = gpg_fallback if args.local_mirror: if args.username: hostname = "%s@%s" % (args.username, hostname) remoto.rsync(hostname, args.local_mirror, '/opt/ceph-deploy/repo', distro.conn.logger, sudo=True) repo_url = 'file:///opt/ceph-deploy/repo' gpg_url = 'file:///opt/ceph-deploy/repo/release.asc' if repo_url: # triggers using a custom repository # the user used a custom repo url, this should override anything # we can detect from the configuration, so warn about it if cd_conf: if cd_conf.get_default_repo(): rlogger.warning('a default repo was found but it was \ overridden on the CLI') if args.release in cd_conf.get_repos(): rlogger.warning('a custom repo was found but it was \ overridden on the CLI') rlogger.info('using custom repository location: %s', repo_url) distro.mirror_install( distro, repo_url, gpg_url, args.adjust_repos, components=components, gpgcheck=gpgcheck, args=args ) # Detect and install custom repos here if needed elif should_use_custom_repo(args, cd_conf, repo_url): LOG.info('detected valid custom repositories from config file') custom_repo(distro, args, cd_conf, rlogger) else: # otherwise a normal installation distro.install( distro, args.version_kind, version, args.adjust_repos, components=components, gpgcheck = gpgcheck, args=args ) # Check the ceph version we just installed hosts.common.ceph_version(distro.conn) distro.conn.exit()
def install(distro, version_kind, version, adjust_repos, **kw): packages = map_components( NON_SPLIT_PACKAGES, kw.pop('components', []) ) gpgcheck = kw.pop('gpgcheck', 1) logger = distro.conn.logger machine = distro.machine_type repo_part = repository_url_part(distro) dist = rpm_dist(distro) distro.packager.clean() # Get EPEL installed before we continue: if adjust_repos: distro.packager.install('epel-release') distro.packager.install('yum-plugin-priorities') distro.conn.remote_module.enable_yum_priority_obsoletes() logger.warning('check_obsoletes has been enabled for Yum priorities plugin') if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' if adjust_repos: if version_kind in ['stable', 'testing']: distro.packager.add_repo_gpg_key(gpg.url(key)) if version_kind == 'stable': url = 'https://download.ceph.com/rpm-{version}/{repo}/'.format( version=version, repo=repo_part, ) elif version_kind == 'testing': url = 'https://download.ceph.com/rpm-testing/{repo}/'.format(repo=repo_part) # remove any old ceph-release package from prevoius release remoto.process.run( distro.conn, [ 'yum', 'remove', '-y', 'ceph-release' ], ) remoto.process.run( distro.conn, [ 'yum', 'install', '-y', '{url}noarch/ceph-release-1-0.{dist}.noarch.rpm'.format(url=url, dist=dist), ], ) elif version_kind in ['dev', 'dev_commit']: logger.info('skipping install of ceph-release package') logger.info('repo file will be created manually') shaman_url = 'https://shaman.ceph.com/api/repos/ceph/{version}/{sha1}/{distro}/{distro_version}/repo/?arch={arch}'.format( distro=distro.normalized_name, distro_version=distro.normalized_release.major, version=kw['args'].dev, sha1=kw['args'].dev_commit or 'latest', arch=machine ) LOG.debug('fetching repo information from: %s' % shaman_url) content = net.get_chacra_repo(shaman_url) mirror_install( distro, '', # empty repo_url None, # no need to use gpg here, repos are unsigned adjust_repos=True, extra_installs=False, gpgcheck=gpgcheck, repo_content=content ) else: raise Exception('unrecognized version_kind %s' % version_kind) # set the right priority logger.warning('ensuring that /etc/yum.repos.d/ceph.repo contains a high priority') distro.conn.remote_module.set_repo_priority(['Ceph', 'Ceph-noarch', 'ceph-source']) logger.warning('altered ceph.repo priorities to contain: priority=1') if packages: distro.packager.install(packages)
def install(distro, version_kind, version, adjust_repos, **kw): # note: when split packages for ceph land for Fedora, # `kw['components']` will have those. Unused for now. logger = distro.conn.logger release = distro.release machine = distro.machine_type if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' if adjust_repos: install_yum_priorities(distro) distro.conn.remote_module.enable_yum_priority_obsoletes() logger.warning( 'check_obsoletes has been enabled for Yum priorities plugin') if version_kind != 'dev': remoto.process.run(distro.conn, ['rpm', '--import', gpg.url(key)]) if version_kind == 'stable': url = 'http://ceph.com/rpm-{version}/fc{release}/'.format( version=version, release=release, ) elif version_kind == 'testing': url = 'http://ceph.com/rpm-testing/fc{release}'.format( release=release, ) remoto.process.run(distro.conn, [ 'rpm', '-Uvh', '--replacepkgs', '--force', '--quiet', '{url}noarch/ceph-release-1-0.fc{release}.noarch.rpm'.format( url=url, release=release, ), ]) if version_kind == 'dev': logger.info('skipping install of ceph-release package') logger.info('repo file will be created manually') mirror_install( distro, 'http://gitbuilder.ceph.com/ceph-rpm-fc{release}-{machine}-basic/ref/{version}/' .format(release=release.split(".", 1)[0], machine=machine, version=version), gpg.url(key), adjust_repos=True, extra_installs=False) # set the right priority logger.warning( 'ensuring that /etc/yum.repos.d/ceph.repo contains a high priority' ) distro.conn.remote_module.set_repo_priority( ['Ceph', 'Ceph-noarch', 'ceph-source']) logger.warning('altered ceph.repo priorities to contain: priority=1') remoto.process.run( distro.conn, [ 'yum', '-y', '-q', 'install', 'ceph', 'ceph-radosgw', ], )
def install(distro, version_kind, version, adjust_repos, **kw): # note: when split packages for ceph land for Fedora, # `kw['components']` will have those. Unused for now. logger = distro.conn.logger release = distro.release machine = distro.machine_type if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' if adjust_repos: install_yum_priorities(distro) distro.conn.remote_module.enable_yum_priority_obsoletes() logger.warning('check_obsoletes has been enabled for Yum priorities plugin') if version_kind != 'dev': remoto.process.run( distro.conn, [ 'rpm', '--import', gpg.url(key) ] ) if version_kind == 'stable': url = 'http://ceph.com/rpm-{version}/fc{release}/'.format( version=version, release=release, ) elif version_kind == 'testing': url = 'http://ceph.com/rpm-testing/fc{release}'.format( release=release, ) remoto.process.run( distro.conn, [ 'rpm', '-Uvh', '--replacepkgs', '--force', '--quiet', '{url}noarch/ceph-release-1-0.fc{release}.noarch.rpm'.format( url=url, release=release, ), ] ) if version_kind == 'dev': logger.info('skipping install of ceph-release package') logger.info('repo file will be created manually') mirror_install( distro, 'http://gitbuilder.ceph.com/ceph-rpm-fc{release}-{machine}-basic/ref/{version}/'.format( release=release.split(".", 1)[0], machine=machine, version=version), gpg.url(key), adjust_repos=True, extra_installs=False ) # set the right priority logger.warning('ensuring that /etc/yum.repos.d/ceph.repo contains a high priority') distro.conn.remote_module.set_repo_priority(['Ceph', 'Ceph-noarch', 'ceph-source']) logger.warning('altered ceph.repo priorities to contain: priority=1') remoto.process.run( distro.conn, [ 'yum', '-y', '-q', 'install', 'ceph', 'ceph-radosgw', ], )
def install(distro, version_kind, version, adjust_repos, **kw): # note: when split packages for ceph land for Debian/Ubuntu, # `kw['components']` will have those. Unused for now. codename = distro.codename machine = distro.machine_type if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' # Make sure ca-certificates is installed remoto.process.run(distro.conn, [ 'env', 'DEBIAN_FRONTEND=noninteractive', 'apt-get', '-q', 'install', '--assume-yes', 'ca-certificates', ]) if adjust_repos: # Wheezy does not like the git.ceph.com SSL cert protocol = 'https' if codename == 'wheezy': protocol = 'http' remoto.process.run( distro.conn, [ 'wget', '-O', '{key}.asc'.format(key=key), gpg.url(key, protocol=protocol), ], stop_on_nonzero=False, ) remoto.process.run(distro.conn, ['apt-key', 'add', '{key}.asc'.format(key=key)]) if version_kind == 'stable': url = 'http://ceph.com/debian-{version}/'.format(version=version, ) elif version_kind == 'testing': url = 'http://ceph.com/debian-testing/' elif version_kind == 'dev': url = 'http://gitbuilder.ceph.com/ceph-deb-{codename}-{machine}-basic/ref/{version}'.format( codename=codename, machine=machine, version=version, ) else: raise RuntimeError('Unknown version kind: %r' % version_kind) # set the repo priority for the right domain fqdn = urlparse(url).hostname distro.conn.remote_module.set_apt_priority(fqdn) distro.conn.remote_module.write_sources_list(url, codename) remoto.process.run( distro.conn, ['apt-get', '-q', 'update'], ) # TODO this does not downgrade -- should it? remoto.process.run( distro.conn, [ 'env', 'DEBIAN_FRONTEND=noninteractive', 'DEBIAN_PRIORITY=critical', 'apt-get', '-q', '-o', 'Dpkg::Options::=--force-confnew', '--no-install-recommends', '--assume-yes', 'install', '--', 'ceph', 'ceph-mds', 'ceph-common', 'ceph-fs-common', 'radosgw', # ceph only recommends gdisk, make sure we actually have # it; only really needed for osds, but minimal collateral 'gdisk', ], )
def install(distro, version_kind, version, adjust_repos, **kw): # note: when split packages for ceph land for Debian/Ubuntu, # `kw['components']` will have those. Unused for now. codename = distro.codename machine = distro.machine_type if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' # Make sure ca-certificates is installed remoto.process.run( distro.conn, [ 'env', 'DEBIAN_FRONTEND=noninteractive', 'apt-get', '-q', 'install', '--assume-yes', 'ca-certificates', ] ) if adjust_repos: # Wheezy does not like the git.ceph.com SSL cert protocol = 'https' if codename == 'wheezy': protocol = 'http' remoto.process.run( distro.conn, [ 'wget', '-O', '{key}.asc'.format(key=key), gpg.url(key, protocol=protocol), ], stop_on_nonzero=False, ) remoto.process.run( distro.conn, [ 'apt-key', 'add', '{key}.asc'.format(key=key) ] ) if version_kind == 'stable': url = 'http://ceph.com/debian-{version}/'.format( version=version, ) elif version_kind == 'testing': url = 'http://ceph.com/debian-testing/' elif version_kind == 'dev': url = 'http://gitbuilder.ceph.com/ceph-deb-{codename}-{machine}-basic/ref/{version}'.format( codename=codename, machine=machine, version=version, ) else: raise RuntimeError('Unknown version kind: %r' % version_kind) # set the repo priority for the right domain fqdn = urlparse(url).hostname distro.conn.remote_module.set_apt_priority(fqdn) distro.conn.remote_module.write_sources_list(url, codename) remoto.process.run( distro.conn, ['apt-get', '-q', 'update'], ) # TODO this does not downgrade -- should it? remoto.process.run( distro.conn, [ 'env', 'DEBIAN_FRONTEND=noninteractive', 'DEBIAN_PRIORITY=critical', 'apt-get', '-q', '-o', 'Dpkg::Options::=--force-confnew', '--no-install-recommends', '--assume-yes', 'install', '--', 'ceph', 'ceph-mds', 'ceph-common', 'ceph-fs-common', 'radosgw', # ceph only recommends gdisk, make sure we actually have # it; only really needed for osds, but minimal collateral 'gdisk', ], )
def install(distro, version_kind, version, adjust_repos, **kw): # note: when split packages for ceph land for Suse, # `kw['components']` will have those. Unused for now. release = distro.release machine = distro.machine_type if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' distro_name = None if distro.codename == 'Mantis': distro_name = 'opensuse12.2' if (distro.name == "SUSE Linux Enterprise Server") and (str(distro.release) == "11"): distro_name = 'sles11' if distro_name == None: LOG.warning('Untested version of %s: assuming compatible with SUSE Linux Enterprise Server 11', distro.name) distro_name = 'sles11' if adjust_repos: # Work around code due to bug in SLE 11 # https://bugzilla.novell.com/show_bug.cgi?id=875170 protocol = "https" if distro_name == 'sles11': protocol = "http" remoto.process.run( distro.conn, [ 'rpm', '--import', gpg.url(key, protocol=protocol) ] ) if version_kind == 'stable': url = 'http://ceph.com/rpm-{version}/{distro}/'.format( version=version, distro=distro_name, ) elif version_kind == 'testing': url = 'http://ceph.com/rpm-testing/{distro}/'.format(distro=distro_name) elif version_kind == 'dev': url = 'http://gitbuilder.ceph.com/ceph-rpm-{distro}{release}-{machine}-basic/ref/{version}/'.format( distro=distro_name, release=release.split(".", 1)[0], machine=machine, version=version, ) remoto.process.run( distro.conn, [ 'rpm', '-Uvh', '--replacepkgs', '--force', '--quiet', '{url}ceph-release-1-0.noarch.rpm'.format( url=url, ), ] ) remoto.process.run( distro.conn, [ 'zypper', '--non-interactive', 'refresh' ], ) remoto.process.run( distro.conn, [ 'zypper', '--non-interactive', '--quiet', 'install', 'ceph', 'ceph-radosgw', ], )
def install(args): args = sanitize_args(args) if args.repo: return install_repo(args) if args.version_kind == 'stable': version = args.release else: version = getattr(args, args.version_kind) version_str = args.version_kind if version: version_str += ' version {version}'.format(version=version) LOG.debug( 'Installing %s on cluster %s hosts %s', version_str, args.cluster, ' '.join(args.host), ) for hostname in args.host: LOG.debug('Detecting platform for host %s ...', hostname) distro = hosts.get( hostname, username=args.username, # XXX this should get removed once ceph packages are split for # upstream. If default_release is True, it means that the user is # trying to install on a RHEL machine and should expect to get RHEL # packages. Otherwise, it will need to specify either a specific # version, or repo, or a development branch. Other distro users # should not see any differences. use_rhceph=args.default_release, ) LOG.info('Distro info: %s %s %s', distro.name, distro.release, distro.codename) components = detect_components(args, distro) if distro.init == 'sysvinit' and args.cluster != 'ceph': LOG.error( 'refusing to install on host: %s, with custom cluster name: %s' % ( hostname, args.cluster, )) LOG.error( 'custom cluster names are not supported on sysvinit hosts') continue rlogger = logging.getLogger(hostname) rlogger.info('installing Ceph on %s' % hostname) cd_conf = getattr(args, 'cd_conf', None) # custom repo arguments repo_url = os.environ.get('CEPH_DEPLOY_REPO_URL') or args.repo_url gpg_url = os.environ.get('CEPH_DEPLOY_GPG_URL') or args.gpg_url gpg_fallback = gpg.url('release') if gpg_url is None and repo_url: LOG.warning('--gpg-url was not used, will fallback') LOG.warning('using GPG fallback: %s', gpg_fallback) gpg_url = gpg_fallback if args.local_mirror: remoto.rsync(hostname, args.local_mirror, '/opt/ceph-deploy/repo', distro.conn.logger, sudo=True) repo_url = 'file:///opt/ceph-deploy/repo' gpg_url = 'file:///opt/ceph-deploy/repo/release.asc' if repo_url: # triggers using a custom repository # the user used a custom repo url, this should override anything # we can detect from the configuration, so warn about it if cd_conf: if cd_conf.get_default_repo(): rlogger.warning('a default repo was found but it was \ overridden on the CLI') if args.release in cd_conf.get_repos(): rlogger.warning('a custom repo was found but it was \ overridden on the CLI') rlogger.info('using custom repository location: %s', repo_url) distro.mirror_install( distro, repo_url, gpg_url, args.adjust_repos, components=components, ) # Detect and install custom repos here if needed elif should_use_custom_repo(args, cd_conf, repo_url): LOG.info('detected valid custom repositories from config file') custom_repo(distro, args, cd_conf, rlogger) else: # otherwise a normal installation distro.install( distro, args.version_kind, version, args.adjust_repos, components=components, ) # Check the ceph version we just installed hosts.common.ceph_version(distro.conn) distro.conn.exit()
def install(distro, version_kind, version, adjust_repos, **kw): packages = kw.pop('components', []) codename = distro.codename machine = distro.machine_type if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' distro.packager.install(['ca-certificates', 'apt-transport-https']) if adjust_repos: # Wheezy does not like the download.ceph.com SSL cert protocol = 'https' if codename == 'wheezy': protocol = 'http' if version_kind in ['dev', 'dev_commit']: shaman_url = 'https://shaman.ceph.com/api/repos/ceph/{version}/{sha1}/{distro}/{distro_version}/repo/?arch={arch}'.format( distro=distro.normalized_name, distro_version=distro.codename, version=kw['args'].dev, sha1=kw['args'].dev_commit or 'latest', arch=machine ) LOG.debug('fetching repo information from: %s' % shaman_url) chacra_url = net.get_request(shaman_url).geturl() content = net.get_chacra_repo(shaman_url) # set the repo priority for the right domain fqdn = urlparse(chacra_url).hostname distro.conn.remote_module.set_apt_priority(fqdn) distro.conn.remote_module.write_sources_list_content(content) extra_install_flags = ['-o', 'Dpkg::Options::=--force-confnew', '--allow-unauthenticated'] else: distro.packager.add_repo_gpg_key(gpg.url(key, protocol=protocol)) if version_kind == 'stable': url = '{protocol}://download.ceph.com/debian-{version}/'.format( protocol=protocol, version=version, ) elif version_kind == 'testing': url = '{protocol}://download.ceph.com/debian-testing/'.format( protocol=protocol, ) else: raise RuntimeError('Unknown version kind: %r' % version_kind) # set the repo priority for the right domain fqdn = urlparse(url).hostname distro.conn.remote_module.set_apt_priority(fqdn) distro.conn.remote_module.write_sources_list(url, codename) extra_install_flags = ['-o', 'Dpkg::Options::=--force-confnew'] distro.packager.clean() # TODO this does not downgrade -- should it? if packages: distro.packager.install( packages, extra_install_flags=extra_install_flags )
# enabled=1 # gpgcheck=1 # type=rpm-md # gpgkey=https://download.ceph.com/keys/release.asc # apt repos: # [myrepo] # baseurl = http://gitbuilder.ceph.com/ceph-deb-trusty-x86_64-basic/ref/hammer # gpgurl = https://download.ceph.com/keys/autobuild.asc # default = True # extra-repos = cephrepo # will install the cephrepo file too # # [cephrepo] # baseurl=http://download.ceph.com/debian-hammer # gpgkey=https://download.ceph.com/keys/release.asc """.format(gpgurl=gpg.url('release')) def location(): """ Find and return the location of the ceph-deploy configuration file. If this file does not exist, create one in a default location. """ return _locate_or_create() def load(): parser = Conf() parser.read(location()) return parser
def install(distro, version_kind, version, adjust_repos, **kw): packages = map_components(NON_SPLIT_PACKAGES, kw.pop('components', [])) gpgcheck = kw.pop('gpgcheck', 1) logger = distro.conn.logger release = distro.release machine = distro.machine_type if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' if adjust_repos: if distro.packager.name == 'yum': distro.packager.install('yum-plugin-priorities') # haven't been able to determine necessity of check_obsoletes with DNF distro.conn.remote_module.enable_yum_priority_obsoletes() logger.warning( 'check_obsoletes has been enabled for Yum priorities plugin') if version_kind in ['stable', 'testing']: distro.packager.add_repo_gpg_key(gpg.url(key)) if version_kind == 'stable': url = 'https://download.ceph.com/rpm-{version}/fc{release}/'.format( version=version, release=release, ) elif version_kind == 'testing': url = 'https://download.ceph.com/rpm-testing/fc{release}'.format( release=release, ) remoto.process.run(distro.conn, [ 'rpm', '-Uvh', '--replacepkgs', '--force', '--quiet', '{url}noarch/ceph-release-1-0.fc{release}.noarch.rpm'.format( url=url, release=release, ), ]) # set the right priority logger.warning( 'ensuring that /etc/yum.repos.d/ceph.repo contains a high priority' ) distro.conn.remote_module.set_repo_priority( ['Ceph', 'Ceph-noarch', 'ceph-source']) logger.warning( 'altered ceph.repo priorities to contain: priority=1') elif version_kind in ['dev', 'dev_commit']: logger.info('skipping install of ceph-release package') logger.info('repo file will be created manually') mirror_install( distro, 'http://gitbuilder.ceph.com/ceph-rpm-fc{release}-{machine}-basic/{sub}/{version}/' .format(release=release.split(".", 1)[0], machine=machine, sub='ref' if version_kind == 'dev' else 'sha1', version=version), gpg.url(key), adjust_repos=True, extra_installs=False, gpgcheck=gpgcheck, ) else: raise Exception('unrecognized version_kind %s' % version_kind) distro.packager.install(packages)
def install(distro, version_kind, version, adjust_repos, **kw): packages = map_components( NON_SPLIT_PACKAGES, kw.pop('components', []) ) logger = distro.conn.logger release = distro.release machine = distro.machine_type if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' if adjust_repos: if distro.packager.name == 'yum': distro.packager.install('yum-plugin-priorities') # haven't been able to determine necessity of check_obsoletes with DNF distro.conn.remote_module.enable_yum_priority_obsoletes() logger.warning('check_obsoletes has been enabled for Yum priorities plugin') if version_kind in ['stable', 'testing']: distro.packager.add_repo_gpg_key(gpg.url(key)) if version_kind == 'stable': url = 'https://download.ceph.com/rpm-{version}/fc{release}/'.format( version=version, release=release, ) elif version_kind == 'testing': url = 'https://download.ceph.com/rpm-testing/fc{release}'.format( release=release, ) remoto.process.run( distro.conn, [ 'rpm', '-Uvh', '--replacepkgs', '--force', '--quiet', '{url}noarch/ceph-release-1-0.fc{release}.noarch.rpm'.format( url=url, release=release, ), ] ) # set the right priority logger.warning('ensuring that /etc/yum.repos.d/ceph.repo contains a high priority') distro.conn.remote_module.set_repo_priority(['Ceph', 'Ceph-noarch', 'ceph-source']) logger.warning('altered ceph.repo priorities to contain: priority=1') elif version_kind in ['dev', 'dev_commit']: logger.info('skipping install of ceph-release package') logger.info('repo file will be created manually') mirror_install( distro, 'http://gitbuilder.ceph.com/ceph-rpm-fc{release}-{machine}-basic/{sub}/{version}/'.format( release=release.split(".", 1)[0], machine=machine, sub='ref' if version_kind == 'dev' else 'sha1', version=version), gpg.url(key), adjust_repos=True, extra_installs=False ) else: raise Exception('unrecognized version_kind %s' % version_kind) distro.packager.install( packages )
def install(distro, version_kind, version, adjust_repos, **kw): packages = map_components( NON_SPLIT_PACKAGES, kw.pop('components', []) ) logger = distro.conn.logger release = distro.release machine = distro.machine_type repo_part = repository_url_part(distro) dist = rpm_dist(distro) distro.packager.clean() # Get EPEL installed before we continue: if adjust_repos: distro.packager.install('epel-release') distro.packager.install('yum-plugin-priorities') distro.conn.remote_module.enable_yum_priority_obsoletes() logger.warning('check_obsoletes has been enabled for Yum priorities plugin') if version_kind in ['stable', 'testing']: key = 'release' else: key = 'autobuild' if adjust_repos: if version_kind != 'dev': distro.packager.add_repo_gpg_key(gpg.url(key)) if version_kind == 'stable': url = 'http://ceph.com/rpm-{version}/{repo}/'.format( version=version, repo=repo_part, ) elif version_kind == 'testing': url = 'http://ceph.com/rpm-testing/{repo}/'.format(repo=repo_part) remoto.process.run( distro.conn, [ 'rpm', '-Uvh', '--replacepkgs', '{url}noarch/ceph-release-1-0.{dist}.noarch.rpm'.format(url=url, dist=dist), ], ) if version_kind == 'dev': logger.info('skipping install of ceph-release package') logger.info('repo file will be created manually') mirror_install( distro, 'http://gitbuilder.ceph.com/ceph-rpm-centos{release}-{machine}-basic/ref/{version}/'.format( release=release.split(".", 1)[0], machine=machine, version=version), gpg.url(key), adjust_repos=True, extra_installs=False ) # set the right priority logger.warning('ensuring that /etc/yum.repos.d/ceph.repo contains a high priority') distro.conn.remote_module.set_repo_priority(['Ceph', 'Ceph-noarch', 'ceph-source']) logger.warning('altered ceph.repo priorities to contain: priority=1') if packages: distro.packager.install(packages)