Add ability to change apt/yum package state

The current method of installing the distribution packages required is
set in the tasks and cannot be changed by a deployer.

Currently the apt task always installs the latest package. This results
in unexpected binary changes when a deployer may simply be trying to
execute a configuration change.

This patch adds the ability for a deployer to change the desired state
so that the results are predictable.

This patch also remove duplicated apt install tasks and the is_metal
variable which is not used anywhere.

Change-Id: I0368cb090b37bf92b0ffce3cee8d7f4c4f61135b
This commit is contained in:
Jesse Pretorius 2016-08-02 13:57:38 +01:00
parent 5b730be398
commit 9116aa05c0
5 changed files with 20 additions and 17 deletions

View File

@ -1,6 +1,6 @@
---
# Copyright 2015, Rackspace US, Inc.
#
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
@ -13,12 +13,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#: The role will be deployed on a host machine (vs. in container)
is_metal: true
#: Enable for debug logging level
debug: false
# Set the package install state for distribution packages
# Options are 'present' and 'latest'
gnocchi_package_state: "latest"
# These variables are used in 'developer mode' in order to allow the role
# to build an environment directly from a git source without the presence
# of an OpenStack-Ansible repo_server.

View File

@ -0,0 +1,13 @@
---
features:
- The os_gnocchi role now supports the ability to configure whether
apt/yum tasks install the latest available package, or just ensure
that the package is present. The default action is to ensure that
the latest package is present. The action taken may be changed to
only ensure that the package is present by setting
``gnocchi_package_state`` to ``present``.
upgrade:
- The os_gnocchi role always checks whether the latest package is
installed when executed. If a deployer wishes to change the check to
only validate the presence of the package, the option
``gnocchi_package_state`` should be set to ``present``.

View File

@ -49,16 +49,6 @@
when:
- not gnocchi_developer_mode | bool
- name: Install apt packages
apt:
pkg: "{{ item }}"
state: latest
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: gnocchi_apt_packages
- name: Install required pip packages
pip:
name: "{{ gnocchi_required_pip_packages | join(' ') }}"

View File

@ -30,9 +30,9 @@
- name: Install apt packages
apt:
pkg: "{{ item }}"
state: latest
state: "{{ gnocchi_package_state }}"
register: install_packages
until: install_packages|success
retries: 5
delay: 2
with_items: gnocchi_apt_packages
with_items: gnocchi_apt_packages

View File

@ -1,4 +1,3 @@
is_metal: false
debug: true
galera_client_drop_config_file: false
galera_root_password: "secrete"