added role for "drone" CI/CD

This commit is contained in:
2023-02-02 17:11:37 +01:00
parent 52e4730510
commit 18297f5d16
7 changed files with 78 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
- name: drone | create app | generate shared secret
command: openssl rand -hex 16
register: DRONE_RPC_SECRET
- name: drone | create app | create docker dir
file:
path: "/opt/docker/drone"
state: directory
- name: drone | create app | create docker-compose.yml
template:
src: "docker-compose.yml.j2"
dest: "/opt/docker/drone/docker-compose.yml"
validate: "docker-compose -f %s config" # not required. The validation command to run before copying into place. The path to the file to validate is passed in via '%s' which must be present as in the examples below. The command is passed securely so shell features like expansion and pipes will not work.
- name: drone | create app | start docker container
command:
cmd: "docker-compose up -d"
chdir: "/opt/docker/drone"

View File

@@ -0,0 +1,11 @@
# Load distro-specific variables
- include_vars: "{{ ansible_distribution | lower }}.yml"
tags: always
- block:
- include_role: name=docker
- include_tasks: create_app.yml
rescue:
- set_fact: task_failed=true