Exemple #1
0
    def configure_post(self):
        hosts = [request.json['host']]
        monitor_hosts = util.parse_monitors(request.json["monitors"])
        verbose_ansible = request.json.get('verbose', False)
        # even with configuring we need to tell ceph-ansible
        # if we're working with upstream ceph or red hat ceph storage
        extra_vars = util.get_osd_configure_extra_vars(request.json)
        if 'verbose' in extra_vars:
            del extra_vars['verbose']
        if 'conf' in extra_vars:
            extra_vars['ceph_conf_overrides'] = request.json['conf']
            del extra_vars['conf']
        identifier = str(uuid4())
        task = models.Task(
            request=request,
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(
            extra_vars=extra_vars,
            skip_tags="package-install",
            playbook="infrastructure-playbooks/osd-configure.yml",
            verbose=verbose_ansible,
        )
        call_ansible.apply_async(args=([('osds', hosts),
                                        ('mons', monitor_hosts)], identifier),
                                 kwargs=kwargs)

        return task
Exemple #2
0
    def configure_post(self):
        hosts = [request.json['host']]
        monitor_hosts = util.parse_monitors(request.json["monitors"])
        verbose_ansible = request.json.get('verbose', False)
        # even with configuring we need to tell ceph-ansible
        # if we're working with upstream ceph or red hat ceph storage
        extra_vars = util.get_osd_configure_extra_vars(request.json)
        if 'verbose' in extra_vars:
            del extra_vars['verbose']
        if 'conf' in extra_vars:
            extra_vars['ceph_conf_overrides'] = request.json['conf']
            del extra_vars['conf']
        identifier = str(uuid4())
        task = models.Task(
            request=request,
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(
            extra_vars=extra_vars,
            skip_tags="package-install",
            playbook="osd-configure.yml",
            verbose=verbose_ansible,
        )
        call_ansible.apply_async(
            args=([('osds', hosts), ('mons', monitor_hosts)], identifier),
            kwargs=kwargs
        )

        return task
Exemple #3
0
    def install_post(self):
        hosts = request.json.get('hosts')
        install_calamari = request.json.get('calamari', False)
        verbose_ansible = request.json.get('verbose', False)
        extra_vars = util.get_install_extra_vars(request.json)
        extra_vars['calamari'] = install_calamari
        identifier = str(uuid4())
        task = models.Task(
            request=request,
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(
            extra_vars=extra_vars,
            tags="package-install",
            verbose=verbose_ansible,
        )

        call_ansible.apply_async(
            args=([('mons', hosts)], identifier),
            kwargs=kwargs,
        )

        return task
Exemple #4
0
    def install_post(self):
        hosts = request.json.get('hosts')
        install_calamari = request.json.get('calamari', False)
        verbose_ansible = request.json.get('verbose', False)
        extra_vars = util.get_install_extra_vars(request.json)
        extra_vars['calamari'] = install_calamari
        identifier = str(uuid4())
        task = models.Task(
            request=request,
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(
            extra_vars=extra_vars,
            tags="package-install",
            verbose=verbose_ansible,
        )

        call_ansible.apply_async(
            args=([('mons', hosts)], identifier),
            kwargs=kwargs,
        )

        return task
Exemple #5
0
    def configure_post(self):
        monitor_mapping = dict(host=request.json['host'])

        # Only add interface and address if they exist
        for key in ['interface', 'address']:
            try:
                monitor_mapping[key] = request.json[key]
            except KeyError:
                pass
        hosts = util.parse_monitors([monitor_mapping])
        verbose_ansible = request.json.get('verbose', False)
        monitors = request.json.get("monitors", [])
        monitors = util.validate_monitors(monitors, request.json["host"])
        # even with configuring we need to tell ceph-ansible
        # if we're working with upstream ceph or red hat ceph storage
        extra_vars = util.get_install_extra_vars(request.json)
        # this update will take everything in the ``request.json`` body and
        # just pass it in as extra-vars. That is the reason why optional values
        # like "calamari" are not looked up explicitly. If they are passed in
        # they will be used.
        extra_vars.update(request.json)
        if 'verbose' in extra_vars:
            del extra_vars['verbose']
        if 'conf' in extra_vars:
            extra_vars['ceph_conf_overrides'] = request.json['conf']
            del extra_vars['conf']
        if monitors:
            hosts.extend(util.parse_monitors(monitors))
            del extra_vars['monitors']
        if "cluster_name" in extra_vars:
            extra_vars["cluster"] = extra_vars["cluster_name"]
            del extra_vars["cluster_name"]
        del extra_vars['host']
        extra_vars.pop('interface', None)
        extra_vars.pop('address', None)
        identifier = str(uuid4())
        task = models.Task(
            request=request,
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(
            extra_vars=extra_vars,
            skip_tags="package-install",
            verbose=verbose_ansible,
        )
        call_ansible.apply_async(
            args=([('mons', hosts)], identifier),
            kwargs=kwargs,
        )

        return task
Exemple #6
0
    def configure_post(self):
        monitor_mapping = dict(host=request.json['host'])

        # Only add interface and address if they exist
        for key in ['interface', 'address']:
            try:
                monitor_mapping[key] = request.json[key]
            except KeyError:
                pass
        hosts = util.parse_monitors([monitor_mapping])
        verbose_ansible = request.json.get('verbose', False)
        monitors = request.json.get("monitors", [])
        monitors = util.validate_monitors(monitors, request.json["host"])
        # even with configuring we need to tell ceph-ansible
        # if we're working with upstream ceph or red hat ceph storage
        extra_vars = util.get_install_extra_vars(request.json)
        # this update will take everything in the ``request.json`` body and
        # just pass it in as extra-vars. That is the reason why optional values
        # like "calamari" are not looked up explicitly. If they are passed in
        # they will be used.
        extra_vars.update(request.json)
        if 'verbose' in extra_vars:
            del extra_vars['verbose']
        if 'conf' in extra_vars:
            extra_vars['ceph_conf_overrides'] = request.json['conf']
            del extra_vars['conf']
        if monitors:
            hosts.extend(util.parse_monitors(monitors))
            del extra_vars['monitors']
        if "cluster_name" in extra_vars:
            extra_vars["cluster"] = extra_vars["cluster_name"]
            del extra_vars["cluster_name"]
        del extra_vars['host']
        extra_vars.pop('interface', None)
        extra_vars.pop('address', None)
        identifier = str(uuid4())
        task = models.Task(
            request=request,
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(
            extra_vars=extra_vars,
            skip_tags="package-install",
            verbose=verbose_ansible,
        )
        call_ansible.apply_async(
            args=([('mons', hosts)], identifier),
            kwargs=kwargs,
        )

        return task
Exemple #7
0
    def install_post(self):
        hosts = request.json.get('hosts')
        identifier = str(uuid4())
        task = models.Task(
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(tags="package-install")
        call_ansible.apply_async(
            args=('rgw', hosts, identifier),
            kwargs=kwargs,
        )

        return task
Exemple #8
0
    def install(self):
        hosts = request.json.get('hosts')
        extra_vars = util.get_install_extra_vars(request.json)
        identifier = str(uuid4())
        task = models.Task(
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(extra_vars=extra_vars)
        call_ansible.apply_async(
            args=('agent', hosts, identifier),
            kwargs=kwargs,
        )

        return task
Exemple #9
0
    def install(self):
        hosts = request.json.get('hosts')
        extra_vars = util.get_install_extra_vars(request.json)
        identifier = str(uuid4())
        task = models.Task(
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(extra_vars=extra_vars)
        call_ansible.apply_async(
            args=('agent', hosts, identifier),
            kwargs=kwargs,
        )

        return task
Exemple #10
0
    def configure_post(self):
        hosts = [request.json['host']]
        # even with configuring we need to tell ceph-ansible
        # if we're working with upstream ceph or red hat ceph storage
        verbose_ansible = request.json.get('verbose', False)
        extra_vars = util.get_install_extra_vars(request.json)
        monitor_hosts = util.parse_monitors(request.json["monitors"])
        # this update will take everything in the ``request.json`` body and
        # just pass it in as extra-vars. That is the reason why optional values
        # like "calamari" are not looked up explicitly. If they are passed in
        # they will be used.
        extra_vars.update(request.json)
        if 'verbose' in extra_vars:
            del extra_vars['verbose']
        if 'conf' in extra_vars:
            extra_vars['ceph_conf_overrides'] = request.json['conf']
            del extra_vars['conf']
        if "cluster_name" in extra_vars:
            extra_vars["cluster"] = extra_vars["cluster_name"]
            del extra_vars["cluster_name"]
        del extra_vars['host']
        extra_vars.pop('interface', None)
        extra_vars.pop('address', None)
        identifier = str(uuid4())
        task = models.Task(
            request=request,
            identifier=identifier,
            playbook="infrastructure-playbooks/rgw-standalone.yml",
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(
            extra_vars=extra_vars,
            skip_tags="package-install",
            verbose=verbose_ansible,
        )
        call_ansible.apply_async(
            args=([('rgws', hosts), ('mons', monitor_hosts)], identifier),
            kwargs=kwargs,
        )

        return task
Exemple #11
0
    def install(self):
        master = request.json.get('master', request.server_name)
        logger.info('defining "%s" as the master host for the minion configuration', master)
        hosts = request.json.get('hosts')
        verbose_ansible = request.json.get('verbose', False)
        extra_vars = util.get_install_extra_vars(request.json)
        extra_vars['agent_master_host'] = master
        identifier = str(uuid4())
        task = models.Task(
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(extra_vars=extra_vars, verbose=verbose_ansible)
        call_ansible.apply_async(
            args=([('agents', hosts)], identifier),
            kwargs=kwargs,
        )

        return task
Exemple #12
0
    def install(self):
        master = request.json.get('master', request.server_name)
        logger.info(
            'defining "%s" as the master host for the minion configuration',
            master)
        hosts = request.json.get('hosts')
        verbose_ansible = request.json.get('verbose', False)
        extra_vars = util.get_install_extra_vars(request.json)
        extra_vars['agent_master_host'] = master
        identifier = str(uuid4())
        task = models.Task(
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(extra_vars=extra_vars, verbose=verbose_ansible)
        call_ansible.apply_async(
            args=([('agents', hosts)], identifier),
            kwargs=kwargs,
        )

        return task
Exemple #13
0
    def configure_post(self):
        hosts = [request.json['host']]
        # even with configuring we need to tell ceph-ansible
        # if we're working with upstream ceph or red hat ceph storage
        extra_vars = util.get_install_extra_vars(request.json)
        extra_vars['monitor_interface'] = request.json['monitor_interface']
        extra_vars['fsid'] = request.json['fsid']
        if request.json.get('monitor_secret'):
            extra_vars['monitor_secret'] = request.json.get('monitor_secret')
        identifier = str(uuid4())
        task = models.Task(
            identifier=identifier,
            endpoint=request.path,
        )
        # we need an explicit commit here because the command may finish before
        # we conclude this request
        models.commit()
        kwargs = dict(extra_vars=extra_vars, skip_tags="package-install")
        call_ansible.apply_async(
            args=('mon', hosts, identifier),
            kwargs=kwargs,
        )

        return task