From ab034f4844e5e780481d239c049e8b545abe0053 Mon Sep 17 00:00:00 2001 From: Haitao Pan Date: Wed, 24 May 2023 11:34:09 +0800 Subject: [PATCH] add setup-observability-server-with-existed-vhost.yml --- .../setup-k3s-with-existed-vhost.yml | 32 ++----------- ...bservability-server-with-existed-vhost.yml | 47 +++++++++++++++++++ 2 files changed, 51 insertions(+), 28 deletions(-) create mode 100644 .github/workflows/setup-observability-server-with-existed-vhost.yml diff --git a/.github/workflows/setup-k3s-with-existed-vhost.yml b/.github/workflows/setup-k3s-with-existed-vhost.yml index 8077156f..78ad0134 100644 --- a/.github/workflows/setup-k3s-with-existed-vhost.yml +++ b/.github/workflows/setup-k3s-with-existed-vhost.yml @@ -92,14 +92,8 @@ jobs: 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 admin_password=$ADMIN_INIT_PASSWORD EOF - ansible-playbook -i hosts/inventory jobs/init_k3s_cluster -D ansible-playbook -i hosts/inventory jobs/init_keycloak -D Setup-Gitlab: runs-on: ubuntu-latest @@ -133,9 +127,6 @@ jobs: 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=35.189.147.79 smtp_password=$SMTP_PASSWORD gitlab_oidc_client_token=$GITLAB_OIDC_CLIENT_TOKEN EOF @@ -174,9 +165,6 @@ jobs: 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=$ADMIN_INIT_PASSWORD harbor_odic_client_token=$HARBOR_OIDC_CLIENT_TOKEN EOF @@ -213,11 +201,6 @@ jobs: 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=35.189.147.79 EOF ansible-playbook -i hosts/inventory jobs/init_chatwithgpt -D Setup-Grafana: @@ -252,11 +235,6 @@ jobs: 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=35.189.147.79 EOF ansible-playbook -i hosts/inventory jobs/init_observability-server -D Setup-Agent: @@ -287,18 +265,16 @@ jobs: mkdir -pv hosts/ cat > hosts/inventory << EOF [master] - k3s ansible_host=35.189.147.79 + k3s ansible_host=34.92.220.27 [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=35.189.147.79 + ingress_ip=34.92.220.27 EOF ansible-playbook -i hosts/inventory jobs/init_log_agent -D -C ansible-playbook -i hosts/inventory jobs/init_metric_agent -D -C @@ -326,7 +302,7 @@ jobs: mkdir -pv hosts/ cat > hosts/inventory << EOF [master] - k3s ansible_host=35.189.147.79 + k3s ansible_host=34.92.220.27 [all:vars] ansible_port=8022 @@ -361,7 +337,7 @@ jobs: mkdir -pv hosts/ cat > hosts/inventory << EOF [master] - k3s ansible_host=35.189.147.79 + k3s ansible_host=34.92.220.27 [all:vars] ansible_port=8022 diff --git a/.github/workflows/setup-observability-server-with-existed-vhost.yml b/.github/workflows/setup-observability-server-with-existed-vhost.yml new file mode 100644 index 00000000..55a32305 --- /dev/null +++ b/.github/workflows/setup-observability-server-with-existed-vhost.yml @@ -0,0 +1,47 @@ +name: setup observability-server with existed vhost + +on: + workflow_dispatch: + branches: [ 'main' ] + +env: + DNS_AK: ${{ secrets.DNS_AK }} + DNS_SK: ${{ secrets.DNS_SK }} + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + +defaults: + run: + working-directory: ./playbook + +jobs: + setup-observability-server: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: run playbook + 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] + k3s ansible_host=34.85.43.134 + + [all:vars] + ansible_port=22 + ansible_ssh_user=root + ansible_ssh_private_key_file=~/.ssh/id_rsa + ansible_host_key_checking=False + EOF + ansible-playbook -i hosts/inventory jobs/init_observability-server -D