mirror of
https://github.com/88lex/sa-gen.git
synced 2025-02-21 22:23:32 +08:00
Add check for sa-gen.conf , create if it does not exist
This commit is contained in:
parent
8dfdb0ab63
commit
c6b13f9b53
2 changed files with 12 additions and 2 deletions
|
@ -3,8 +3,9 @@
|
||||||
May 2023 NOTE: `sa-gen` has been updated to
|
May 2023 NOTE: `sa-gen` has been updated to
|
||||||
- Create a Google Group if it does not already exist (set in sa-gen.conf)
|
- Create a Google Group if it does not already exist (set in sa-gen.conf)
|
||||||
- Automatically add service account emails to the specified Google Group
|
- Automatically add service account emails to the specified Google Group
|
||||||
- Install gcloud sdk (if you need) with the `install_gcloud` script
|
- Install gcloud sdk with the `install_gcloud` script
|
||||||
- Use sa-gen.conf to specify variables (You must rename or copy sa-gen-default.conf to sa-gen.conf, then edit it)
|
- Edit sa-gen.conf to specify group name, group email, etc.
|
||||||
|
- If no sa-gen.conf exists then running sa-gen Creates a default sa-gen.conf, then stops. Edit with nano/vim
|
||||||
- Generate a random alphanumeric SUFFIX for your projects (Google needs a unique project name)
|
- Generate a random alphanumeric SUFFIX for your projects (Google needs a unique project name)
|
||||||
- SUFFIX may also be set manually in `sa-gen.conf` if you like
|
- SUFFIX may also be set manually in `sa-gen.conf` if you like
|
||||||
- Prior versions of sa-gen still run, and have been put in the /old directory
|
- Prior versions of sa-gen still run, and have been put in the /old directory
|
||||||
|
|
9
sa-gen
9
sa-gen
|
@ -1,5 +1,13 @@
|
||||||
#!/bin/bash -v
|
#!/bin/bash -v
|
||||||
|
|
||||||
|
function check_config() {
|
||||||
|
if [ ! -f sa-gen.conf ]; then
|
||||||
|
cp sa-gen-default.conf sa-gen.conf
|
||||||
|
echo -e "\nCreated sa-gen.conf with default settings.\nEdit using nano or vim to specify a group name and email.\n"
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
# Display gcloud sdk organization and active admin project and enable admin APIs
|
# Display gcloud sdk organization and active admin project and enable admin APIs
|
||||||
function check_prereqs() {
|
function check_prereqs() {
|
||||||
gcloud organizations list
|
gcloud organizations list
|
||||||
|
@ -42,6 +50,7 @@ function create_service_accounts() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
check_config
|
||||||
check_prereqs
|
check_prereqs
|
||||||
source sa-gen.conf
|
source sa-gen.conf
|
||||||
create_projects
|
create_projects
|
||||||
|
|
Loading…
Reference in a new issue