From 2d32083a27d024aa4557469f09e393865ad60092 Mon Sep 17 00:00:00 2001 From: Jeffrey Zhang Date: Thu, 19 Jan 2017 09:03:38 +0800 Subject: [PATCH] Detect openstack_release variable when it auto Get openstack_release variable from kolla-ansible version number when it is auto. Change-Id: Ibd0d8f85aed9d8198218c0dc85c367b331815100 --- ansible/group_vars/all.yml | 2 +- ansible/site.yml | 15 +++++++++++++++ etc/kolla/globals.yml | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/ansible/group_vars/all.yml b/ansible/group_vars/all.yml index b51b98903e..29a1fada4f 100644 --- a/ansible/group_vars/all.yml +++ b/ansible/group_vars/all.yml @@ -233,7 +233,7 @@ admin_protocol: "http" #################### # OpenStack options #################### -openstack_release: "4.0.0" +openstack_release: "auto" openstack_logging_debug: "False" openstack_region_name: "RegionOne" diff --git a/ansible/site.yml b/ansible/site.yml index 4596dc93b2..c47a95e12c 100644 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -31,6 +31,21 @@ when: - (play_hosts | length) != (groups['all'] | length) +- name: Detect openstack_release variable + hosts: all + gather_facts: false + tasks: + - name: Get current kolla-ansible version number + local_action: command python -c "import pbr.version; print(pbr.version.VersionInfo('kolla-ansible'))" + register: kolla_ansible_version + changed_when: false + when: openstack_release == "auto" + + - name: Set openstack_release variable + set_fact: + openstack_release: "{{ kolla_ansible_version.stdout }}" + when: openstack_release == "auto" + - name: Apply role prechecks hosts: - all diff --git a/etc/kolla/globals.yml b/etc/kolla/globals.yml index e8e288fbf3..3b8d3d5fd3 100644 --- a/etc/kolla/globals.yml +++ b/etc/kolla/globals.yml @@ -17,7 +17,7 @@ #kolla_install_type: "binary" # Valid option is Docker repository tag -#openstack_release: "4.0.0" +#openstack_release: "auto" # Location of configuration overrides #node_custom_config: "/etc/kolla/config"