AKAI TSUKI

System development or Technical something

Let's check config.yml for installation using ansible.

when we install OpenShift, we will use config.yml file .

https://docs.openshift.org/latest/install_config/install/advanced_install.html#running-the-advanced-installation

~/openshift-ansible/playbooks/byo/config.yml

open openshift-ansible/playbooks/byo/config.yml

[root@centos01 ~]# cat openshift-ansible/playbooks/byo/config.yml
---
- include: openshift-cluster/config.yml
[root@centos01 ~]#

Next check “openshift-ansible/playbooks/byo/openshift-cluster/config.yml”.

open openshift-ansible/playbooks/byo/openshift-cluster/config.yml

github.com

  tasks:
  - include_vars: ../../byo/openshift-cluster/cluster_hosts.yml
  - add_host:
      name: "{{ item }}"
      groups: l_oo_all_hosts
    with_items: "{{ g_all_hosts | default([]) }}"
    changed_when: no

What is add_host task?

to be continued…

Let's check Advanced Installation of OpenShift origin.

check below page.

https://docs.openshift.org/latest/install_config/install/advanced_install.html#single-master

create hosts file

Host Name Infrastructure Component to Install
centos01 Master and node
centos01 etcd
centos02 Node
centos03 Node
[root@centos01 ~]# cat hosts
[OSEv3:children]
masters
nodes

[OSEv3:vars]
ansible_ssh_user=root
deployment_type=origin

[masters]
centos01

[etcd]
centos01

[nodes]
centos01 openshift_node_labels="{'region': 'infra',   'zone': 'default'}"
centos02 openshift_node_labels="{'region': 'primary', 'zone': 'east'}"
centos03 openshift_node_labels="{'region': 'primary', 'zone': 'west'}"

[root@centos01 ~]#

install Open vSwitch on CentOS 7

Add rpm repository

I get rpm from below page to add rdo repository.

f:id:akai_tsuki:20170327001656p:plain

I perform this command

[root@kvmtest ~]# yum localinstall https://repos.fedorapeople.org/repos/openstack/openstack-ocata/rdo-release-ocata-2.noarch.rpm

Install OVS

[root@kvmtest ~]# yum install openvswitch
Loaded plugins: fastestmirror
openstack-ocata                                                             | 2.9 kB  00:00:00
rdo-qemu-ev                                                                 | 2.9 kB  00:00:00
(1/2): rdo-qemu-ev/x86_64/primary_db                                        |  55 kB  00:00:00
(2/2): openstack-ocata/x86_64/primary_db                                    | 620 kB  00:00:02
Loading mirror speeds from cached hostfile
 * base: ftp.riken.jp
 * extras: ftp.riken.jp
 * updates: ftp.riken.jp
Resolving Dependencies
--> Running transaction check
---> Package openvswitch.x86_64 1:2.6.1-4.1.git20161206.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================
 Package            Arch          Version                             Repository              Size
===================================================================================================
Installing:
 openvswitch        x86_64        1:2.6.1-4.1.git20161206.el7         openstack-ocata        4.9 M

Transaction Summary
===================================================================================================
Install  1 Package

Total download size: 4.9 M
Installed size: 20 M
Is this ok [y/d/N]: y
Downloading packages:
warning: /var/cache/yum/x86_64/7/openstack-ocata/packages/openvswitch-2.6.1-4.1.git20161206.el7.x86_64.rpm: Header V4 RSA/SHA1 Signature, key ID 764429e6: NOKEY
Public key for openvswitch-2.6.1-4.1.git20161206.el7.x86_64.rpm is not installed
openvswitch-2.6.1-4.1.git20161206.el7.x86_64.rpm                            | 4.9 MB  00:00:45
Retrieving key from file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud
Importing GPG key 0x764429E6:
 Userid     : "CentOS Cloud SIG (http://wiki.centos.org/SpecialInterestGroup/Cloud) <security@centos.org>"
 Fingerprint: 736a f511 6d9c 40e2 af6b 074b f9b9 fee7 7644 29e6
 Package    : rdo-release-ocata-2.noarch (installed)
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-Cloud
Is this ok [y/N]: y
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:openvswitch-2.6.1-4.1.git20161206.el7.x86_64                                  1/1
  Verifying  : 1:openvswitch-2.6.1-4.1.git20161206.el7.x86_64                                  1/1

Installed:
  openvswitch.x86_64 1:2.6.1-4.1.git20161206.el7

Complete!
[root@kvmtest ~]# 

Start OVS

[root@kvmtest ~]# systemctl start openvswitch
[root@kvmtest ~]# systemctl status openvswitch
● openvswitch.service - Open vSwitch
   Loaded: loaded (/usr/lib/systemd/system/openvswitch.service; disabled; vendor preset: disabled)
   Active: active (exited) since Mon 2017-03-27 00:29:45 JST; 6s ago
  Process: 21630 ExecStart=/bin/true (code=exited, status=0/SUCCESS)
 Main PID: 21630 (code=exited, status=0/SUCCESS)

Mar 27 00:29:45 kvmtest systemd[1]: Starting Open vSwitch...
Mar 27 00:29:45 kvmtest systemd[1]: Started Open vSwitch.
[root@kvmtest ~]# ovs-vsctl show
bbf32677-0b6c-46f4-8734-e8705c5cbe80
    ovs_version: "2.6.1"
[root@kvmtest ~]#

Upgrade Docker from 1.13.0 to 1.13.1 on CentOS 7

Command List

$ docker version
$ yum makecache fast
$ sudo yum -y upgrade docker-engine

$ docker version

Detail

upgrade docker

[vagrant@localhost ~]$ docker version
Client:
 Version:      1.13.0
 API version:  1.25
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:55:28 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.0
 API version:  1.25 (minimum version 1.12)
 Go version:   go1.7.3
 Git commit:   49bf474
 Built:        Tue Jan 17 09:55:28 2017
 OS/Arch:      linux/amd64
 Experimental: false
[vagrant@localhost ~]$ yum makecache fast
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base                                                                        | 3.6 kB  00:00:00
docker-main                                                                 | 2.9 kB  00:00:00
epel/x86_64/metalink                                                        | 5.5 kB  00:00:00
epel                                                                        | 4.3 kB  00:00:00
extras                                                                      | 3.4 kB  00:00:00
puppetlabs-pc1                                                              | 2.5 kB  00:00:00
updates                                                                     | 3.4 kB  00:00:00
(1/5): epel/x86_64/updateinfo                                               | 738 kB  00:00:00
(2/5): docker-main/primary_db                                               |  29 kB  00:00:00
(3/5): updates/7/x86_64/primary_db                                          | 2.2 MB  00:00:00
(4/5): epel/x86_64/primary_db                                               | 4.5 MB  00:00:01
(5/5): puppetlabs-pc1/x86_64/primary_db                                     | 101 kB  00:00:01
Determining fastest mirrors
 * base: ftp.iij.ad.jp
 * epel: ftp.riken.jp
 * extras: ftp.iij.ad.jp
 * updates: ftp.iij.ad.jp
Metadata Cache Created
[vagrant@localhost ~]$ sudo yum -y upgrade docker-engine
Loaded plugins: fastestmirror
Repodata is over 2 weeks old. Install yum-cron? Or run: yum makecache fast
base                                                                        | 3.6 kB  00:00:00
docker-main                                                                 | 2.9 kB  00:00:00
epel/x86_64/metalink                                                        | 5.5 kB  00:00:00
epel                                                                        | 4.3 kB  00:00:00
extras                                                                      | 3.4 kB  00:00:00
puppetlabs-pc1                                                              | 2.5 kB  00:00:00
updates                                                                     | 3.4 kB  00:00:00
(1/5): epel/x86_64/updateinfo                                               | 738 kB  00:00:00
(2/5): docker-main/primary_db                                               |  29 kB  00:00:00
(3/5): updates/7/x86_64/primary_db                                          | 2.2 MB  00:00:00
(4/5): epel/x86_64/primary_db                                               | 4.5 MB  00:00:01
(5/5): puppetlabs-pc1/x86_64/primary_db                                     | 101 kB  00:00:05
Determining fastest mirrors
 * base: www.ftp.ne.jp
 * epel: ftp.riken.jp
 * extras: www.ftp.ne.jp
 * updates: www.ftp.ne.jp
Resolving Dependencies
--> Running transaction check
---> Package docker-engine.x86_64 0:1.13.0-1.el7.centos will be updated
---> Package docker-engine.x86_64 0:1.13.1-1.el7.centos will be an update
--> Processing Dependency: docker-engine-selinux >= 1.13.1-1.el7.centos for package: docker-engine-1.13.1-1.el7.centos.x86_64
--> Running transaction check
---> Package docker-engine-selinux.noarch 0:1.13.0-1.el7.centos will be updated
---> Package docker-engine-selinux.noarch 0:1.13.1-1.el7.centos will be an update
--> Finished Dependency Resolution

Dependencies Resolved

===================================================================================================
 Package                      Arch          Version                       Repository          Size
===================================================================================================
Updating:
 docker-engine                x86_64        1.13.1-1.el7.centos           docker-main         19 M
Updating for dependencies:
 docker-engine-selinux        noarch        1.13.1-1.el7.centos           docker-main         28 k

Transaction Summary
===================================================================================================
Upgrade  1 Package (+1 Dependent package)

Total download size: 19 M
Downloading packages:
Delta RPMs disabled because /usr/bin/applydeltarpm not installed.
(1/2): docker-engine-selinux-1.13.1-1.el7.centos.noarch.rpm                 |  28 kB  00:00:03
(2/2): docker-engine-1.13.1-1.el7.centos.x86_64.rpm                         |  19 MB  00:00:18
---------------------------------------------------------------------------------------------------
Total                                                              1.0 MB/s |  19 MB  00:00:18
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Updating   : docker-engine-selinux-1.13.1-1.el7.centos.noarch                                1/4
  Updating   : docker-engine-1.13.1-1.el7.centos.x86_64                                        2/4
  Cleanup    : docker-engine-1.13.0-1.el7.centos.x86_64                                        3/4
  Cleanup    : docker-engine-selinux-1.13.0-1.el7.centos.noarch                                4/4
  Verifying  : docker-engine-selinux-1.13.1-1.el7.centos.noarch                                1/4
  Verifying  : docker-engine-1.13.1-1.el7.centos.x86_64                                        2/4
  Verifying  : docker-engine-selinux-1.13.0-1.el7.centos.noarch                                3/4
  Verifying  : docker-engine-1.13.0-1.el7.centos.x86_64                                        4/4

Updated:
  docker-engine.x86_64 0:1.13.1-1.el7.centos

Dependency Updated:
  docker-engine-selinux.noarch 0:1.13.1-1.el7.centos

Complete!
[vagrant@localhost ~]$

after that, confirm version.

[vagrant@localhost ~]$ docker version
Client:
 Version:      1.13.1
 API version:  1.26
 Go version:   go1.7.5
 Git commit:   092cba3
 Built:        Wed Feb  8 06:38:28 2017
 OS/Arch:      linux/amd64

Server:
 Version:      1.13.1
 API version:  1.26 (minimum version 1.12)
 Go version:   go1.7.5
 Git commit:   092cba3
 Built:        Wed Feb  8 06:38:28 2017
 OS/Arch:      linux/amd64
 Experimental: false
[vagrant@localhost ~]$

Create a Vagrant Base Box from a VM.

Command list

>vagrant status
>vagrant halt
>vagrant status
>vagrant package --output centos7test.box

>vagrant box list
>vagrant box add centos7test centos7test.box
>vagrant box list

Detail

from vagrant help

e:\VM\centos01>vagrant package --help
Usage: vagrant package [options] [name|id]

Options:

        --base NAME                  Name of a VM in virtualbox to package as a base box
        --output NAME                Name of the file to output
        --include FILE...            Additional files to package with the box
        --vagrantfile FILE           Vagrantfile to package with the box
    -h, --help                       Print this help

e:\VM\centos01>

create a box file from an exisiting vm.

e:\VM\centos01>vagrant status
Current machine states:

default                   running (virtualbox)

The VM is running. To stop this VM, you can run `vagrant halt` to
shut it down forcefully, or you can run `vagrant suspend` to simply
suspend the virtual machine. In either case, to restart it again,
simply run `vagrant up`.

e:\VM\centos01>vagrant halt
==> default: Attempting graceful shutdown of VM...

e:\VM\centos01>vagrant status
Current machine states:

default                   poweroff (virtualbox)

The VM is powered off. To restart the VM, simply run `vagrant up`

e:\VM\centos01>
e:\VM\centos01>vagrant package --output centos7test.box
==> default: Clearing any previously set forwarded ports...
==> default: Exporting VM...
==> default: Compressing package to: e:/VM/centos01/centos7test.box

e:\VM\centos01>

add this new box file into Vagrant.

e:\VM\centos01>vagrant box list
base              (virtualbox, 0)
bento/centos-5.11 (virtualbox, 2.2.9)
centos/7          (virtualbox, 1509.01)
centos6.5         (virtualbox, 0)
centos7           (virtualbox, 0)
centos7.2         (virtualbox, 0)
mysql5.6_base     (virtualbox, 0)

e:\VM\centos01>vagrant box add centos7test centos7test.box
==> box: Box file was not detected as metadata. Adding it directly...
==> box: Adding box 'centos7test' (v0) for provider:
    box: Unpacking necessary files from: file://e:/VM/centos01/centos7test.box
    box: Progress: 100% (Rate: 466M/s, Estimated time remaining: --:--:--)
==> box: Successfully added box 'centos7test' (v0) for 'virtualbox'!

e:\VM\centos01>vagrant box list
base              (virtualbox, 0)
bento/centos-5.11 (virtualbox, 2.2.9)
centos/7          (virtualbox, 1509.01)
centos6.5         (virtualbox, 0)
centos7           (virtualbox, 0)
centos7.2         (virtualbox, 0)
centos7test       (virtualbox, 0)
mysql5.6_base     (virtualbox, 0)

e:\VM\centos01>

install bash_kernel for jupyter notebook.

After installation of jupyter notebook,
I install bash kernel to jupyter notebook.

GitHub - takluyver/bash_kernel: A bash kernel for IPython

Command list

  • install bash_kernel
# pip3.5 install bash_kernel
# python3 -m bash_kernel.install
  • start jupyter notebook.
# jupyter notebook --config=.jupyter/jupyter_notebook_config.py

Detail

[root@479c57f04b63 ~]# pip3.5 install bash_kernel
Collecting bash_kernel
  Downloading bash_kernel-0.6-py2.py3-none-any.whl
Requirement already satisfied: pexpect>=4.0 in /usr/lib/python3.5/site-packages (from bash_kernel)
Requirement already satisfied: ptyprocess>=0.5 in /usr/lib/python3.5/site-packages (from pexpect>=4.0->bash_kernel)
Installing collected packages: bash-kernel
Successfully installed bash-kernel-0.6
[root@479c57f04b63 ~]# python3 -m bash_kernel.install
Installing IPython kernel spec
[root@479c57f04b63 ~]#
[root@479c57f04b63 notebook]# jupyter notebook --config=.jupyter/jupyter_notebook_config.py
[W 09:41:44.929 NotebookApp] WARNING: The notebook server is listening on all IP addresses and not using encryption. This is not recommended.
[I 09:41:44.933 NotebookApp] Serving notebooks from local directory: /root/notebook
[I 09:41:44.933 NotebookApp] 0 active kernels
[I 09:41:44.933 NotebookApp] The Jupyter Notebook is running at: http://[all ip addresses on your system]:8888/?token=400bdbc551bed4c7e80a8fb033c0e8765649fcef561f2dca
[I 09:41:44.933 NotebookApp] Use Control-C to stop this server and shut down all kernels (twice to skip confirmation).
[C 09:41:44.933 NotebookApp]

    Copy/paste this URL into your browser when you connect for the first time,
    to login with a token:
        http://localhost:8888/?token=400bdbc551bed4c7e80a8fb033c0e8765649fcef561f2dca
[I 09:42:06.568 NotebookApp] 302 GET /?token=400bdbc551bed4c7e80a8fb033c0e8765649fcef561f2dca (192.168.0.6) 0.74ms
[I 09:42:10.533 NotebookApp] Creating new notebook in
[W 09:42:10.923 NotebookApp] 404 GET /nbextensions/widgets/notebook/js/extension.js?v=20170212094144 (192.168.0.6) 4.94ms referer=http://192.168.0.30:18888/notebooks/Untitled.ipynb?kernel_name=bash
[I 09:42:10.974 NotebookApp] Kernel started: 62a1ca9e-9301-4e26-b10b-76c52ebe3077

Bash menu added at New.
f:id:akai_tsuki:20170212185758p:plain

the use of example for Bash
f:id:akai_tsuki:20170212185805p:plain

commit container and re-run on docker.

After I commited container to image,
I run container by saved image again and add option to publish the container’s port(8888).

Command list

  • stop container
$ docker ps
$ docker container stop work
$ docker ps
  • commit container to image
$ docker container commit -m "add python3.5 and jupyter notebook" work xxxxxxx/centos7:python3
$ docker images
  • run container
$ docker container run -d --name work2 -p 18888:8888 xxxxxxx/centos7:python3 tail -f /dev/null
$ docker ps
$ docker exec -it work2 /bin/bash

Detail

[vagrant@localhost ~]$ docker ps
CONTAINER ID        IMAGE               COMMAND               CREATED             STATUS              PORTS               NAMES
519dd98187dd        centos:7            "tail -f /dev/null"   24 hours ago        Up 24 hours                             work
[vagrant@localhost ~]$ docker container stop work
work
[vagrant@localhost ~]$ docker ps
CONTAINER ID        IMAGE               COMMAND             CREATED             STATUS              PORTS               NAMES
[vagrant@localhost ~]$
[vagrant@localhost ~]$ docker container commit -m "add python3.5 and jupyter notebook" work xxxxxxx/centos7:python3
sha256:3b592921ad2461a03b734d11f75cf28d1c4ea29a17e5eff981e2165e87eaf15c
[vagrant@localhost ~]$ docker images
REPOSITORY             TAG                 IMAGE ID            CREATED             SIZE
xxxxxxx/centos7        python3             3b592921ad24        10 seconds ago      429 MB
centos                 7                   67591570dd29        8 weeks ago         192 MB
[vagrant@localhost ~]$
[vagrant@localhost ~]$ docker container run -d --name work2 -p 18888:8888 xxxxxxx/centos7:python3 tail -f /dev/null
479c57f04b63d747d076389f9522462d6332aa54d40f3e603cc431a78f081037
[vagrant@localhost ~]$ docker ps
CONTAINER ID        IMAGE                     COMMAND               CREATED             STATUS              PORTS                     NAMES
479c57f04b63        xxxxxxx/centos7:python3   "tail -f /dev/null"   5 seconds ago       Up 2 seconds        0.0.0.0:18888->8888/tcp   work2
[vagrant@localhost ~]$
[vagrant@localhost ~]$ docker exec -it work2 /bin/bash
[root@479c57f04b63 /]#