- 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"
    force: no
    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"