Skip to content

Commit da7faae

Browse files
committed
setup the ansible environment with playbook
1 parent cdcfdf8 commit da7faae

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

ansible.cfg

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[defaults]
2+
3+
hostfile = inventory
4+
remote_user = docker
5+
private_key_file = ~/.ssh/id_rsa
6+
host_key_checking = False
7+
retry_files_save_path = ./ansible-retry

inventory

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
#debian-8.local ansible_ssh_host=192.168.1.102 ansible_ssh_port=32788

setup_jupyter.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@
5050
pip_packages:
5151
- docker-py
5252
- docker-compose
53+
54+
ssh_private_key_url: "https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/files/ssh/id_rsa"
55+
ansible_cfg_url: "https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/ansible.cfg"
56+
inventory_url: "https://raw.githubusercontent.com/chusiang/ansible-jupyter.dockerfile/master/inventory"
5357

5458
tasks:
5559
# General Linux.
@@ -125,4 +129,22 @@
125129
- name: install the jupyter notebook
126130
pip: name=jupyter version=1.0.0 state=present
127131

132+
# Create `ssh_config` directory.
133+
- name: create `/root/.ssh` directory
134+
file: path=/root/.ssh state=directory mode=0700
135+
136+
# Get the ssh private key.
137+
- name: get the ssh private key
138+
get_url: >
139+
url={{ ssh_private_key_url }} dest=/root/.ssh/id_rsa mode=0600
140+
checksum=md5:6cc26e77bf23a9d72a51b22387bea61f
141+
142+
# Get the ansible.cfg.
143+
- name: get the ansible.cfg file
144+
get_url: url={{ ansible_cfg_url }} dest=/home/ mode=0644
145+
146+
# Get the inventory file.
147+
- name: get the inventory file
148+
get_url: url={{ inventory_url }} dest=/home/ mode=0644
149+
128150
# vim:ft=ansible :

0 commit comments

Comments
 (0)