forked from javahometech/dockeransiblejenkins
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy-docker.yml
More file actions
43 lines (39 loc) · 1.32 KB
/
Copy pathdeploy-docker.yml
File metadata and controls
43 lines (39 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
---
- hosts: dev
become: True
tasks:
- name: ensure repository key is installed
apt_key:
url: https://download.docker.com/linux/ubuntu/gpg
state: present
- name: ensure docker registry is available
apt_repository: repo='deb https://download.docker.com/linux/ubuntu bionic stable' state=present
- name: ensure docker and dependencies are installed
apt: name=docker-ce update_cache=yes
# Uncomment the following to enable insecure registries with Docker
#- name: ensure docker can use insecure registries in 10.11.0.0/16
# lineinfile: "dest=/etc/default/docker regexp=^DOCKER_OPTS line=DOCKER_OPTS='--insecure-registry 10.11.0.0/16'"
- service: name=docker state=restarted
- name: Install required system packages
apt:
pkg:
- apt-transport-https
- ca-certificates
- curl
- software-properties-common
- python3-pip
- virtualenv
- python3-setuptools
state: latest
update_cache: true
- name: Install docker-py python module
pip:
name: docker-py
state: present
- name: Start the container
docker_container:
name: myapp
image: "dp0211/myapp:{{DOCKER_TAG}}"
state: started
published_ports:
- 0.0.0.0:8080:8080