Skip to content

Commit

Permalink
Adds Redis Docker container
Browse files Browse the repository at this point in the history
  • Loading branch information
APengue1 committed Jul 6, 2018
1 parent 8fe228d commit 910928a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 4 deletions.
4 changes: 0 additions & 4 deletions roles/docker_containers/tasks/containers/postgres.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,6 @@
shell: docker network ls
register: docker_network_ls

- name: Check for Containers
shell: docker container ls
register: docker_container_ls

- name: Create Docker Network
shell: docker network create postgres
when: docker_network_ls.stdout is search('postgres') == False
Expand Down
11 changes: 11 additions & 0 deletions roles/docker_containers/tasks/containers/redis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
- name: Create Redis Container
shell: docker run --name redis -p 6379:6379 -d redis
when: docker_container_ls.stdout is search('redis') == False

- name: Create redis-cli bash alias
lineinfile:
path: ~/.bash_aliases
create: yes
line: alias redis-cli="docker run -it --link redis:redis --rm redis redis-cli -h redis -p 6379"
state: present
5 changes: 5 additions & 0 deletions roles/docker_containers/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,7 @@
---
- name: Check for Containers
shell: docker container ls
register: docker_container_ls

- include: containers/postgres.yml
- include: containers/redis.yml

0 comments on commit 910928a

Please sign in to comment.