Skip to content

Commit

Permalink
Add playbook for compose
Browse files Browse the repository at this point in the history
  • Loading branch information
aktech committed May 27, 2020
1 parent 93c3b75 commit 76ae708
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 2 deletions.
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1 +1,15 @@
# Ansible Tutorial


## Running the app

To run the app install `docker` and `docker-compose`. Build and run the
app with following commands:

```bash
docker-compose build
```

```bash
docker-compose up
```
7 changes: 7 additions & 0 deletions deployment/compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- hosts: do
tasks:
- name: Create and start services
docker_compose:
project_src: /root/ansible-django-do-tutorial
register: output
4 changes: 2 additions & 2 deletions deployment/digital_ocean_droplet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@

tasks:
- openssh_keypair:
path: /tmp/id_ssh_rsa
path: /root/.ssh/id_rsa

- name: "Create ssh key"
digital_ocean_sshkey:
name: "ansible-tutorial-ssh-key"
ssh_pub_key: "{{ lookup('file', '/tmp/id_ssh_rsa.pub') }}"
ssh_pub_key: "{{ lookup('file', '/root/.ssh/id_rsa.pub') }}"
state: present
register: docker_ssh_key

Expand Down
1 change: 1 addition & 0 deletions deployment/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
- import_playbook: digital_ocean_droplet.yml
- import_playbook: docker.yml
- import_playbook: repository.yml
- import_playbook: compose.yml
5 changes: 5 additions & 0 deletions deployment/repository.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,8 @@
git:
repo: 'https://github.com/Quansight/ansible-django-do-tutorial.git'
dest: /root/ansible-django-do-tutorial

- name: Copy environment variables (.env) files to repository
copy:
src: /app/.env
dest: /root/ansible-django-do-tutorial/.env

0 comments on commit 76ae708

Please sign in to comment.