Add nextcloud version knowledge
This commit is contained in:
parent
c5e5279f0e
commit
2a59d0995c
29
facts.d/nc_versions.sh
Executable file
29
facts.d/nc_versions.sh
Executable file
|
@ -0,0 +1,29 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
repo="/var/cache/cosmos/repo"
|
||||||
|
common="${repo}/global/overlay/etc/hiera/data/common.yaml"
|
||||||
|
|
||||||
|
function print_fact {
|
||||||
|
customer=${1}
|
||||||
|
environment=${2}
|
||||||
|
version=${3}
|
||||||
|
if [[ ${version} != 'null' ]]; then
|
||||||
|
echo "nextcloud_version_${environment}_${customer}=${version}"
|
||||||
|
else
|
||||||
|
echo "nextcloud_version_${environment}_${customer}=$(yq -r ".${key}" "${common}")"
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
for environment in test prod; do
|
||||||
|
key="nextcloud_version_${environment}"
|
||||||
|
for customer in $(yq -r '.multinode_mapping | keys| .[]' "${common}"); do
|
||||||
|
group="${repo}/multinode-common/overlay/etc/hiera/data/group.yaml"
|
||||||
|
version=$(yq -r ".${key}" "${group}")
|
||||||
|
print_fact "${customer}" "${environment}" "${version}"
|
||||||
|
done
|
||||||
|
for customer in $(yq -r '.fullnodes[]' "${common}"); do
|
||||||
|
group="${repo}/${customer}-common/overlay/etc/hiera/data/group.yaml"
|
||||||
|
version=$(yq -r ".${key}" "${group}")
|
||||||
|
print_fact "${customer}" "${environment}" "${version}"
|
||||||
|
done
|
||||||
|
done
|
Loading…
Reference in a new issue