• ansible部署openstack


    官方参考文档:

    https://docs.openstack.org/project-deploy-guide/openstack-ansible/pike/index.html

    步骤如下:

    一、Prepare the deployment host

    centos 7.4

    # yum upgrade
    # yum install https://rdoproject.org/repos/openstack-pike/rdo-release-pike.rpm
    # yum install git ntp ntpdate openssh-server python-devel \
      sudo '@Development Tools'

    # systemctl stop firewalld
    # systemctl mask firewalld
    # git clone -b 16.0.6 https://git.openstack.org/openstack/openstack-ansible \
      /opt/openstack-ansible

    # scripts/bootstrap-ansible.sh
     

    运行结果如下:

    PLAY RECAP *******************************************************************************************************************************
    localhost : ok=4 changed=3 unreachable=0 failed=0


    二、Prepare the target hosts

    centos 7.4

    # yum upgrade
    # uname -r

    # yum install bridge-utils iputils lsof lvm2 \
      ntp ntpdate openssh-server sudo tcpdump

    # echo 'bonding' >> /etc/modules-load.d/openstack-ansible.conf
    # echo '8021q' >> /etc/modules-load.d/openstack-ansible.conf

    # systemctl enable ntpd.service
    # systemctl start ntpd.service


    三、Configure the deployment

    1、SSH免秘钥登录

    #ssh-keygen

     ssh-copy-id 10.20.0.161 

    2、参考: Appendix A: Example test environment configuration

     cp -r /opt/openstack-ansible/etc/openstack_deploy /etc/openstack_deploy

    3、

    # cd /opt/openstack-ansible/scripts
    # python pw-token-gen.py --file /etc/openstack_deploy/user_secrets.yml

    四、Run playbooks

    1、检查配置文件

    /opt/openstack-ansible/playbooks 

    # openstack-ansible setup-infrastructure.yml --syntax-check

    运行结果如下:

    Variable files: "-e @/etc/openstack_deploy/user_secrets.yml -e @/etc/openstack_deploy/user_variables.yml "
    [DEPRECATION WARNING]: docker is kept for backwards compatibility but usage is discouraged. The module documentation details page may
    explain more about this rationale..
    This feature will be removed in a future release. Deprecation warnings can be disabled by setting
    deprecation_warnings=False in ansible.cfg.

    playbook: setup-infrastructure.yml

    2、配置主机

    /opt/openstack-ansible/playbooks

    # openstack-ansible setup-hosts.yml

    在部署过程中安把相关模块拷贝到/tmp/ansible相关目录,可进去查看相关文件和脚本。

    结果如下:

    PLAY RECAP *******************************************************************************************************************************
    compute1 : ok=124 changed=5 unreachable=0 failed=0
    infra1 : ok=230 changed=34 unreachable=0 failed=0
    infra1_cinder_api_container-8d11bd70 : ok=36 changed=23 unreachable=0 failed=0
    infra1_cinder_scheduler_container-a69fa8e8 : ok=36 changed=23 unreachable=0 failed=0
    infra1_galera_container-3740013a : ok=36 changed=23 unreachable=0 failed=0
    infra1_glance_container-645e483a : ok=36 changed=23 unreachable=0 failed=0
    infra1_heat_apis_container-553f1d60 : ok=36 changed=23 unreachable=0 failed=0
    infra1_heat_engine_container-b280899b : ok=36 changed=23 unreachable=0 failed=0
    infra1_horizon_container-fa05a767 : ok=36 changed=23 unreachable=0 failed=0
    infra1_keystone_container-ddd81af5 : ok=36 changed=23 unreachable=0 failed=0
    infra1_memcached_container-cfa46b07 : ok=36 changed=23 unreachable=0 failed=0
    infra1_neutron_agents_container-82f0f27d : ok=39 changed=24 unreachable=0 failed=0
    infra1_neutron_server_container-9955a69f : ok=36 changed=23 unreachable=0 failed=0
    infra1_nova_api_metadata_container-7485edae : ok=36 changed=23 unreachable=0 failed=0
    infra1_nova_api_os_compute_container-0e1d8d5c : ok=36 changed=23 unreachable=0 failed=0
    infra1_nova_api_placement_container-052bbc2d : ok=36 changed=23 unreachable=0 failed=0
    infra1_nova_conductor_container-ecdf64e1 : ok=36 changed=23 unreachable=0 failed=0
    infra1_nova_console_container-731eb953 : ok=36 changed=23 unreachable=0 failed=0
    infra1_nova_scheduler_container-c0df3768 : ok=36 changed=24 unreachable=0 failed=0
    infra1_rabbit_mq_container-26dd0f12 : ok=39 changed=24 unreachable=0 failed=0
    infra1_repo_container-dcc1e2fb : ok=36 changed=23 unreachable=0 failed=0
    infra1_utility_container-9dc5996c : ok=36 changed=23 unreachable=0 failed=0
    storage1 : ok=0 changed=0 unreachable=1 failed=0

    中间遇到网络问题,系统问题比较多,花了2天多的时间解决了。

    (1)网络问题,官方网站是基于ubuntu写的配置文件/etc/network/interfaces,而我用的centos7.4的系统,没有这个配置文件,需要重新理解官方的配置,花了2天多的时间。

    (2)

    ok: [infra1] => {
    "msg": "Failed writing to \"/sys/fs/cgroup/pids/init.scope/pids.max\". While\nwe prefer setting this option it's not required. See the following\nissues on why this is desired and what can be done when the cgroup\nhierarchy exists.\n * https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1497420\n * https://github.com/lxc/lxc/issues/713\n * https://bugs.archlinux.org/index.php?do=details&action=details.addvote&task_id=47303\n"
    }

    原因是系统差异,缺少init.scope的目录

    /sys/fs/cgroup/pids/init.scope

    (3)其它可能就是网络的原因了,需要重新运行脚本。

    3、

    # openstack-ansible setup-infrastructure.yml
    这里遇到了个错误,没有解决。

    PLAY RECAP *******************************************************************************************************************************
    compute1 : ok=0 changed=0 unreachable=0 failed=0
    infra1 : ok=43 changed=20 unreachable=0 failed=0
    infra1_cinder_api_container-8d11bd70 : ok=0 changed=0 unreachable=0 failed=0
    infra1_cinder_scheduler_container-a69fa8e8 : ok=0 changed=0 unreachable=0 failed=0
    infra1_galera_container-3740013a : ok=27 changed=9 unreachable=0 failed=4
    infra1_glance_container-645e483a : ok=0 changed=0 unreachable=0 failed=0
    infra1_heat_apis_container-553f1d60 : ok=0 changed=0 unreachable=0 failed=0
    infra1_heat_engine_container-b280899b : ok=0 changed=0 unreachable=0 failed=0
    infra1_horizon_container-fa05a767 : ok=0 changed=0 unreachable=0 failed=0
    infra1_keystone_container-ddd81af5 : ok=0 changed=0 unreachable=0 failed=0
    infra1_memcached_container-cfa46b07 : ok=32 changed=20 unreachable=0 failed=0
    infra1_neutron_agents_container-82f0f27d : ok=0 changed=0 unreachable=0 failed=0
    infra1_neutron_server_container-9955a69f : ok=0 changed=0 unreachable=0 failed=0
    infra1_nova_api_metadata_container-7485edae : ok=0 changed=0 unreachable=0 failed=0
    infra1_nova_api_os_compute_container-0e1d8d5c : ok=0 changed=0 unreachable=0 failed=0
    infra1_nova_api_placement_container-052bbc2d : ok=0 changed=0 unreachable=0 failed=0
    infra1_nova_conductor_container-ecdf64e1 : ok=0 changed=0 unreachable=0 failed=0
    infra1_nova_console_container-731eb953 : ok=0 changed=0 unreachable=0 failed=0
    infra1_nova_scheduler_container-c0df3768 : ok=0 changed=0 unreachable=0 failed=0
    infra1_rabbit_mq_container-26dd0f12 : ok=0 changed=0 unreachable=0 failed=0
    infra1_repo_container-dcc1e2fb : ok=136 changed=69 unreachable=0 failed=0
    infra1_utility_container-9dc5996c : ok=0 changed=0 unreachable=0 failed=0
    localhost : ok=1 changed=1 unreachable=0 failed=0
    storage1 : ok=0 changed=0 unreachable=0 failed=0

    查看lxc的log发现如下的错误,没有解决,由于时间关系,没有继续。

    lxc-stop 20180201061201.516 WARN lxc_confile - confile.c:set_config_pivotdir:2262 - lxc.pivotdir is ignored. It will soon become an error.
    lxc-stop 20180201061201.551 INFO lxc_container - lxccontainer.c:do_lxcapi_shutdown:1757 - Using signal number '37' as halt signal.
    lxc-start 20180201061203.568 WARN lxc_monitor - monitor.c:lxc_monitor_fifo_send:111 - Failed to open fifo to send message: No such file or directory.
    lxc-start 20180201061203.569 INFO lxc_error - error.c:lxc_error_set_and_log:54 - Child <77237> ended on signal (2)
    lxc-start 20180201061203.569 INFO lxc_network - network.c:lxc_delete_network_priv:2501 - Interface "eth0" with index 121 already deleted or existing in different network namespace
    lxc-start 20180201061203.569 INFO lxc_network - network.c:lxc_delete_network_priv:2511 - Removed interface "eth0" with index 121
    lxc-start 20180201061203.590 INFO lxc_network - network.c:lxc_delete_network_priv:2532 - Removed interface "3740013a_eth0" from "lxcbr0"
    lxc-start 20180201061203.590 INFO lxc_network - network.c:lxc_delete_network_priv:2501 - Interface "eth1" with index 123 already deleted or existing in different network namespace
    lxc-start 20180201061203.590 INFO lxc_network - network.c:lxc_delete_network_priv:2511 - Removed interface "eth1" with index 123
    lxc-start 20180201061203.607 INFO lxc_network - network.c:lxc_delete_network_priv:2532 - Removed interface "3740013a_eth1" from "br-mgmt"
    lxc-start 20180201061203.607 WARN lxc_monitor - monitor.c:lxc_monitor_fifo_send:111 - Failed to open fifo to send message: No such file or directory.
    lxc-start 20180201061203.636 WARN lxc_monitor - monitor.c:lxc_monitor_fifo_send:111 - Failed to open fifo to send message: No such file or directory.
    lxc-start 20180201061203.636 INFO lxc_conf - conf.c:run_script_argv:398 - Executing script "/var/lib/lxc/infra1_galera_container-3740013a/veth-cleanup.sh" for container "infra1_galera_container-3740013a", config section "lxc".
    lxc-start 20180201061205.679 INFO lxc_start_ui - tools/lxc_start.c:main:277 - using rcfile /var/lib/lxc/infra1_galera_container-3740013a/config
    lxc-start 20180201061205.681 WARN lxc_confile - confile.c:set_config_pivotdir:2262 - lxc.pivotdir is ignored. It will soon become an error.
    lxc-start 20180201061205.682 INFO lxc_container - lxccontainer.c:do_lxcapi_start:877 - Attempting to set proc title to [lxc monitor] /var/lib/lxc infra1_galera_container-3740013a
    lxc-start 20180201061205.683 INFO lxc_lsm - lsm/lsm.c:lsm_init:48 - LSM security driver nop

    4、

    # ansible galera_container -m shell \
      -a "mysql -h localhost -e 'show status like \"%wsrep_cluster_%\";'"

    5、

    # openstack-ansible setup-openstack.yml


    Verifying OpenStack operation

  • 相关阅读:
    MySQL数据类型
    Linux网络编程:客户端/服务器的简单实现
    初学JAVA
    依据函数名字符串执行函数
    Windows Server 2012学习文档
    DELPHI WEBSERVICE
    常用函数、常量、类型记录
    CAD2007_DWG转PDF
    MCU_头文件编写
    MCU_存储器
  • 原文地址:https://www.cnblogs.com/zw2002/p/8351496.html
Copyright © 2020-2023  润新知