mirror of https://github.com/ceph/ceph-ansible.git
commit
3c5fccbc2d
|
@ -1,22 +1,22 @@
|
||||||
#!/bin/bash
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
basedir=$(dirname "$0")
|
basedir=$(dirname "$0")
|
||||||
|
|
||||||
for role in "$basedir"/roles/ceph-*; do
|
for role in "$basedir"/roles/ceph-*; do
|
||||||
rolename=$(basename "$role")
|
rolename=$(basename "$role")
|
||||||
if [[ $rolename == "ceph-common" ]]; then
|
if [[ $rolename == "ceph-common" ]]; then
|
||||||
output="all.sample"
|
output="all.sample"
|
||||||
elif [[ $rolename == "ceph-agent" ]]; then
|
elif [[ $rolename == "ceph-agent" ]]; then
|
||||||
output="agent.sample"
|
output="agent.sample"
|
||||||
elif [[ $rolename == "ceph-fetch-keys" ]]; then
|
elif [[ $rolename == "ceph-fetch-keys" ]]; then
|
||||||
continue
|
continue
|
||||||
else
|
else
|
||||||
output="${rolename:5}s.sample"
|
output="${rolename:5}s.sample"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
cat <<EOF > "$basedir"/group_vars/"$output"
|
cat <<EOF > "$basedir"/group_vars/"$output"
|
||||||
---
|
---
|
||||||
# Variables here are applicable to all host groups NOT roles
|
# Variables here are applicable to all host groups NOT roles
|
||||||
|
|
||||||
|
@ -27,12 +27,21 @@ for role in "$basedir"/roles/ceph-*; do
|
||||||
dummy:
|
dummy:
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
defaults="$role"/defaults/main.yml
|
defaults="$role"/defaults/main.yml
|
||||||
if [[ ! -f $defaults ]]; then
|
if [[ ! -f $defaults ]]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$(uname)" == "Darwin" ]; then
|
||||||
|
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
|
||||||
sed '/^---/d; s/^\([A-Za-z[:space:]].\+\)/#\1/' \
|
sed '/^---/d; s/^\([A-Za-z[:space:]].\+\)/#\1/' \
|
||||||
"$defaults" >> "$basedir"/group_vars/"$output"
|
"$defaults" >> "$basedir"/group_vars/"$output"
|
||||||
echo >> "$basedir"/group_vars/"$output"
|
echo >> "$basedir"/group_vars/"$output"
|
||||||
|
else
|
||||||
|
echo "Unsupported platform"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
Loading…
Reference in New Issue