Skip to content

Commit 9b028c0

Browse files
committed
add check block of some version
- python - pip - ansible - jupyter
1 parent 8af5a91 commit 9b028c0

File tree

1 file changed

+154
-21
lines changed

1 file changed

+154
-21
lines changed

ipynb/ansible_on_jupyter.ipynb

Lines changed: 154 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"collapsed": true
77
},
88
"source": [
9-
"# Run the Ansible on Jupyter\n",
9+
"# Run the Ansible on Jupyter Notebook\n",
1010
"\n",
1111
"- Author: Chu-Siang Lai / chusiang (at) drx.tw\n",
1212
"- GitHub: [chusiang/ansible-jupyter.dockerfile](https://github.com/chusiang/ansible-jupyter.dockerfile)\n",
@@ -22,7 +22,7 @@
2222
},
2323
{
2424
"cell_type": "code",
25-
"execution_count": 8,
25+
"execution_count": 9,
2626
"metadata": {
2727
"collapsed": false
2828
},
@@ -31,7 +31,7 @@
3131
"name": "stdout",
3232
"output_type": "stream",
3333
"text": [
34-
"Mon Nov 21 11:30:05 UTC 2016\r\n"
34+
"Tue Nov 22 06:49:18 UTC 2016\r\n"
3535
]
3636
}
3737
],
@@ -50,7 +50,7 @@
5050
},
5151
{
5252
"cell_type": "code",
53-
"execution_count": 1,
53+
"execution_count": 2,
5454
"metadata": {
5555
"collapsed": false
5656
},
@@ -76,7 +76,7 @@
7676
},
7777
{
7878
"cell_type": "code",
79-
"execution_count": 2,
79+
"execution_count": 3,
8080
"metadata": {
8181
"collapsed": false
8282
},
@@ -95,6 +95,112 @@
9595
"!cat /etc/issue"
9696
]
9797
},
98+
{
99+
"cell_type": "markdown",
100+
"metadata": {},
101+
"source": [
102+
"Show Python version."
103+
]
104+
},
105+
{
106+
"cell_type": "code",
107+
"execution_count": 5,
108+
"metadata": {
109+
"collapsed": false
110+
},
111+
"outputs": [
112+
{
113+
"name": "stdout",
114+
"output_type": "stream",
115+
"text": [
116+
"Python 2.7.12\r\n"
117+
]
118+
}
119+
],
120+
"source": [
121+
"!python --version"
122+
]
123+
},
124+
{
125+
"cell_type": "markdown",
126+
"metadata": {},
127+
"source": [
128+
"Show pip version."
129+
]
130+
},
131+
{
132+
"cell_type": "code",
133+
"execution_count": 7,
134+
"metadata": {
135+
"collapsed": false
136+
},
137+
"outputs": [
138+
{
139+
"name": "stdout",
140+
"output_type": "stream",
141+
"text": [
142+
"pip 9.0.1 from /usr/lib/python2.7/site-packages (python 2.7)\r\n"
143+
]
144+
}
145+
],
146+
"source": [
147+
"!pip --version"
148+
]
149+
},
150+
{
151+
"cell_type": "markdown",
152+
"metadata": {},
153+
"source": [
154+
"Show Ansible version."
155+
]
156+
},
157+
{
158+
"cell_type": "code",
159+
"execution_count": 6,
160+
"metadata": {
161+
"collapsed": false
162+
},
163+
"outputs": [
164+
{
165+
"name": "stdout",
166+
"output_type": "stream",
167+
"text": [
168+
"ansible 2.2.0.0\r\n",
169+
" config file = \r\n",
170+
" configured module search path = Default w/o overrides\r\n"
171+
]
172+
}
173+
],
174+
"source": [
175+
"!ansible --version"
176+
]
177+
},
178+
{
179+
"cell_type": "markdown",
180+
"metadata": {},
181+
"source": [
182+
"Show Jupyter version."
183+
]
184+
},
185+
{
186+
"cell_type": "code",
187+
"execution_count": 8,
188+
"metadata": {
189+
"collapsed": false
190+
},
191+
"outputs": [
192+
{
193+
"name": "stdout",
194+
"output_type": "stream",
195+
"text": [
196+
"4.2.0\r\n"
197+
]
198+
}
199+
],
200+
"source": [
201+
"!jupyter --version"
202+
]
203+
},
98204
{
99205
"cell_type": "markdown",
100206
"metadata": {},
@@ -646,34 +752,55 @@
646752
"- hosts: localhost\r\n",
647753
"\r\n",
648754
" vars:\r\n",
649-
" os_packages:\r\n",
755+
" some_packages:\r\n",
650756
" - bash\r\n",
651757
" - bash-completion\r\n",
652758
" - ca-certificates\r\n",
653759
" - curl\r\n",
654760
" - git\r\n",
655-
" - openssh-client\r\n",
656761
" - openssl\r\n",
762+
"\r\n",
763+
" apk_packages: \r\n",
764+
" - openssh-client\r\n",
657765
" - vim\r\n",
766+
"\r\n",
767+
" apt_packages: \"{{ apk_packages }}\"\r\n",
768+
"\r\n",
769+
" yum_packages:\r\n",
770+
" - openssh-clients\r\n",
771+
" - vim-minimal\r\n",
658772
" \r\n",
659773
" pip_packages:\r\n",
660774
" - docker-py\r\n",
661775
" - docker-compose\r\n",
662776
" \r\n",
663777
" tasks:\r\n",
664-
" - name: install some apk packages\r\n",
778+
" - name: install some packages\r\n",
779+
" package: name={{ item }} state=latest\r\n",
780+
" with_nested: \"{{ some_packages }}\"\r\n",
781+
" when:\r\n",
782+
" - some_packages is defined\r\n",
783+
"\r\n",
784+
" - name: install apk packages\r\n",
665785
" apk: name={{ item }} state=latest\r\n",
666-
" with_nested: \"{{ os_packages }}\"\r\n",
786+
" with_nested: \"{{ apk_packages }}\"\r\n",
667787
" when:\r\n",
668-
" - os_packages is defined\r\n",
669-
" - ansible_distribution == \"Alpine\"\r\n",
788+
" - apk_packages is defined\r\n",
789+
" - ansible_pkg_mgr == \"apk\"\r\n",
670790
"\r\n",
671-
" - name: install some apt packages\r\n",
791+
" - name: install apt packages\r\n",
672792
" apt: name={{ item }} state=latest\r\n",
673-
" with_nested: \"{{ os_packages }}\"\r\n",
793+
" with_nested: \"{{ apt_packages }}\"\r\n",
794+
" when:\r\n",
795+
" - apt_packages is defined\r\n",
796+
" - ansible_pkg_mgr == \"apt\"\r\n",
797+
"\r\n",
798+
" - name: install yum packages\r\n",
799+
" yum: name={{ item }} state=latest\r\n",
800+
" with_nested: \"{{ yum_packages }}\"\r\n",
674801
" when:\r\n",
675-
" - os_packages is defined\r\n",
676-
" - ansible_distribution == \"Ubuntu\"\r\n",
802+
" - yum_packages is defined\r\n",
803+
" - ansible_pkg_mgr == \"yum\"\r\n",
677804
"\r\n",
678805
" - name: install some pip packages\r\n",
679806
" pip: name={{ item }} state=latest\r\n",
@@ -700,7 +827,7 @@
700827
},
701828
{
702829
"cell_type": "code",
703-
"execution_count": 9,
830+
"execution_count": 11,
704831
"metadata": {
705832
"collapsed": false
706833
},
@@ -715,11 +842,17 @@
715842
"TASK [setup] *******************************************************************\n",
716843
"\u001b[0;32mok: [localhost]\u001b[0m\n",
717844
"\n",
718-
"TASK [install some apk packages] ***********************************************\n",
719-
"\u001b[0;32mok: [localhost] => (item=[u'bash', u'bash-completion', u'ca-certificates', u'curl', u'git', u'openssh-client', u'openssl', u'vim'])\u001b[0m\n",
845+
"TASK [install some packages] ***************************************************\n",
846+
"\u001b[0;32mok: [localhost] => (item=[u'bash', u'bash-completion', u'ca-certificates', u'curl', u'git', u'openssl'])\u001b[0m\n",
847+
"\n",
848+
"TASK [install apk packages] ****************************************************\n",
849+
"\u001b[0;32mok: [localhost] => (item=[u'openssh-client', u'vim'])\u001b[0m\n",
850+
"\n",
851+
"TASK [install apt packages] ****************************************************\n",
852+
"\u001b[0;36mskipping: [localhost] => (item=[u'openssh-client', u'vim']) \u001b[0m\n",
720853
"\n",
721-
"TASK [install some apt packages] ***********************************************\n",
722-
"\u001b[0;36mskipping: [localhost] => (item=[u'bash', u'bash-completion', u'ca-certificates', u'curl', u'git', u'openssh-client', u'openssl', u'vim']) \u001b[0m\n",
854+
"TASK [install yum packages] ****************************************************\n",
855+
"\u001b[0;36mskipping: [localhost] => (item=[u'openssh-clients', u'vim-minimal']) \u001b[0m\n",
723856
"\n",
724857
"TASK [install some pip packages] ***********************************************\n",
725858
"\u001b[0;32mok: [localhost] => (item=[u'docker-py', u'docker-compose'])\u001b[0m\n",
@@ -728,7 +861,7 @@
728861
"\u001b[0;32mok: [localhost]\u001b[0m\n",
729862
"\n",
730863
"PLAY RECAP *********************************************************************\n",
731-
"\u001b[0;32mlocalhost\u001b[0m : \u001b[0;32mok=4 \u001b[0m changed=0 unreachable=0 failed=0 \n",
864+
"\u001b[0;32mlocalhost\u001b[0m : \u001b[0;32mok=5 \u001b[0m changed=0 unreachable=0 failed=0 \n",
732865
"\n"
733866
]
734867
}

0 commit comments

Comments
 (0)