Skip to content

Commit bd0eb82

Browse files
committed
First stub
Cleanup dockerfile files and templates yaml and plots added ansible.cfg resolution order #10 add facts and variables use tags to split playbooks
1 parent d18a58b commit bd0eb82

61 files changed

Lines changed: 6818 additions & 329 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

ansible-101/.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
.ipynb_checkpoints
22
*.pyc
3-
Untitled*
3+
[Uu]ntitled*
44

55
*.retry
66
core*

ansible-101/Dockerfile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,16 @@ MAINTAINER [email protected]
77

88
RUN apt-get -y update && apt-get -y install gcc make python-dev python-pip
99
RUN apt-get -y update && apt-get -y install build-essential libblas-dev liblapack-dev gfortran libfreetype6-dev libpng-dev
10-
RUN apt-get -y update && apt-get -y install tree
10+
RUN apt-get -y update && apt-get -y install tree sshpass openssl
1111
RUN apt-get -y clean
1212

13+
RUN apt-get -y update && apt-get -y install curl apt-transport-https
14+
RUN curl -fsSL https://download.docker.com/linux/debian/gpg | apt-key add -
15+
RUN echo "deb [arch=amd64] https://download.docker.com/linux/debian jessie stable" >> /etc/apt/sources.list
16+
RUN apt-get -y update && apt-get -y docker-ce
17+
RUN apt-get -y clean
18+
19+
RUN apt-get -y autoremove
1320

1421
RUN pip2 install -U pip
1522

@@ -19,4 +26,9 @@ COPY requirements.txt /requirements.txt
1926
RUN pip2 install -r /requirements.txt
2027
RUN pip install -r /requirements.txt
2128

29+
# Use folding extension
30+
RUN pip install jupyter_contrib_nbextensions
31+
RUN jupyter contrib nbextension install --user
32+
RUN jupyter nbextension enable codefolding/main
33+
2234
ENTRYPOINT /usr/local/bin/jupyter-notebook --ip 0.0.0.0

ansible-101/Dockerfile.ssh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
FROM itscaro/debian-ssh:latest
2+
RUN apt-get -y update && apt-get -y install python
3+
RUN apt-get -y clean
4+
RUN apt-get -y autoremove
5+

ansible-101/Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,7 @@
11
clean:
22
rm *.pyc __pycache__ -fr
3+
4+
dev:
5+
docker-compose scale dev=1 web=2 ansible=1
6+
docker-compose logs dev
7+

ansible-101/README.md

Lines changed: 18 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,29 @@
1-
# Python for System Administrators
1+
# Ansible 2 done right!
22

3-
Browse this course with the [online notebook viewer!](http://nbviewer.jupyter.org/github/ioggstream/python-course/tree/master/python-for-sysadmin/notebooks/)
43

54
## Setup
6-
See README.setup for detailed instruction on:
75

8-
- Linux
9-
- Windows
10-
- Mac OS
6+
This course is based on Docker and Docker compose. As long as you have Docker
7+
you can run it on:
118

12-
If you use docker, just run:
9+
- linux
10+
- mac
11+
- windows
1312

14-
# docker-compose up course
15-
# firefox http://localhost:8888
13+
Docker should be exposed via TCP on 172.17.0.1:2375
14+
15+
Consider having enough bandwidth for the first run to download the images.
16+
17+
18+
Run the environemnt with:
1619

17-
For ansible homework, setup the ssh keys and run:
20+
# make course
21+
22+
or
23+
24+
# docker-compose scale course=1 ansible=1 web=3
25+
# firefox http://localhost:8888
1826

19-
# docker-compose scale course=1 ansible=2
2027

2128
## Playing the course
2229
An easy way to run the course is on Linux with:
@@ -25,8 +32,6 @@ An easy way to run the course is on Linux with:
2532
#nosetests -v # check if everything is ok
2633
#jupyter-notebook notebooks/ # ;)
2734

28-
Each notebook is associated to a python file in scripts/.
29-
3035

3136
## Outline
3237

ansible-101/docker-compose.yml

Lines changed: 52 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,55 @@
11
# Image for developing the course
2-
dev:
3-
build: .
4-
hostname: sysadminpy
5-
environment:
6-
- USE_HTTP=1
7-
- PASSWORD=secret
8-
ports:
9-
- 8888:8888
10-
volumes:
11-
- ./rendered_notebooks:/notebooks
12-
13-
test:
14-
image: ioggstream/python-course
15-
volumes:
16-
- .:/notebooks:z
17-
# entrypoint: tail -f /etc/hosts
2+
version: "2"
3+
services:
4+
dev:
5+
build: .
6+
hostname: sysadminpy
7+
environment:
8+
- USE_HTTP=1
9+
- PASSWORD=secret
10+
ports:
11+
- 8888:8888
12+
volumes:
13+
- ./notebooks:/notebooks:z
14+
network_mode: bridge
15+
entrypoint: /bin/sh
16+
command: -c "/usr/local/bin/jupyter-notebook --ip 0.0.0.0 --allow-root"
1817

18+
19+
test:
20+
image: ioggstream/python-course
21+
volumes:
22+
- ./notebooks:/notebooks:z
23+
# entrypoint: tail -f /etc/hosts
24+
25+
26+
# Official image from docker hub
27+
course:
28+
image: ioggstream/python-course
29+
volumes:
30+
- ./notebooks:/notebooks:z
31+
network_mode: bridge
32+
ports:
33+
- 8888:8888
34+
35+
# Some ssh-enabled docker containers
36+
# for student homework
37+
ansible:
38+
build:
39+
context: .
40+
dockerfile: Dockerfile.ssh
41+
volumes:
42+
- .:/code:z
43+
network_mode: bridge
44+
1945

20-
# Official image from docker hub
21-
course:
22-
image: ioggstream/python-course
23-
volumes:
24-
- .:/notebooks:z
25-
ports:
26-
- 8888:8888
27-
28-
# Some ssh-enabled docker containers
29-
# for student homework
30-
ansible:
31-
image: itscaro/debian-ssh:latest
32-
volumes:
33-
- .:/code:z
34-
46+
# Some ssh-enabled docker containers
47+
# for student homework
48+
web:
49+
build:
50+
context: .
51+
dockerfile: Dockerfile.ssh
52+
volumes:
53+
- .:/code:z
54+
- ./notebooks/exercise-1/id_ecdsa.pub:/root/.ssh/authorized_keys:z
55+
network_mode: bridge

ansible-101/notebooks/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
host_status

0 commit comments

Comments
 (0)