Merge "config: Enable OSA_CONFIG_DIR to customize configuration folder"

This commit is contained in:
Zuul 2019-04-04 04:35:01 +00:00 committed by Gerrit Code Review
commit bfd0d4fb6c
5 changed files with 14 additions and 9 deletions

View File

@ -40,7 +40,7 @@ def args(arg_list):
'--config',
help='Path containing the user defined configuration files',
required=False,
default=None
default=os.getenv('OSA_CONFIG_DIR', None)
)
parser.add_argument(
'--list',

View File

@ -16,6 +16,9 @@
## OpenStack Source Code Release
openstack_release: "{{ lookup('env', 'OSA_VERSION') | default('undefined', true) }}"
## OpenStack Configuration directory
openstack_config_dir: "{{ lookup('env', 'OSA_CONFIG_DIR') | default('/etc/openstack_deploy') }}"
## Verbosity Options
debug: False

View File

@ -26,7 +26,7 @@ ceph_repository: community
# ceph-ansible roles. It is defaulted in ceph_client but set here to keep the
# OSA/ceph-ansible integrations in sync.
ceph_stable_release: mimic
fetch_directory: /etc/openstack_deploy/ceph-fetch/
fetch_directory: "{{ openstack_config_dir }}/ceph-fetch/"
# tries to create /var/log/ceph as a directory and fails if the log link already
# exists. we handle the log dir creation so this is not something we need
# ceph-common to prepare for us.

View File

@ -12,9 +12,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
export OSA_CONFIG_DIR="${OSA_CONFIG_DIR:-/etc/openstack_deploy}"
export ANSIBLE_RETRY_FILES_ENABLED="${ANSIBLE_RETRY_FILES_ENABLED:-False}"
export ANSIBLE_INVENTORY="${ANSIBLE_INVENTORY:-OSA_INVENTORY_PATH/dynamic_inventory.py,OSA_INVENTORY_PATH/inventory.ini,/etc/openstack_deploy/inventory.ini}"
export ANSIBLE_INVENTORY="${ANSIBLE_INVENTORY:-OSA_INVENTORY_PATH/dynamic_inventory.py,OSA_INVENTORY_PATH/inventory.ini,${OSA_CONFIG_DIR}/inventory.ini}"
export ANSIBLE_LOG_PATH="${ANSIBLE_LOG_PATH:-/openstack/log/ansible-logging/ansible.log}"
mkdir -p "$(dirname ${ANSIBLE_LOG_PATH})" || unset ANSIBLE_LOG_PATH
@ -33,7 +35,7 @@ export ANSIBLE_GATHERING="${ANSIBLE_GATHERING:-smart}"
export ANSIBLE_GATHER_SUBSET="${ANSIBLE_GATHER_SUBSET:-network,hardware,virtual}"
export ANSIBLE_CACHE_PLUGIN="${ANSIBLE_CACHE_PLUGIN:-jsonfile}"
export ANSIBLE_CACHE_PLUGIN_CONNECTION="${ANSIBLE_CACHE_PLUGIN_CONNECTION:-/etc/openstack_deploy/ansible_facts}"
export ANSIBLE_CACHE_PLUGIN_CONNECTION="${ANSIBLE_CACHE_PLUGIN_CONNECTION:-${OSA_CONFIG_DIR}/ansible_facts}"
export ANSIBLE_CACHE_PLUGIN_TIMEOUT="${ANSIBLE_CACHE_PLUGIN_TIMEOUT:-86400}"
if [[ "${ANSIBLE_CACHE_PLUGIN}" == "memcached" ]];then

View File

@ -38,17 +38,17 @@ if [[ "${PWD}" == *"OSA_CLONE_DIR"* ]] || [ "${RUN_CMD}" == "openstack-ansible"
. /usr/local/bin/openstack-ansible.rc
# Load userspace group vars
if [[ -d /etc/openstack_deploy/group_vars || -d /etc/openstack_deploy/host_vars ]]; then
if [[ ! -f /etc/openstack_deploy/inventory.ini ]]; then
echo '[all]' > /etc/openstack_deploy/inventory.ini
if [[ -d ${OSA_CONFIG_DIR}/group_vars || -d ${OSA_CONFIG_DIR}/host_vars ]]; then
if [[ ! -f ${OSA_CONFIG_DIR}/inventory.ini ]]; then
echo '[all]' > ${OSA_CONFIG_DIR}/inventory.ini
fi
fi
# Check whether there are any user configuration files
if ls -1 /etc/openstack_deploy/user_*.yml &> /dev/null; then
if ls -1 ${OSA_CONFIG_DIR}/user_*.yml &> /dev/null; then
# Discover the variable files.
VAR1="$(for i in $(ls /etc/openstack_deploy/user_*.yml); do echo -ne "-e @$i "; done)"
VAR1="$(for i in $(ls ${OSA_CONFIG_DIR}/user_*.yml); do echo -ne "-e @$i "; done)"
# Provide information on the discovered variables.
info "Variable files: \"${VAR1}\""