diff --git a/.github/workflows/setup-k3s-with-existed-vhost.yml b/.github/workflows/setup-k3s-with-existed-vhost.yml index 5881a78e..514469b3 100644 --- a/.github/workflows/setup-k3s-with-existed-vhost.yml +++ b/.github/workflows/setup-k3s-with-existed-vhost.yml @@ -24,50 +24,7 @@ defaults: working-directory: ./playbook jobs: - setup-gitlab: - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - - name: Setup Gitlab in K3S - shell: bash - run: | - export ANSIBLE_HOST_KEY_CHECKING=False - sudo apt install jq ansible -y - - mkdir -pv ~/.ssh/ - cat > ~/.ssh/id_rsa << EOF - ${SSH_PRIVATE_KEY} - EOF - sudo chmod 0400 ~/.ssh/id_rsa - md5sum ~/.ssh/id_rsa - - mkdir -pv hosts/ - cat > hosts/inventory << EOF - [master] - common-gitlab.apollo-ev.com ansible_host=47.91.19.2 - - [all:vars] - ansible_port=22 - ansible_ssh_user=root - ansible_ssh_private_key_file=~/.ssh/id_rsa - ansible_host_key_checking=False - dns_ak=$DNS_AK - dns_sk=$DNS_SK - ingress_ip=47.91.19.2 - smtp_password=$SMTP_PASSWORD - gitlab_oidc_client_token=$GITLAB_OIDC_CLIENT_TOKEN - EOF - #ansible-playbook -i hosts/inventory jobs/init_k3s_cluster -D - #ansible-playbook -i hosts/inventory jobs/init_gitlab -D - ansible-playbook -i hosts/inventory jobs/init_ssl_cert -D - #ansible-playbook -i hosts/inventory jobs/init_chatwithgpt -D - #ansible-playbook -i hosts/inventory jobs/init_harbor -D - #ansible-playbook -i hosts/inventory jobs/init_keycloak -D - #ansible-playbook -i hosts/inventory jobs/init_cert_manager -D - #ansible-playbook -i hosts/inventory jobs/init_openldap -D - setup-harbor: + setup-keycloak: runs-on: ubuntu-latest steps: @@ -89,7 +46,131 @@ jobs: mkdir -pv hosts/ cat > hosts/inventory << EOF [master] - common-gitlab.apollo-ev.com ansible_host=20.222.214.219 + mirrors.onwalk.net ansible_host=8.130.11.192 + + [all:vars] + ansible_port=8022 + ansible_ssh_user=root + ansible_ssh_private_key_file=~/.ssh/id_rsa + ansible_host_key_checking=False + ali_ak=$ALI_AK + ali_sk=$ALI_SK + dns_ak=$DNS_AK + dns_sk=$DNS_SK + ingress_ip=8.130.11.192 + harbor_admin_password=$HARBOR_ADMIN_PASSWORD + harbor_odic_client_token=$HARBOR_OIDC_CLIENT_TOKEN + EOF + ansible-playbook -i hosts/inventory jobs/init_k3s_cluster -D + ansible-playbook -i hosts/inventory jobs/init_keycloak -D -C + setup-gitlab: + runs-on: ubuntu-latest + needs: [setup-keycloak] + + steps: + - uses: actions/checkout@v3 + + - name: Setup Gitlab in K3S + shell: bash + run: | + export ANSIBLE_HOST_KEY_CHECKING=False + sudo apt install jq ansible -y + + mkdir -pv ~/.ssh/ + cat > ~/.ssh/id_rsa << EOF + ${SSH_PRIVATE_KEY} + EOF + sudo chmod 0400 ~/.ssh/id_rsa + md5sum ~/.ssh/id_rsa + + mkdir -pv hosts/ + cat > hosts/inventory << EOF + [master] + gitlab.onwalk.net ansible_host=20.48.21.165 + + [all:vars] + ansible_port=8022 + ansible_ssh_user=ubuntu + ansible_ssh_private_key_file=~/.ssh/id_rsa + ansible_host_key_checking=False + dns_ak=$DNS_AK + dns_sk=$DNS_SK + ingress_ip=20.48.21.165 + smtp_password=$SMTP_PASSWORD + gitlab_oidc_client_token=$GITLAB_OIDC_CLIENT_TOKEN + EOF + ansible-playbook -i hosts/inventory jobs/init_k3s_cluster -D + ansible-playbook -i hosts/inventory jobs/init_gitlab -D -C + #ansible-playbook -i hosts/inventory jobs/init_ssl_cert -D + #ansible-playbook -i hosts/inventory jobs/init_chatwithgpt -D + #ansible-playbook -i hosts/inventory jobs/init_harbor -D + #ansible-playbook -i hosts/inventory jobs/init_keycloak -D + #ansible-playbook -i hosts/inventory jobs/init_cert_manager -D + #ansible-playbook -i hosts/inventory jobs/init_openldap -D + setup-harbor: + runs-on: ubuntu-latest + needs: [setup-keycloak] + + steps: + - uses: actions/checkout@v3 + + - name: Setup Habor in K3S + shell: bash + run: | + export ANSIBLE_HOST_KEY_CHECKING=False + sudo apt install jq ansible -y + + mkdir -pv ~/.ssh/ + cat > ~/.ssh/id_rsa << EOF + ${SSH_PRIVATE_KEY} + EOF + sudo chmod 0400 ~/.ssh/id_rsa + md5sum ~/.ssh/id_rsa + + mkdir -pv hosts/ + cat > hosts/inventory << EOF + [master] + mirrors.onwalk.net ansible_host=8.130.11.192 + + [all:vars] + ansible_port=22 + ansible_ssh_user=root + ansible_ssh_private_key_file=~/.ssh/id_rsa + ansible_host_key_checking=False + ali_ak=$ALI_AK + ali_sk=$ALI_SK + dns_ak=$DNS_AK + dns_sk=$DNS_SK + ingress_ip=8.130.11.192 + harbor_admin_password=$HARBOR_ADMIN_PASSWORD + harbor_odic_client_token=$HARBOR_OIDC_CLIENT_TOKEN + EOF + ansible-playbook -i hosts/inventory jobs/init_k3s_cluster -D + ansible-playbook -i hosts/inventory jobs/init_harbor -D -C + setup-Grafana: + runs-on: ubuntu-latest + needs: [setup-keycloak] + + steps: + - uses: actions/checkout@v3 + + - name: Setup Habor in K3S + shell: bash + run: | + export ANSIBLE_HOST_KEY_CHECKING=False + sudo apt install jq ansible -y + + mkdir -pv ~/.ssh/ + cat > ~/.ssh/id_rsa << EOF + ${SSH_PRIVATE_KEY} + EOF + sudo chmod 0400 ~/.ssh/id_rsa + md5sum ~/.ssh/id_rsa + + mkdir -pv hosts/ + cat > hosts/inventory << EOF + [master] + gitlab.onwalk.net ansible_host=20.48.21.165 [all:vars] ansible_port=8022 @@ -100,9 +181,9 @@ jobs: ali_sk=$ALI_SK dns_ak=$DNS_AK dns_sk=$DNS_SK - ingress_ip=20.222.214.219 + ingress_ip=20.48.21.165 harbor_admin_password=$HARBOR_ADMIN_PASSWORD harbor_odic_client_token=$HARBOR_OIDC_CLIENT_TOKEN EOF ansible-playbook -i hosts/inventory jobs/init_k3s_cluster -D - ansible-playbook -i hosts/inventory jobs/init_harbor -D + ansible-playbook -i hosts/inventory jobs/init_observability-server -D -C diff --git a/playbook/jobs/init_gitlab b/playbook/jobs/init_gitlab index 18f72552..ad7afb24 100644 --- a/playbook/jobs/init_gitlab +++ b/playbook/jobs/init_gitlab @@ -10,13 +10,13 @@ group: master namespace: gitlab db_namespace: database - domain: apollo-ev.com - auto_issuance: false + domain: onwalk.net + auto_issuance: true update_secret: true tls: - secret_name: gitlab-tls - keyfile: /etc/ssl/apollo-ev.com.key - certfile: /etc/ssl/apollo-ev.com.pem + keyfile: /etc/ssl/onwalk.net.key + certfile: /etc/ssl/onwalk.net.pem gitlab_oidc_client_id: code_oidc - gitlab_oidc_isser: 'https://keycloak.apollo-ev.com/realms/cloud-sso' - gitlab_oidc_redirect_uri: 'https://code.apollo-ev.com/users/auth/openid_connect/callback' + gitlab_oidc_isser: 'https://keycloak.onwalk.net/realms/cloud-sso' + gitlab_oidc_redirect_uri: 'https://gitlab.onwalk.net/users/auth/openid_connect/callback' diff --git a/playbook/roles/gitlab/files/setup.sh b/playbook/roles/gitlab/files/setup.sh index 45b47e0a..e516797b 100644 --- a/playbook/roles/gitlab/files/setup.sh +++ b/playbook/roles/gitlab/files/setup.sh @@ -29,7 +29,7 @@ global: hosts: domain: $domain gitlab: - name: code.$domain + name: gitlab.$domain https: true ingress: class: nginx