5.13. 准备通过 SSL/TLS 访问 Undercloud 的公共 API
overcloud 在升级过程中需要访问 undercloud 的 OpenStack Object Storage (swift)公共 API。如果您的 undercloud 使用自签名证书,则需要将 undercloud 的证书颁发机构添加到每个 overcloud 节点。
前提条件
- undercloud 将 SSL/TLS 用于其公共 API
流程
director 的动态 Ansible 脚本已更新至 OpenStack Platform 12 版本,该版本使用 overcloud 计划中的
RoleNetHostnameMapHeat 参数来定义清单。但是,overcloud 当前使用 OpenStack Platform 11 模板版本,它没有RoleNetHostnameMap参数。这意味着您需要创建一个临时静态清单文件,您可以使用以下命令生成:$ openstack server list -c Networks -f value | cut -d"=" -f2 > overcloud_hosts创建一个包含以下内容的 Ansible playbook (
undercloud-ca.yml):--- - name: Add undercloud CA to overcloud nodes hosts: all user: heat-admin become: true vars: ca_certificate: /etc/pki/ca-trust/source/anchors/cm-local-ca.pem tasks: - name: Copy undercloud CA copy: src: "{{ ca_certificate }}" dest: /etc/pki/ca-trust/source/anchors/ - name: Update trust command: "update-ca-trust extract" - name: Get the swift endpoint shell: | sudo hiera swift::keystone::auth::public_url | awk -F/ '{print $3}' register: swift_endpoint delegate_to: 127.0.0.1 become: yes become_user: stack - name: Verify URL uri: url: https://{{ swift_endpoint.stdout }}/healthcheck return_content: yes register: verify - name: Report output debug: msg: "{{ ansible_hostname }} can access the undercloud's Public API" when: verify.content == "OK"此 playbook 包含多个任务,在每个节点上执行以下操作:
-
将 undercloud 的证书颁发机构文件复制到 overcloud 节点。如果 undercloud 生成的默认位置为
/etc/pki/ca-trust/source/anchors/cm-local-ca.pem。 - 执行 命令,以更新 overcloud 节点上的证书颁发机构信任数据库。
- 检查 overcloud 节点上的 undercloud Object Storage Public API,并报告成功。
-
将 undercloud 的证书颁发机构文件复制到 overcloud 节点。如果 undercloud 生成的默认位置为
使用以下命令运行 playbook:
$ ansible-playbook -i overcloud_hosts undercloud-ca.yml这将使用临时清单为您的 overcloud 节点提供 Ansible。
如果使用自定义证书颁发机构文件,您可以将
ca_certificate变量改为一个位置。例如:$ ansible-playbook -i overcloud_hosts undercloud-ca.yml -e ca_certificate=/home/stack/ssl/ca.crt.pem生成的 Ansible 输出应该会显示节点的 debug 消息。例如:
ok: [192.168.24.100] => { "msg": "overcloud-controller-0 can access the undercloud's Public API" }
相关信息
- 有关在 overcloud 上运行 Ansible 自动化的更多信息,请参阅 Director 安装和使用 指南中的 "运行动态清单脚本 "。