Пример #1
0
def get_steps(r):
    """Bootstrap ansible and AIO."""

    nextsteps = []

    nextsteps.append(
        steps.SimpleCommandStep(
            'bootstrap-ansible',
            './scripts/bootstrap-ansible.sh',
            **r.kwargs)
        )
    nextsteps.append(
        steps.SimpleCommandStep(
            'bootstrap-aio',
            './scripts/bootstrap-aio.sh',
            **r.kwargs)
        )

    return nextsteps
Пример #2
0
def get_steps(r):
    nextsteps = []

    nextsteps.append(
        steps.SimpleCommandStep(
            'setup-ephyra',
            './helpers/setup-ephyra %s' % r.complete['osa-branch'],
            **r.kwargs))

    return nextsteps
Пример #3
0
def get_steps(r):
    """Final installation steps."""

    nextsteps = []

    #####################################################################
    # Release specific steps: Mitaka
    if r.complete['osa-branch'] == 'stable/mitaka' and utils.is_ironic(r):
        nextsteps.append(
            steps.SimpleCommandStep('add-ironic-to-nova-venv',
                                    './helpers/add-ironic-to-nova-venv',
                                    **r.kwargs))

    # Debug output that might be helpful, not scripts are running from
    # ostrich directory
    nextsteps.append(
        steps.SimpleCommandStep('lxc-details', './helpers/lxc-details',
                                **r.kwargs))
    nextsteps.append(
        steps.SimpleCommandStep('pip-ruin-everything',
                                ('pip install python-openstackclient '
                                 'python-ironicclient'), **r.kwargs))
    nextsteps.append(
        steps.SimpleCommandStep('os-cmd-bootstrap',
                                './helpers/os-cmd-bootstrap', **r.kwargs))

    # Remove our HTTP proxy settings because the interfere with talking to
    # OpenStack
    nextsteps.append(
        steps.KwargsStep(
            'kwargs-disable-http-proxy', r, {
                'max_attempts': 1,
                'env': {
                    'http_proxy': None,
                    'https_proxy': None,
                    'HTTP_PROXY': None,
                    'HTTPS_PROXY': None
                }
            }, **r.kwargs))

    return nextsteps
Пример #4
0
def get_steps(r):
    """Prepare apt."""

    nextsteps = []

    nextsteps.append(
        steps.SimpleCommandStep('apt-update', 'apt-get update', **r.kwargs))
    nextsteps.append(
        steps.SimpleCommandStep('apt-upgrade', 'apt-get upgrade -y',
                                **r.kwargs))
    nextsteps.append(
        steps.SimpleCommandStep('apt-dist-upgrade', 'apt-get dist-upgrade -y',
                                **r.kwargs))
    nextsteps.append(
        steps.SimpleCommandStep(
            'apt-useful', 'apt-get install -y screen ack-grep git expect lxc',
            **r.kwargs)),
    nextsteps.append(
        steps.SimpleCommandStep('dpkg-versions',
                                'dpkg -l > ~/.ostrich/dpkg-versions',
                                **r.kwargs))

    return nextsteps
Пример #5
0
def get_steps(r):
    """Checkout OSA."""

    tested = {}
    with open('tested.json') as f:
        tested = json.loads(f.read())
    r.tested = tested

    nextsteps = []
    nextsteps.append(
        steps.SimpleCommandStep(
            'git-checkout-osa',
            'git checkout %s' % r.tested[r.complete['osa-branch']],
            **r.kwargs))

    return nextsteps
Пример #6
0
def get_steps(r):
    """Clone OSA."""

    nextsteps = []
    nextsteps.append(
        steps.SimpleCommandStep(
            'git-clone-osa',
            ('git clone %s/openstack/openstack-ansible '
             '/opt/openstack-ansible' % r.complete['git-mirror-openstack']),
            **r.kwargs))
    nextsteps.append(
        steps.KwargsStep(
            'kwargs-osa', r, {
                'cwd': '/opt/openstack-ansible',
                'env': {
                    'ANSIBLE_ROLE_FETCH_MODE': 'git-clone',
                    'ANSIBLE_DEBUG': _ansible_debug(r),
                    'ANSIBLE_KEEP_REMOTE_FILES': '1'
                }
            }, **r.kwargs))

    if utils.is_ironic(r):
        nextsteps.append(
            steps.KwargsStep(
                'kwargs-ironic', r,
                {'env': {
                    'BOOTSTRAP_OPTS': 'nova_virt_type=ironic'
                }}, **r.kwargs))

    if r.complete['enable-ceph'] == 'yes':
        if r.complete['osa-branch'] in ['stable/mitaka', 'stable/newton']:
            # This isn't implemented for these releases
            pass
        else:
            nextsteps.append(
                steps.KwargsStep('kwargs-ceph', r,
                                 {'env': {
                                     'SCENARIO': 'ceph'
                                 }}, **r.kwargs))

    return nextsteps
Пример #7
0
def get_steps(r):
    """Do all the configuration we do before bootstrapping."""

    nextsteps = []

    p = urlparse.urlparse(r.complete['git-mirror-github'])
    mirror_host_github = p.netloc.split(':')[0]
    p = urlparse.urlparse(r.complete['git-mirror-openstack'])
    mirror_host_openstack = p.netloc.split(':')[0]

    nextsteps.append(
        steps.SimpleCommandStep(
            'git-mirror-host-keys',
            ('ssh-keyscan -H %s >> /etc/ssh/ssh_known_hosts' %
             mirror_host_openstack), **r.kwargs))

    if mirror_host_github != mirror_host_openstack:
        nextsteps.append(
            steps.SimpleCommandStep(
                'git-mirror-host-keys-github',
                ('ssh-keyscan -H %s >> /etc/ssh/ssh_known_hosts' %
                 mirror_host_github), **r.kwargs))

    if utils.is_ironic(r):
        if r.complete['osa-branch'] == 'stable/mitaka':
            nextsteps.append(steps.PatchStep('ironic-aio-mitaka', **r.kwargs))
        else:
            nextsteps.append(
                steps.YamlAddElementStep('enable-ironic-aio-scenario',
                                         'tests/bootstrap-aio.yml',
                                         [0, 'vars', 'confd_overrides', 'aio'],
                                         {'name': 'ironic.yml.aio'},
                                         **r.kwargs))

            if r.complete['osa-branch'] in ['stable/mitaka', 'stable/newton']:
                # This isn't implemented for these releases
                pass
            else:
                nextsteps.append(
                    steps.YamlAddElementStep(
                        'enable-ironic-ceph-scenario',
                        'tests/bootstrap-aio.yml',
                        [0, 'vars', 'confd_overrides', 'ceph'],
                        {'name': 'ironic.yml.aio'}, **r.kwargs))

        nextsteps.append(
            steps.FileAppendStep('group-vars-ironic_service_user_name',
                                 'playbooks/inventory/group_vars/all.yml',
                                 '\n\nironic_service_user_name: ironic',
                                 **r.kwargs))

    if r.complete['osa-branch'] != 'stable/mitaka':
        nextsteps.append(
            steps.RegexpEditorStep(
                'ansible-no-loopback-swap',
                ('/opt/openstack-ansible/tests/roles/bootstrap-host/'
                 'tasks/prepare_loopback_swap.yml'),
                'command: grep /openstack/swap.img /proc/swaps',
                'command: /bin/true', **r.kwargs))

    nextsteps.append(
        steps.RegexpEditorStep('lxc-cachable-downloads',
                               '/usr/share/lxc/templates/lxc-download',
                               'wget_wrapper -T 30 -q https?://',
                               'wget_wrapper -T 30 -q --no-hsts http://',
                               **r.kwargs))

    nextsteps.append(
        steps.SimpleCommandStep(
            'archive-upper-constraints',
            ('curl https://git.openstack.org/cgit/openstack/requirements/'
             'plain/upper-constraints.txt?id='
             '$(awk \'/requirements_git_install_branch:/ {print $2}\' '
             '/opt/openstack-ansible/playbooks/defaults/repo_packages/'
             'openstack_services.yml) -o ~/.ostrich/upper-contraints.txt'),
            **r.kwargs))

    return nextsteps
Пример #8
0
def get_steps(r):
    """Configure user variables with all our special things."""

    nextsteps = []

    if r.complete['http-proxy'] and r.complete['http-proxy'] != 'none':
        # This is the more permanent way of doing this
        local_servers = 'localhost,127.0.0.1'
        if r.complete['local-cache'] != 'none':
            local_servers += ',%s' % r.complete['local-cache']

        if r.complete['osa-branch'] == 'stable/mitaka':
            nextsteps.append(
                steps.FileAppendStep(
                    'proxy-environment-via-ansible',
                    '/etc/openstack_deploy/user_variables.yml',
                    (('\n\n'
                      'no_proxy_env: "%(local)s,{{ '
                      'internal_lb_vip_address }},{{ external_lb_vip_address }},'
                      '{%% for host in groups[\'all_containers\'] %%}'
                      '{{ hostvars[host][\'container_address\'] }}'
                      '{%% if not loop.last %%},{%% endif %%}{%% endfor %%}"\n'
                      'global_environment_variables:\n'
                      '  HTTPS_PROXY: "%(proxy)s"\n'
                      '  https_proxy: "%(proxy)s"\n'
                      '  HTTP_PROXY: "%(proxy)s"\n'
                      '  http_proxy: "%(proxy)s"\n'
                      '  NO_PROXY: "{{ no_proxy_env }}"\n'
                      '  no_proxy: "{{ no_proxy_env }}"') % {
                          'proxy': r.complete['http-proxy'],
                          'local': local_servers
                      }), **r.kwargs))

    nextsteps.append(
        steps.FileAppendStep('osa-debug-mode',
                             '/etc/openstack_deploy/user_variables.yml',
                             '\n\ndebug: true\nverbose: true', **r.kwargs))

    nextsteps.append(
        steps.FileCreateStep(
            'lxc-hosts-apt-keep-configs',
            '/etc/ansible/roles/lxc_hosts/templates/apt-keep-configs.j2',
            """Dpkg::Options {
   "--force-confdef";
   "--force-confold";
}""", **r.kwargs))

    nextsteps.append(
        steps.SimpleCommandStep(
            'lxc-hosts-apt-keep-configs-enable',
            """sed -i -e '/- name: Update container resolvers/ i \\- name: Always keep modified config files\\n  template:\\n    src: apt-keep-configs.j2\\n    dest: "{{ lxc_container_cache_path }}/{{ item.chroot_path }}/etc/apt/apt.conf.d/00apt-keep-configs"\\n  with_items: lxc_container_caches\\n  tags:\\n    - lxc-cache\\n    - lxc-cache-update\\n\\n'  /etc/ansible/roles/lxc_hosts/tasks/lxc_cache_preparation.yml""",
            **r.kwargs))

    # Make updates non-interactive
    if r.complete['osa-branch'] == 'stable/mitaka':
        nextsteps.append(
            steps.PatchStep('lxc-hosts-ucf-non-interactive', **r.kwargs))
        nextsteps.append(
            steps.PatchStep('cinder-constraints-mitaka', **r.kwargs))
    elif r.complete['osa-branch'] == 'stable/newton':
        nextsteps.append(
            steps.PatchStep('lxc-hosts-ucf-non-interactive-newton',
                            **r.kwargs))
    else:
        nextsteps.append(
            steps.PatchStep('lxc-hosts-ucf-non-interactive-ocata', **r.kwargs))

    # Patch ceph role to work
    if r.complete['enable-ceph'] == 'yes':
        if r.complete['osa-branch'] in ['stable/mitaka', 'stable/newton']:
            # This isn't implemented for these releases
            pass
        else:
            nextsteps.append(steps.PatchStep('ceph-global-pg_num', **r.kwargs))

    # Release specific steps: Mitaka
    if r.complete['osa-branch'] == 'stable/mitaka' and utils.is_ironic(r):
        nextsteps.append(
            steps.FileAppendStep('enable-ironic',
                                 '/etc/openstack_deploy/user_variables.yml',
                                 '\n\nnova_virt_type: ironic\n', **r.kwargs))

    # Turn on agent logging in ironic
    if utils.is_ironic(r):
        nextsteps.append(steps.PatchStep('ironic-agent-logs', **r.kwargs))

    return nextsteps
def get_steps(r):
    """Configure all the special things for ironic networking."""

    nextsteps = []

    if not utils.is_ironic(r):
        return []

    nextsteps.append(
        steps.YamlAddElementStep(
            'add-provider-network',
            '/etc/openstack_deploy/openstack_user_config.yml',
            ['global_overrides', 'provider_networks'], {
                'network': {
                    'group_binds': [
                        'neutron_linuxbridge_agent',
                        'ironic_conductor_container', 'ironic_api_container'
                    ],
                    'container_bridge':
                    'br-ironic',
                    'container_type':
                    'veth',
                    'container_interface':
                    'eth12',
                    'type':
                    'flat',
                    'net_name':
                    'ironic',
                    'ip_from_q':
                    'ironic'
                }
            }, **r.kwargs))

    nextsteps.append(
        steps.YamlDeleteElementStep(
            'delete-provider-network',
            '/etc/openstack_deploy/openstack_user_config.yml',
            ['global_overrides', 'provider_networks'], 2, **r.kwargs))

    net, hosts = utils.expand_ironic_netblock(r)

    nextsteps.append(
        steps.YamlUpdateElementStep(
            'configure-external-lb-ip',
            '/etc/openstack_deploy/openstack_user_config.yml',
            ['global_overrides'], 'external_lb_vip_address', str(hosts[4]),
            **r.kwargs))

    nextsteps.append(
        steps.YamlUpdateDictionaryStep(
            'add-network-cidr',
            '/etc/openstack_deploy/openstack_user_config.yml',
            ['cidr_networks'], {'ironic': str(net)}, **r.kwargs))

    nextsteps.append(
        steps.YamlAddElementStep(
            'reserve-netblock-start',
            '/etc/openstack_deploy/openstack_user_config.yml', ['used_ips'],
            '%s,%s' % (hosts[0], hosts[10]), **r.kwargs))
    nextsteps.append(
        steps.YamlAddElementStep(
            'reserve-netblock-end',
            '/etc/openstack_deploy/openstack_user_config.yml', ['used_ips'],
            '%s,%s' % (hosts[-10], hosts[-1]), **r.kwargs))
    nextsteps.append(
        steps.SimpleCommandStep('add-ironic-bridge', 'brctl addbr br-ironic',
                                **r.kwargs))
    nextsteps.append(
        steps.SimpleCommandStep('add-ironic-bridge-nic',
                                'brctl addif br-ironic eth1', **r.kwargs))
    nextsteps.append(
        steps.SimpleCommandStep('add-ironic-bridge-ip',
                                'ifconfig br-ironic inet %s up' % hosts[4],
                                **r.kwargs))
    nextsteps.append(
        steps.SimpleCommandStep('add-ironic-interface-ip',
                                'ifconfig eth1 inet %s up' % hosts[3],
                                **r.kwargs))

    if r.complete['osa-branch'] in ['stable/mitaka', 'stable/newton']:
        nextsteps.append(steps.PatchStep('ironic-vip-address', **r.kwargs))
    else:
        nextsteps.append(
            steps.PatchStep('ironic-vip-address-ocata', **r.kwargs))

    return nextsteps