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
This commit is contained in:
Jesse Pretorius 2017-05-22 12:58:49 +00:00
parent c59387340f
commit 359cd83d5d
2 changed files with 12 additions and 5 deletions

View File

@ -252,10 +252,17 @@
- name: Record the need for a db sync - name: Record the need for a db sync
ini_file: ini_file:
dest: /etc/ansible/facts.d/keystone.fact dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: general section: keystone
option: need_db_sync option: need_db_sync
value: True value: True
when: keystone_get_venv | changed or when: keystone_get_venv | changed or
keystone_venv_dir | changed or keystone_venv_dir | changed or
install_packages | changed 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 }}"

View File

@ -88,14 +88,14 @@
when: when:
- keystone_database_enabled | bool - keystone_database_enabled | bool
- inventory_hostname == ansible_play_hosts[0] - inventory_hostname == ansible_play_hosts[0]
- ansible_local.keystone.general.need_db_sync | bool - ansible_local['openstack_ansible']['keystone']['need_db_sync'] | bool
tags: tags:
- keystone-config - keystone-config
- name: Disable the need of a db sync on all nodes - name: Disable the need of a db sync on all nodes
ini_file: ini_file:
dest: /etc/ansible/facts.d/keystone.fact dest: "/etc/ansible/facts.d/openstack_ansible.fact"
section: general section: keystone
option: need_db_sync option: need_db_sync
value: False value: False
when: dbsync | succeeded when: dbsync | succeeded