diff --git a/.ansible/deploy-draft.yml b/.ansible/deploy-draft.yml new file mode 100644 index 0000000..442b00a --- /dev/null +++ b/.ansible/deploy-draft.yml @@ -0,0 +1,26 @@ +--- +- hosts: docker + tasks: + - name: deploy draft + docker_container: + name: "bouquins_draft_{{ draft_name }}" + image: "reg.meutel.net/go-bouquins:{{ draft_name }}" + state: started + recreate: yes + labels: + traefik.enable: 'true' + traefik.port: '9000' + traefik.docker.network: 'proxybackend' + traefik.frontend.rule: "Host:{{ draft_name }}.bouquins.www.meutel.net" + traefik.frontend.entryPoints: http + networks: + - name: proxybackend + purge_networks: yes + volumes: + - bouquins_draft:/root/data + register: deploy_out + + - debug: + msg: "{{ deploy_out.container }}" + +# vim:ft=ansible: diff --git a/.ansible/inventory b/.ansible/inventory new file mode 100644 index 0000000..ad8705e --- /dev/null +++ b/.ansible/inventory @@ -0,0 +1,4 @@ +ambrosia ansible_host=148.251.42.122 ansible_python_interpreter=/usr/bin/python3 ansible_user=drone + +[docker] +ambrosia diff --git a/.drone.yml b/.drone.yml index 8491d28..7f11ca7 100644 --- a/.drone.yml +++ b/.drone.yml @@ -25,7 +25,7 @@ steps: commands: - go vet ./... - - name: docker + - name: docker image: plugins/docker settings: registry: reg.meutel.net @@ -39,6 +39,33 @@ steps: event: - tag + - name: docker-branch + image: plugins/docker + settings: + registry: reg.meutel.net + repo: reg.meutel.net/go-bouquins + tags: ${DRONE_BRANCH##feature/} + username: + from_secret: registry_login + password: + from_secret: registry_password + when: + branch: + - feature/* + + - name: deploy-branch + image: plugins/ansible:1 + settings: + playbook: .ansible/deploy-draft.yml + inventory: .ansible/inventory + private_key: + from_secret: drone_ssh_key + extra_vars: + - draft_name=${DRONE_BRANCH##feature/} + when: + branch: + - feature/* + trigger: event: - push @@ -46,6 +73,6 @@ trigger: --- kind: signature -hmac: 0f5318785e361ab48470f37a93f15cb218f6f2a22dbdd2ec2f16298dd7577ada +hmac: 402ef53d245969c2df4d6ec14d51d3d9665856c8fa0ec8248755a209fb66ff36 ...