diff --git a/ansible/post-deploy.yml b/ansible/post-deploy.yml index 74c1bfe26c..95fa0aab10 100644 --- a/ansible/post-deploy.yml +++ b/ansible/post-deploy.yml @@ -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: diff --git a/ansible/roles/common/templates/clouds.yaml.j2 b/ansible/roles/common/templates/clouds.yaml.j2 new file mode 100644 index 0000000000..574a603f9f --- /dev/null +++ b/ansible/roles/common/templates/clouds.yaml.j2 @@ -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 %} diff --git a/doc/source/contributor/vagrant-dev-env.rst b/doc/source/contributor/vagrant-dev-env.rst index 7d231910eb..9edbedaee1 100644 --- a/doc/source/contributor/vagrant-dev-env.rst +++ b/doc/source/contributor/vagrant-dev-env.rst @@ -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. diff --git a/doc/source/user/quickstart.rst b/doc/source/user/quickstart.rst index 7831018e5d..f9e80abbd3 100644 --- a/doc/source/user/quickstart.rst +++ b/doc/source/user/quickstart.rst @@ -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. diff --git a/tools/init-runonce b/tools/init-runonce index 9e4b5b2b71..5dd9c6b815 100755 --- a/tools/init-runonce +++ b/tools/init-runonce @@ -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 \\