Merge pull request #1516 from ceph/docker-registry

generate_group_vars_sample: merge role variables
pull/1527/head
Andrew Schoen 2017-05-15 13:33:03 -05:00 committed by GitHub
commit d0dd321294
3 changed files with 62 additions and 20 deletions

View File

@ -2,20 +2,20 @@
set -euo pipefail
#############
# VARIABLES #
#############
basedir=$(dirname "$0")
no_header="ceph-docker-common" # pipe separated list of roles with no header, MUST end with '$', e.g: 'foo$|bar$'
merge_in_all="ceph-common$|ceph-docker-common$" # pipe separated list of roles you want to merge in all.yml.sample, MUST end with '$', e.g: 'foo$|bar$'
for role in "$basedir"/roles/ceph-*; do
rolename=$(basename "$role")
if [[ $rolename == "ceph-common" ]]; then
output="all.yml.sample"
elif [[ $rolename == "ceph-agent" ]]; then
output="agent.yml.sample"
elif [[ $rolename == "ceph-fetch-keys" ]]; then
output="ceph-fetch-keys.yml.sample"
else
output="${rolename:5}s.yml.sample"
fi
#############
# FUNCTIONS #
#############
populate_header () {
cat <<EOF > "$basedir"/group_vars/"$output"
---
# Variables here are applicable to all host groups NOT roles
@ -27,21 +27,52 @@ for role in "$basedir"/roles/ceph-*; do
dummy:
EOF
defaults="$role"/defaults/main.yml
if [[ ! -f $defaults ]]; then
continue
fi
}
generate_group_vars_file () {
if [ "$(uname)" == "Darwin" ]; then
sed '/^---/d; s/^\([A-Za-z[:space:]]\)/#\1/' \
"$defaults" >> "$basedir"/group_vars/"$output"
sed '/^---/d; s/^\([A-Za-z[:space:]]\)/#\1/' \
"$defaults" >> "$basedir"/group_vars/"$output"
echo >> "$basedir"/group_vars/"$output"
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
elif [ "$(uname -s)" == "Linux" ]; then
sed '/^---/d; s/^\([A-Za-z[:space:]].\+\)/#\1/' \
"$defaults" >> "$basedir"/group_vars/"$output"
"$defaults" >> "$basedir"/group_vars/"$output"
echo >> "$basedir"/group_vars/"$output"
else
echo "Unsupported platform"
exit 1
fi
}
########
# MAIN #
########
for role in "$basedir"/roles/ceph-*; do
rolename=$(basename "$role")
if echo "$rolename" | grep -qE "$merge_in_all"; then
output="all.yml.sample"
elif [[ $rolename == "ceph-agent" ]]; then
output="agent.yml.sample"
elif [[ $rolename == "ceph-fetch-keys" ]]; then
output="ceph-fetch-keys.yml.sample"
else
output="${rolename:5}s.yml.sample"
fi
# Do not re-regenerate the header for certain roles
# since we merge them in all.yml.sample
if ! echo "$rolename" | grep -qE "$no_header"; then
populate_header
fi
defaults="$role"/defaults/main.yml
if [[ ! -f $defaults ]]; then
continue
fi
generate_group_vars_file
done

View File

@ -403,3 +403,14 @@ dummy:
# do not ever change this here
#rolling_update: false
#ceph_docker_registry: docker.io
#ceph_docker_enable_centos_extra_repo: false
#mon_use_fqdn: false # if set to true, the MON name used will be the fqdn
# Set uid/gid to default '64045' for bootstrap directories.
# '64045' is used for debian based distros. It must be set to 167 in case of rhel based distros.
# These values have to be set according to the base OS used by the container image, NOT the host.
#bootstrap_dirs_owner: "64045"
#bootstrap_dirs_group: "64045"

View File

@ -37,7 +37,7 @@ dummy:
# important to split them into shards. We suggest about 100K
# objects per shard as a conservative maximum.
#rgw_override_bucket_index_max_shards: 16
#
# Consider setting a quota on buckets so that exceeding this
# limit will require admin intervention.
#rgw_bucket_default_quota_max_objects: 1638400 # i.e., 100K * 16