-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhost-setup-playbook.yaml
75 lines (72 loc) · 1.98 KB
/
host-setup-playbook.yaml
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
- name: Setup tendenci host
hosts: tendenci-hosts
tasks:
- name: Install pip
become: yes
package:
name: python-pip
state: latest
- name: Install apt-transport-https
become: yes
package:
name: apt-transport-https
- name: Install software-properties-common
become: yes
package:
name: software-properties-common
- name: Add docker repository key
become: yes
apt_key:
id: 9DC858229FC7DD38854AE2D88D81803C0EBFCD88
url: https://download.docker.com/linux/debian/gpg
- name: Add docker repository
become: yes
apt_repository:
repo: deb [arch=amd64] https://download.docker.com/linux/debian stretch stable
state: present
update_cache: yes
- name: Install docker
become: yes
package:
name: docker-ce
state: latest
- name: Install virtualenv
become: yes
package:
name: virtualenv
- name: Make dockerenv directory
become: yes
file:
path: /var/dockerenv
state: directory
owner: root
group: docker
mode: 0770
- name: Install docker python module in virtualenv
pip:
name: docker
state: present
virtualenv: /var/dockerenv
- name: Install docker-compose in the virtualenv
pip:
name: docker-compose
state: present
virtualenv: /var/dockerenv
- name: Copy docker container source to host
become: yes
copy:
src: ./container
dest: /var/containers/tendenci/
owner: root
group: docker
mode: u=rw,g=rw
- name: Build and run containers
docker_service:
project_src: /var/containers/tendenci/container
build: yes
state: present
vars:
venv_path: /var/dockerenv
ansible_python_interpreter: /var/dockerenv/bin/python
environment:
PATH: '{{ venv_path }}/bin:{{ ansible_env.PATH }}'