-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathenvrc
More file actions
59 lines (48 loc) · 1.71 KB
/
envrc
File metadata and controls
59 lines (48 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
rootdir=$(pwd)
export ROOT_DIR=${rootdir}
export ANSIBLE_CONFIG=$ROOT_DIR/ansible.cfg
cp -f ${rootdir}/githooks/* ${rootdir}/.git/hooks/
check_python_version() {
python_versions="3.11 3.12 3.13"
found=""
python_is_installed=""
for python_version in $python_versions; do
python_is_installed=`(which "python$python_version")`
if [[ "$python_is_installed" == "" ]] then
echo "Python$python_version is not installed."
else
found="True"
echo "Found $python_is_installed"
break
fi
done
if [[ "$found" != "True" ]] then
echo "Required Python3 is not installed."
exit 1
fi
alias python3="$python_is_installed"
}
check_python_version
show_tree() {
local depth=$1
find ./ansible -maxdepth $depth ! -path "*log*" ! -path "*.ansible*" | sort | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/| - \1/"
find ./inventories -maxdepth $depth | sed -e "s/[^-][^\/]*\// |/g" -e "s/|\([^ ]\)/| - \1/"
}
generate_os_client_config() {
local env=$1
local lab_name=$2
output=$ROOT_DIR/generated/${env}_clouds.yml
controller01_ip_addr=`(yq '.controller01.mgmtnet_ip_address' inventories/$env/nodes.yml)`
os_keystone_password=`(yq '.os_keystone_password' ansible/deploy_openstack/inventories/$env/group_vars/all/common_secret.yml)`
echo "---" > $output
echo "clouds:" >> $output
echo " $lab_name:" >> $output
echo " auth:" >> $output
echo " auth_url: http://$controller01_ip_addr:5000/v3" >> $output
echo " username: admin" >> $output
echo " password: $os_keystone_password" >> $output
echo " project_name: admin" >> $output
echo " user_domain_name: default" >> $output
echo " project_domain_name: default" >> $output
echo " identity_api_version: 3" >> $output
}