共計 7076 個字符,預計需要花費 18 分鐘才能閱讀完成。
本篇文章為大家展示了 kolla-ansible 部署的示例分析,內容簡明扼要并且容易理解,絕對能使你眼前一亮,通過這篇文章的詳細介紹希望你能有所收獲。
kolla-ansible 部署的大致流程
執行命令 Kolla-ansible –i multinode deploy 后,koll 會調用 ansible-playbook 命令,
接著執行 ansible-playbook -i multinode -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml -e CONFIG_DIR=/etc/kolla -e action=deploy /usr/share/kolla-ansible/ansible/site.yml
然后安裝 site.yml 里的任務菜單按順序執行
ansibleLibraryKolla_container_facts.py
模塊:kolla_container_facts
描述:用于檢查是否有容器正在運行
選項:
api_version:docker-py 的 api 版本,非必要項,str 類型,默認值是 auto
name:容器名字,非必要項,str 或 list 類型
調用例子:
– hosts: all
tasks:
– name: Gather docker facts
kolla_container_facts:
– name: Gather glance container facts
kolla_container_facts:
name:
– glance_api
– glance_registry
Kolla_docker.py
模塊:kolla_docker
描述:用于控制 Docker 的容器
選項:
common_options:包含公共參數的字典選項,如登陸信息等,非必要項,dict 類型,默認值為 dict()
action:模塊當中可供調用的動作方法,必要項,str 類型, 可選擇的 action 有:compare_container,compare_image,create_volume,get_container_env,get_container_state,pull_iamge,remove_volume,remove_container,recreate_or_restart_container,restart_container,start_container,stop_container
api_version:docker-py 的 api 版本,非必要項,str 類型, 默認值是 auto
auth_email:用于認證的郵箱地址,非必要項,str 類型
auth_password:用于認證的密碼,非必要項,str 類型
auth_registry:用于認證的 registry,非必要項,str 類型
auth_username:用于認證的用戶名,非必要項,str 類型
detach:在容器創建后進行分離,非必要項,bool 類型, 默認值是 True
name:要管理的容器或卷的名字,非必要項,str 類型
environment:在容器里設置的環境變量,非必要項,dict 類型
image:docker 鏡像的名字,非必要項,str 類型
ipc_mode:設置 docker 的 ipc 命名空間,非必要項,str 類型,默認值是 None, 可選擇的值有:host
cap_add:給容器添加 capabilities,非必要項,list 類型, 默認值是 list()
security_opt:設置容器安全配置文件,非必要項,list 類型, 默認值是 list()
labels:應用于容器的標簽列表,非必要項,dict 類型, 默認值是 dict ()
pid_mode:設置 docker pid 命名空間,非必要項,str 類型, 默認值是 None , 可選擇的值有:host
privileged:給容器設置特權,非必要項,bool 類型, 默認值是 False
remove_on_exit:當沒有從容器分離時,在成功退出時刪除,非必要項,bool 類型, 默認值是 True
restart_policy:確定當容器退出時 docker 應做什么,非必要項,str 類型, 可選擇的值有:never,on-failure,always,unless-stopped
restart_retries:當 restart_policy 被設置時,容器重啟的次數,int 類型, 默認值是 10
volumes:設置要使用的卷,非必要項,list 類型
volumes_from:要使用卷的容器的名字或 ID,必要項 list 類型
調用例子:
– hosts: kolla_docker
tasks:
– name: Start container
kolla_docker:
image: ubuntu
name: test_container
action: start_container
– name: Remove container
kolla_docker:
name: test_container
action: remove_container
– name: Pull image without starting container
kolla_docker:
action: pull_container
image: private-registry.example.com:5000/ubuntu
– name: Create named volume
action: create_volume
name: name_of_volume
– name: Remove named volume
action: remove_volume
name: name_of_volume
Kolla_toolbox.py
模塊:kolla_toolbox
描述:被 kolla 項目用于在 kolla_toolbox 容器里調用 ansible 模塊
可選項:
module_name:調用的模塊名,必要項,str 類型
module_args:傳遞給被調用模塊的參數,非必要項,str 或 dict 類型
module_extra_vars: 傳遞給被調用模塊的額外參數,非必要項,str 或 dict 類型
調用例子:
– hosts: controller
tasks:
– name: Ensure the direct absent
kolla_toolbox:
module_name: file
module_args: path=/tmp/a state=absent
– name: Create mysql database
kolla_toolbox:
module_name: mysql_db
module_args:
login_host: 192.168.1.10
login_user: root
login_password: admin
name: testdb
– name: Creating default user role
kolla_toolbox:
module_name: os_keystone_role
module_args:
name: _member_
auth: {{{{ openstack_keystone_auth}} }}
module_extra_vars:
openstack_keystone_auth:
auth_url: http://127.0.0.1:5000
username: admin
password: password
project_name: admin
domain_name: default
Site.yml
描述:kolla-ansible 部署的入口,kolla 調用 ansible 執行 playbook 的入口文件
etckollaglobals.yml
描述: kolla-ansible 部署 openstack 時需要進行配置的全局變量。此配置文件可以對 kolla 項目所用到的變量進行重載。此文件所有被注釋掉的參數的默認值可以在 kolla-ansible/ansible/group_vars/all.yml 找到。
Kolla 選項
config_strategy: COPY_ALWAYS 可選項有 [COPY_ONCE, COPY_ALWAYS]
kolla_base_distro: centos 可選項有 [centos, oraclelinux, ubuntu]
kolla_install_type: source 可選項有 [binary, source]
openstack_release: 4.0.3 容器鏡像的版本
node_custom_config: /etc/kolla/config;可以在此目錄下自定義一些配置文件
kolla_internal_vip_address: 192.168.215.209 此 VIP 必須是個未被使用的 IP,它將被用于 keepalived 進行高可用
kolla_internal_fqdn: {{kolla_internal_vip_address}} 這是映射到 VIP 的 DNS 名
kolla_external_vip_address: {{kolla_internal_vip_address}} 此 VIP 必須是個未被使用的 IP,它將被用于 keepalived 進行高可用, 默認使用 kolla_internal_vip_address 時,允許內部和外部通信共享相同的地址
kolla_external_fqdn: {{kolla_external_vip_address}} 用于與要在其中創建的端點的 public_url 中設置的 OpenStack 進行通信的公共地址。
Docker 選項
docker_registry: 192.168.215.202:4000 docker 鏡像倉庫的地址
docker_namespace: lokolla 鏡像倉庫的命名空間
docker_registry_username: sam 鏡像倉庫的賬號
docker_registry_password: correcthorsebatterystaple 鏡像倉庫的密碼
Neutron 選項
network_interface: eth0 所有的 aip 服務默認是使用此網卡進行通信。此網卡必須包含一個 IPv4 地址
以下這幾個可以用于特定需求的網卡使用
#kolla_external_vip_interface: {{network_interface}}
#api_interface: {{network_interface}}
#storage_interface: {{network_interface}}
#cluster_interface: {{network_interface}}
#tunnel_interface: {{network_interface}}
#dns_interface: {{network_interface}}
neutron_external_interface: eth2 這是給 neutron 作為其外部網絡端口的原始接口
neutron_plugin_agent: openvswitch 可選項有 [openvswitch, linuxbridge]
keepalived 選項
keepalived_virtual_router_id: 52 keepalived 集群的唯一 ID,取值應該在 0 到 255 之間
TLS 選項
要在 kolla_external_vip_interface 上提供加密和身份驗證,可以啟用 TLS。啟用 TLS 時,必須提供證書以允許客戶端執行身份驗證。
kolla_enable_tls_external: no
kolla_external_fqdn_cert: {{node_config_directory}}/certificates/haproxy.pem
OpenStack 選項
openstack_logging_debug: False 可選項有 [True, False]
nova_console: novnc 可選項有 [novnc, spice]
啟動或關掉 openstack 服務的選項
#enable_aodh: no
#enable_barbican: no
#enable_ceilometer: no
#enable_central_logging: no
#enable_ceph: no
#enable_ceph_rgw: no
#enable_chrony: no
enable_cinder: yes
#enable_cinder_backend_hnas_iscsi: no
#enable_cinder_backend_hnas_nfs: no
#enable_cinder_backend_iscsi: no
enable_cinder_backend_lvm: yes
#enable_cinder_backend_nfs: no
。。。。。。。。。。。
Ceph 選項
Ceph 可以設置緩存來提高性能。要使用緩存,您必須提供不同于 OSD 的磁盤
ceph_enable_cache: no
ceph_cache_mode: writeback 可選項有 [forward, none, writeback]
ceph_pool_type: replicated 可選項有 [erasure, replicated];使用擦除編碼池的要求是必須設置緩存層
Keystone Identity 選項
keystone_token_provider: uuid;可選項有 [uuid, fernet]
fernet_token_expiry: 86400
Glance Image 選項
glance_backend_file: yes
glance_backend_ceph: no
Ceilometer 選項
ceilometer_database_type: mongodb;可選項有 [mongodb, mysql, gnocchi]
ceilometer_event_type: mongodb;可選項有 [mongodb, gnocchi, panko]
Barbican 選項
barbican_crypto_plugin: simple_crypto;可選項有 [simple_crypto, p11_crypto]
barbican_library_path: /usr/lib/libCryptoki2_64.so
Barbican 選項
panko_database_type: mysql;可選項有 [mongodb, mysql]
Gnocchi 選項
gnocchi_backend_storage: {{ceph if enable_ceph|bool else file}};可選項有 [file, ceph]
Cinder – Block Storage 選項
#cinder_backend_ceph: {{enable_ceph}}
cinder_volume_group: cinder-volumes
#cinder_backup_driver: nfs
#cinder_backup_share:
#cinder_backup_mount_options_nfs:
Designate 選項
designate_backend: bind9
designate_ns_record: sample.openstack.org
Nova – Compute 選項
#nova_backend_ceph: {{enable_ceph}}
Horizon – Dashboard 選項
#horizon_backend_database: {{enable_murano | bool}}
Manila – Shared File System 選項
# HNAS backend configuration
#hnas_ip:
#hnas_user:
#hnas_password:
#hnas_evs_id:
#hnas_evs_ip:
#hnas_file_system_name:
Swift – Object Storage 選項
Swift 希望可以使用塊設備進行存儲。支持兩種類型的存儲:1- 具有特殊分區名稱和文件系統標簽的存儲設備;2- 具有文件系統的未分區磁盤。該文件系統的標簽用于檢測 Swift 將要使用的磁盤。
#swift_devices_match_mode: strict;可選項有 [prefix, strict]
#swift_devices_name: KOLLA_SWIFT_DATA 此參數定義匹配模式:如果選擇了“strict”模式,對于 swift_devices_match_mode,swift_device_name 應指定特殊 swift 分區的名稱,例如:“KOLLA_SWIFT_DATA”,如果選擇“前綴”模式,則 swift_devices_name 應指定匹配的模式 到文件系統的標簽為快速準備
Tempest 選項 (openstack 集成測試套件)
tempest_image_id:
tempest_flavor_ref_id:
tempest_public_network_id:
tempest_floating_network_name:
# tempest_image_alt_id: {{tempest_image_id}}
# tempest_flavor_ref_alt_id: {{tempest_flavor_ref_id}}
上述內容就是 kolla-ansible 部署的示例分析,你們學到知識或技能了嗎?如果還想學到更多技能或者豐富自己的知識儲備,歡迎關注丸趣 TV 行業資訊頻道。