From 359cd83d5db4b415ae631722a795b805d756434c Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Mon, 22 May 2017 12:58:49 +0000 Subject: [PATCH] Add venv_tag local fact In order to make it easier to detect the currently deployed venv for a service, and therefore allow smarter decisions for things like upgrading, we implement the venv tag as a local fact. The file used to store facts will be the same for all OpenStack services, with each service using its own section. Example: "ansible_local": { "openstack_ansible": { "keystone": { "venv_tag": "14.2.1" } } } Change-Id: Icf443a93424c9eba7b68d3279ebb48ae00602808 --- tasks/keystone_install.yml | 11 +++++++++-- tasks/main.yml | 6 +++--- 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/tasks/keystone_install.yml b/tasks/keystone_install.yml index 6c0bcdf7..10eed3be 100644 --- a/tasks/keystone_install.yml +++ b/tasks/keystone_install.yml @@ -252,10 +252,17 @@ - name: Record the need for a db sync ini_file: - dest: /etc/ansible/facts.d/keystone.fact - section: general + dest: "/etc/ansible/facts.d/openstack_ansible.fact" + section: keystone option: need_db_sync value: True when: keystone_get_venv | changed or keystone_venv_dir | changed or install_packages | changed + +- name: Record the venv tag deployed + ini_file: + dest: "/etc/ansible/facts.d/openstack_ansible.fact" + section: keystone + option: venv_tag + value: "{{ keystone_venv_tag }}" diff --git a/tasks/main.yml b/tasks/main.yml index 1f331f64..2ed01a03 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -88,14 +88,14 @@ when: - keystone_database_enabled | bool - inventory_hostname == ansible_play_hosts[0] - - ansible_local.keystone.general.need_db_sync | bool + - ansible_local['openstack_ansible']['keystone']['need_db_sync'] | bool tags: - keystone-config - name: Disable the need of a db sync on all nodes ini_file: - dest: /etc/ansible/facts.d/keystone.fact - section: general + dest: "/etc/ansible/facts.d/openstack_ansible.fact" + section: keystone option: need_db_sync value: False when: dbsync | succeeded