-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from indigo-dc/devel
Implement some improvements
- Loading branch information
Showing
3 changed files
with
35 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,8 @@ | ||
--- | ||
# defaults file for ansible-role-docker_run | ||
appname: ubuntu | ||
image: ubuntu | ||
tag: latest | ||
ports: "80" | ||
command: "" | ||
docker_run_appname: ubuntu | ||
docker_run_image: ubuntu | ||
docker_run_tag: latest | ||
docker_run_env_variables: [] | ||
docker_run_ports: [] | ||
docker_run_command: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,32 @@ | ||
--- | ||
|
||
# - name: Install pip | ||
# apt: | ||
# name: python-pip | ||
# state: present | ||
# | ||
# - name: Install docker | ||
# pip: | ||
# name: docker | ||
# | ||
# - name: Ensure docker service is enabled | ||
# service: | ||
# name: docker | ||
# state: started | ||
# enabled: yes | ||
# | ||
- name: "create directory path to store the configuration files" | ||
file: | ||
path: "/opt/{{ appname }}" | ||
path: "/opt/{{ docker_run_appname }}" | ||
state: directory | ||
mode: 0755 | ||
|
||
- name: Touch the configuration file | ||
file: | ||
path: /opt/{{ appname }}/.env | ||
path: /opt/{{ docker_run_appname }}/.env | ||
state: touch | ||
mode: u=rw,g=r,o=r | ||
|
||
- name: debug | ||
debug: | ||
var: environment_variables | ||
|
||
- name: Set environment variables | ||
lineinfile: | ||
path: /opt/{{ appname }}/.env | ||
path: /opt/{{ docker_run_appname }}/.env | ||
line: "{{ item.key }}={{ item.value }}" | ||
create: yes | ||
with_dict: "{{ environment_variables }}" | ||
with_dict: "{{ docker_run_env_variables }}" | ||
|
||
|
||
- name: Running the container | ||
docker_container: | ||
name: "{{ appname }}" | ||
image: "{{ image }}:{{ tag }}" | ||
env_file: /opt/{{ appname }}/.env | ||
command: "{{ command }}" | ||
ports: | ||
- "{{ ports }}" | ||
name: "{{ docker_run_appname }}" | ||
image: "{{ docker_run_image }}:{{ docker_run_tag }}" | ||
env_file: /opt/{{ docker_run_appname }}/.env | ||
command: "{{ docker_run_command }}" | ||
ports: "{{ docker_run_ports }}" | ||
detach: True | ||
state: started |