diff --git a/awx/uptime_app.yaml b/awx/uptime_app.yaml index e03465c..120f525 100644 --- a/awx/uptime_app.yaml +++ b/awx/uptime_app.yaml @@ -43,9 +43,9 @@ set -x export whoami - gcloud compute addresses describe {{ static_ip_name }} - --region={{ gcp_region }} - --project={{ gcp_project }} + gcloud compute addresses describe {{ static_ip_name }} \ + --region={{ gcp_region }} \ + --project={{ gcp_project }} register: ip_check failed_when: false changed_when: false @@ -54,10 +54,10 @@ ansible.builtin.shell: executable: /bin/bash cmd: | - gcloud compute addresses create {{ static_ip_name }} - --region={{ gcp_region }} - --project={{ gcp_project }} - --description="Static IP for Uptime Kuma" + gcloud compute addresses create {{ static_ip_name }} \ + --region={{ gcp_region }} \ + --project={{ gcp_project }} \ + --description="Static IP for Uptime Kuma" when: ip_check.rc != 0 # ------------------------------------------------------------- @@ -67,8 +67,8 @@ ansible.builtin.shell: executable: /bin/bash cmd: | - gcloud compute firewall-rules describe {{ firewall_rule_name }} - --project={{ gcp_project }} + gcloud compute firewall-rules describe {{ firewall_rule_name }} \ + --project={{ gcp_project }} register: fw_check failed_when: false changed_when: false @@ -77,12 +77,12 @@ ansible.builtin.shell: executable: /bin/bash cmd: | - gcloud compute firewall-rules create {{ firewall_rule_name }} - --project={{ gcp_project }} - --allow=tcp:3001 - --target-tags=uptime-kuma - --source-ranges=0.0.0.0/0 - --description="Allow traffic to Uptime Kuma UI & API" + gcloud compute firewall-rules create {{ firewall_rule_name }} \ + --project={{ gcp_project }} \ + --allow=tcp:3001 \ + --target-tags=uptime-kuma \ + --source-ranges=0.0.0.0/0 \ + --description="Allow traffic to Uptime Kuma UI & API" when: fw_check.rc != 0 # ------------------------------------------------------------- @@ -92,9 +92,9 @@ ansible.builtin.shell: executable: /bin/bash cmd: | - gcloud compute instances describe {{ instance_name }} - --zone={{ gcp_zone }} - --project={{ gcp_project }} + gcloud compute instances describe {{ instance_name }} \ + --zone={{ gcp_zone }} \ + --project={{ gcp_project }} register: instance_check failed_when: false changed_when: false @@ -103,15 +103,15 @@ ansible.builtin.shell: executable: /bin/bash cmd: | - gcloud compute instances create-with-container {{ instance_name }} - --project={{ gcp_project }} - --zone={{ gcp_zone }} - --machine-type={{ machine_type }} - --tags=uptime-kuma - --address={{ static_ip_name }} - --boot-disk-size=20GB - --container-image=louislam/uptime-kuma:1 - --container-mount-host-path=host-path=/var/uptime-kuma,mount-path=/app/data,mode=rw + gcloud compute instances create-with-container {{ instance_name }} \ + --project={{ gcp_project }} \ + --zone={{ gcp_zone }} \ + --machine-type={{ machine_type }} \ + --tags=uptime-kuma \ + --address={{ static_ip_name }} \ + --boot-disk-size=20GB \ + --container-image=louislam/uptime-kuma:1 \ + --container-mount-host-path=host-path=/var/uptime-kuma,mount-path=/app/data,mode=rw when: instance_check.rc != 0 # ------------------------------------------------------------- @@ -120,10 +120,10 @@ - name: Fetch instance public IP address ansible.builtin.shell: cmd: | - gcloud compute instances describe {{ instance_name }} - --zone={{ gcp_zone }} - --project={{ gcp_project }} - --format="value(networkInterfaces[0].accessConfigs[0].natIP)" + gcloud compute instances describe {{ instance_name }} \ + --zone={{ gcp_zone }} \ + --project={{ gcp_project }} \ + --format="value(networkInterfaces[0].accessConfigs[0].natIP)" executable: /bin/bash register: vm_ip changed_when: false