-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathipython.yml
executable file
·38 lines (32 loc) · 1.07 KB
/
ipython.yml
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
#!/usr/bin/env ansible-playbook
---
- name: start up a docker container
hosts: localhost
vars:
base_image: ubuntu
docker_hostname: ipython
tasks:
- name: start up a docker container by running bash
local_action: docker image={{ base_image }} name={{ docker_hostname }} detach=yes tty=yes command=bash
- name: add the host
add_host: name={{ docker_hostname }}
- name: configure the ipython container
hosts: ipython
connection: docker
vars:
pre_image: lorin/ipython-base
final_image: lorin/ipython
pre_tasks:
- name: update apt repo (raw)
raw: apt-get update
- name: install python (raw)
raw: apt-get install -y python
roles:
- ipython
post_tasks:
- name: capture the container to a base image
local_action: command docker commit {{ inventory_hostname }} {{ pre_image }}
- name: stop the current running container
local_action: command docker kill {{ inventory_hostname }}
- name: create the final image
local_action: docker_image path=./files name={{ final_image }} state=build