Merge "Add clouds.yaml file and use it"

This commit is contained in:
Zuul 2022-08-09 13:14:55 +00:00 committed by Gerrit Code Review
commit 981699f554
5 changed files with 59 additions and 10 deletions

View File

@ -1,4 +1,25 @@
---
- name: Creating clouds.yaml file on the deploy node
hosts: localhost
tasks:
- name: Create /etc/openstack directory
become: true
file:
state: directory
dest: "/etc/openstack"
owner: "{{ ansible_facts.user_uid }}"
group: "{{ ansible_facts.user_gid }}"
mode: 0700
- name: Template out clouds.yaml
become: true
template:
src: "roles/common/templates/clouds.yaml.j2"
dest: "/etc/openstack/clouds.yaml"
owner: "{{ ansible_facts.user_uid }}"
group: "{{ ansible_facts.user_gid }}"
mode: 0600
- name: Creating admin openrc file on the deploy node
hosts: localhost
tasks:

View File

@ -0,0 +1,26 @@
clouds:
kolla-admin:
auth:
auth_url: {{ keystone_public_url }}
project_domain_name: Default
user_domain_name: Default
project_name: {{ keystone_admin_project }}
username: {{ keystone_admin_user }}
password: {{ keystone_admin_password }}
region_name: {{ openstack_region_name }}
{% if kolla_admin_openrc_cacert is not none and kolla_admin_openrc_cacert | length > 0 %}
cacert: {{ kolla_admin_openrc_cacert }}
{% endif %}
kolla-admin-internal:
auth:
auth_url: {{ keystone_internal_url }}
project_domain_name: Default
user_domain_name: Default
project_name: {{ keystone_admin_project }}
username: {{ keystone_admin_user }}
password: {{ keystone_admin_password }}
interface: internal
region_name: {{ openstack_region_name }}
{% if kolla_admin_openrc_cacert is not none and kolla_admin_openrc_cacert | length > 0 %}
cacert: {{ kolla_admin_openrc_cacert }}
{% endif %}

View File

@ -246,7 +246,7 @@ Validate OpenStack is operational:
.. code-block:: console
kolla-ansible post-deploy
. /etc/kolla/admin-openrc.sh
export OS_CLOUD=kolla-admin
openstack user list
Or navigate to ``http://172.28.128.254/`` with a web browser.

View File

@ -537,15 +537,14 @@ Using OpenStack
pip install python-openstackclient -c https://releases.openstack.org/constraints/upper/|KOLLA_OPENSTACK_RELEASE|
#. OpenStack requires an openrc file where credentials for admin user
are set. To generate this file:
#. OpenStack requires a ``clouds.yaml`` file where credentials for the
admin user are set. To generate this file:
* For deployment or evaluation, run:
.. code-block:: console
kolla-ansible post-deploy
. /etc/kolla/admin-openrc.sh
* For development, run:
@ -553,7 +552,6 @@ Using OpenStack
cd kolla-ansible/tools
./kolla-ansible post-deploy
. /etc/kolla/admin-openrc.sh
#. Depending on how you installed Kolla Ansible, there is a script that will
create example networks, images, and so on.

View File

@ -47,12 +47,16 @@ for i in curl openstack; do
fi
done
# Test for credentials set
if [[ "${OS_USERNAME}" == "" ]]; then
echo "No Keystone credentials specified. Try running source /etc/kolla/admin-openrc.sh command"
exit
# Test for clouds.yaml
if [[ ! -f /etc/openstack/clouds.yaml ]]; then
echo "/etc/openstack/clouds.yaml is missing."
echo " Did your deploy finish successfully?"
exit 1
fi
# Select admin account from clouds.yaml
export OS_CLOUD=kolla-admin
# Test to ensure configure script is run only once
if $KOLLA_OPENSTACK_COMMAND image list | grep -q cirros; then
echo "This tool should only be run once per deployment."
@ -144,7 +148,7 @@ Done.
To deploy a demo instance, run:
openstack server create \\
openstack --os-cloud=kolla-admin server create \\
--image ${IMAGE_NAME} \\
--flavor m1.tiny \\
--key-name mykey \\