diff --git a/bin/config/pritunl-orgs.dat b/bin/config/pritunl-orgs.dat new file mode 100644 index 0000000..df146cd --- /dev/null +++ b/bin/config/pritunl-orgs.dat @@ -0,0 +1,3 @@ +CUSTOMERS +AILABS +MRDEVOPS diff --git a/bin/lib/base.lib b/bin/lib/base.lib index 6a68dd0..f9e7a9a 100644 --- a/bin/lib/base.lib +++ b/bin/lib/base.lib @@ -158,6 +158,24 @@ function container_mode() { } +# Read a file to convert to array +# Use global var ARRAY, set to empty before to call this function +function read_file_to_array() { + + local afile="$1" + + if [[ ! -f "${afile}" ]]; then + return 1 + fi + + while IFS= read -r line; do + ARRAY+=("${line}") + done < "${afile}" + + return 0 +} + + # Git init repository function git_init() { diff --git a/bin/vpn_users.sh b/bin/vpn_users.sh index 1486972..b0f636d 100755 --- a/bin/vpn_users.sh +++ b/bin/vpn_users.sh @@ -21,6 +21,7 @@ DEVSPATH=devs BIN_HOME=$HOME/$DEVSPATH BIN_MESG=bin/msg BIN_LIBS=bin/lib +BIN_CFGS=bin/config VERSION=1.0.1 # CHECK SHELL LANGUAGE @@ -58,14 +59,21 @@ function vpn_pritunl_users_form() { declare -a response c_lbl, c_hlp, c_mod, c_opt, c_val, c_dat, c_def + declare -a ARRAY + c_val[0]=013 + read_file_to_array "${BIN_HOME}/${BIN_CFGS}/pritunl-orgs.dat" + if [ $? -ne 0 ]; then + ARRAY[0]="" + c_val[0]=0 + fi + # Input: Organization Pritunl VPN c_lbl[0]="${pllbl_000}" c_hlp[0]="${plhlp_000}" c_mod[0]=1 c_opt[0]=0 - c_def[0]="CUSTOMERS" - c_val[0]=0 - c_dat[0]="" + c_def[0]="${ARRAY[0]}" + c_dat[0]="${ARRAY[@]}" # Input: User Pritunl VPN c_lbl[1]="${pllbl_001}" c_hlp[1]="${plhlp_001}" diff --git a/inventory/group_vars/all/owner.yaml b/inventory/group_vars/all/owner.yaml index cfad075..a5a690e 100644 --- a/inventory/group_vars/all/owner.yaml +++ b/inventory/group_vars/all/owner.yaml @@ -6,11 +6,16 @@ # Created 2024-03-14-00:12:00 # Updated 2024-06-01-00:41:00 -# Devops Default Path Configuration +# Platform Base Configuration platform_name: "DEVOPS ROSERO ONE" platform_domain: "rosero.one" platform_devops_group: 'Devops' + +# Platform Email Configuration + platform_devops_email: "{{ platform_devops_group | lower }}@{{ platform_domain }}" + +# Platform Owner Configuration platform_owner_user: "mrosero" platform_owner_fname: 'Mauro' platform_owner_mname: ' ' @@ -19,16 +24,20 @@ platform_owner_codename: 'gandalf' platform_owner_fullname: "{{ platform_owner_fname }}{ platform_owner_mname }}{{ platform_owner_lname }} {{ platform_owner_sname }}" platform_owner_email: "{{ platform_owner_fname | lower }}@{{ platform_domain }}" - platform_devops_email: "{{ platform_devops_group | lower }}@{{ platform_domain }}" platform_owner_web: "{{ platform_owner_fname | lower }}.{{ platform_domain }}" + platform_owner_ssh: true + platform_owner_ssh_path: "{{ lookup('env','OWNER_SSHPATH') | default(ssh_default_path, true) }}" + platform_owner_uid: 10005 + +# Platform Git Configuration platform_git_server: "git.{{ platform_domain }}" + +# Platform VPN Configuration (PRITUNL) platform_vpn_server_devs: "vpnc.{{ platform_domain }}" platform_web_protocol: "https://" platform_vpn_api_port: 9443 platform_pritunl_org_default: CUSTOMERS platform_pritunl_usr_default: false platform_pritunl_img_default: false - platform_ssh_owner: true - platform_owner_sshkey: "{{ lookup('env','OWNER_SSHPATH') | default(ssh_default_path, true) }}" - linux_user_owner_uid: 10005 +