M .drone.yml => .drone.yml +58 -1
@@ 2,6 2,11 @@
kind: pipeline
type: docker
name: default
+trigger:
+ event:
+ exclude:
+ - promote
+ - rollback
steps:
- name: client
@@ 64,4 69,56 @@ steps:
target: unstable
depends_on:
- upload_client
- - upload_server>
\ No newline at end of file
+ - upload_server
+
+---
+kind: pipeline
+type: docker
+name: deploy-unstable
+trigger:
+ event:
+ - promote
+ target:
+ - production
+steps:
+ - name: deploy
+ image: danihodovic/ansible
+ environment:
+ VAULT_PWD:
+ from_secret: vault_password
+ commands:
+ - ansible-playbook ansible/deploy.yml -i ansible/environments/unstable.yml --vault-password-file <(echo ${VAULT_PWD})
+---
+kind: pipeline
+type: docker
+name: deploy-beta
+trigger:
+ event:
+ - promote
+ target:
+ - beta
+steps:
+ - name: deploy
+ image: danihodovic/ansible
+ environment:
+ VAULT_PWD:
+ from_secret: vault_password
+ commands:
+ - ansible-playbook ansible/deploy.yml -i ansible/environments/beta.yml --vault-password-file <(echo ${VAULT_PWD})
+---
+kind: pipeline
+type: docker
+name: deploy-stable
+trigger:
+ event:
+ - promote
+ target:
+ - beta
+steps:
+ - name: deploy
+ image: danihodovic/ansible
+ environment:
+ VAULT_PWD:
+ from_secret: vault_password
+ commands:
+ - ansible-playbook ansible/deploy.yml -i ansible/environments/stable.yml --vault-password-file <(echo ${VAULT_PWD})<
\ No newline at end of file
A ansible/deploy.yml => ansible/deploy.yml +27 -0
@@ 0,0 1,27 @@
+- name: Deploy servers
+ hosts: gameservers
+ tasks:
+ - name: Ensure host connectivity
+ ansible.builtin.ping:
+ - name: Stop game server
+ ansible.builtin.shell:
+ cmd: sv stop starkingdoms
+ sudo: yes
+ - name: Download new game server file
+ ansible.builtin.get_url:
+ url: {{ server_binary_url }}
+ dest: /opt/starkingdoms/starkingdoms-server
+ mode: '0777'
+ - name: Remove old client assets
+ ansible.builtin.shell:
+ cmd: rm -rf assets
+ chdir: /opt/starkingdoms/client/
+ - name: Download and unpack client package
+ ansible.builtin.unarchive:
+ src: {{ client_package_url }}
+ dest: /opt/starkingdoms/client/
+ remote_src: yes
+ - name: Start game server
+ ansible.builtin.shell:
+ cmd: sv start starkingdoms
+ sudo: yes<
\ No newline at end of file
A ansible/environments/beta.yml => ansible/environments/beta.yml +7 -0
@@ 0,0 1,7 @@
+gameservers:
+ hosts:
+ srv01.beta.envs.starkingdoms.io:
+ ansible_port: 20451
+ ansible_password: TODO_PUT_THIS_HERE
+ vars:
+ ansible_user: stk<
\ No newline at end of file
A ansible/environments/stable.yml => ansible/environments/stable.yml +7 -0
@@ 0,0 1,7 @@
+gameservers:
+ hosts:
+ srv01.stable.envs.starkingdoms.io:
+ ansible_port: 20450
+ ansible_password: TODO_PUT_THIS_HERE
+ vars:
+ ansible_user: stk<
\ No newline at end of file
A ansible/environments/unstable.yml => ansible/environments/unstable.yml +14 -0
@@ 0,0 1,14 @@
+gameservers:
+ hosts:
+ srv01.unstable.envs.starkingdoms.io:
+ ansible_port: 20452
+ ansible_password: !vault |
+ $ANSIBLE_VAULT;1.1;AES256
+ 62613139386531666161396438613834363735633531663738663262346162303031613763346637
+ 3663313932393738303766376239383933306637336566330a663061303263316134346434323830
+ 66633239613039646431303634303965316531333063323537373039316635316238343539653137
+ 6463653339343439650a373138333165393838626437366466636134326664653832356631646436
+ 63373364303430633031643237303235346463626233346664353531383063663430383964306266
+ 6631393765336366316239326466396563386565646334376438
+ vars:
+ ansible_user: stk<
\ No newline at end of file