Monday 30 September 2019

Solaris 11.4 IPS repo configuration and GUI configuration


How to configure local  solaris 11.4 IPS repository?
server:-
1) download all repos from oracle website
2)check check sum of all repos and compare with existing file.
root@server11:~# cd /myrepo/
root@server11:/myrepo# ls
SHA256 Digest           sol-11_4-repo_1of5.zip  sol-11_4-repo_3of5.zip  sol-11_4-repo_5of5.zip
install-repo.ksh        sol-11_4-repo_2of5.zip  sol-11_4-repo_4of5.zip
root@server11:/myrepo# digest -v -a sha256 *zip
sha256 (sol-11_4-repo_1of5.zip) = de12a1d2c9653bddbb10580c6cd2b89f05aa498f80bff0b0199f594ff6776a93
sha256 (sol-11_4-repo_2of5.zip) = 2b982ecbcb9f4c7f870ea423b887f5d8f11d37b45aeb23838a08aa5d72b127ad
sha256 (sol-11_4-repo_3of5.zip) = df751b6f7df9a35f884e1a0d7785142f795534896c486a8950d1c8dca861e74a
sha256 (sol-11_4-repo_4of5.zip) = 2a72da79e2dda54764ac019f69448336c7a6ca387e19345e7c8cf389cdc32467
sha256 (sol-11_4-repo_5of5.zip) = d46a85f64e833b85a2d1e9d7d062ab38bb11c3f15e2cafb1f78d2fef1d5dbf82
root@server11:/myrepo#
3)creating local ips repository
root@server11:/myrepo# ls
SHA256 Digest           sol-11_4-repo_1of5.zip  sol-11_4-repo_3of5.zip  sol-11_4-repo_5of5.zip
install-repo.ksh        sol-11_4-repo_2of5.zip  sol-11_4-repo_4of5.zip
root@server11:/myrepo# unzip -qd /testpool/ sol-11_4-repo_1of5.zip
root@server11:/myrepo# unzip -qd /testpool/ sol-11_4-repo_2of5.zip
root@server11:/myrepo# unzip -qd /testpool/ sol-11_4-repo_3of5.zip
root@server11:/myrepo# unzip -qd /testpool/ sol-11_4-repo_4of5.zip
root@server11:/myrepo# unzip -qd /testpool/ sol-11_4-repo_5of5.zip

root@server11:/testpool# svccfg -s application/pkg/server setprop pkg/inst_root=/testpool/
root@server11:/testpool# svccfg -s application/pkg/server setprop pkg/readonly=true
root@server11:/testpool# svccfg -s application/pkg/server setprop pkg/port=6601

root@server11:/testpool# svcadm refresh application/pkg/server
root@server11:/testpool#         svcadm enable application/pkg/server

root@server11:/testpool# svcs pkg/server
STATE          STIME    FMRI
online         16:44:32 svc:/application/pkg/server:default
root@server11:/testpool# pkg set-publisher -G '*' -g http://192.168.56.50:6601/ solaris
root@server11:/testpool# pkg publisher

PUBLISHER                   TYPE     STATUS P LOCATION
solaris                     origin   online F http://192.168.56.50:6601/
root@server11:/testpool#
To check web based conosle in solaris 11.4
$ svcs webui/server sstore

clinet:-
set server as clinet to repository server
root@solarisnode2:~# pkg set-publisher -G '*' -g http://192.168.56.50:6601/ solaris                                                                   
root@solarisnode2:~# pkg publisher
PUBLISHER                   TYPE     STATUS P LOCATION
solaris                     origin   online F http://192.168.56.50:6601/
to install packages
root@solarisnode2:~# pkg install solaris-desktop
           Packages to install: 357
           Mediators to change:   1
            Services to change:  17
       Create boot environment:  No
Create backup boot environment:  No

DOWNLOAD                                PKGS         FILES    XFER (MB)   SPEED
Completed                            357/357   61930/61930  958.4/958.4  2.5M/s

PHASE                                          ITEMS
Installing new actions                   76265/76265
Updating package state database                 Done
Updating package cache                           0/0
Updating image state                            Done
Creating fast lookup database                   Done
Updating package cache                           1/1





Thursday 12 September 2019

shell script to print number positive or negative

$ cat ppn.sh
# to print positive  or negative numbers
clear
echo " `tput cup 5 5` enter number:"
tput cup 5 30;read var
if [ $var -eq 0 ]
then
clear;tput cup 5 5;echo "zero"
elif [ $var -lt 0 ]
then
tput cup 7 5;echo "negative"
else
tput cup 7 5;echo "positive"
fi

Monday 22 July 2019

echo "- - -" > /sys/class/scsi_host/hosth/scan explanation


echo "- - -" > /sys/class/scsi_host/hosth/scan
This procedure will add LUNs, but not remove them.
In this case,  three fields are
1) the channel number, 
2)SCSI target ID
3)LUN values are replaced by wildcards. 
Any combination of identifiers and wildcards is allowed, allowing you to make the command as specific or broad as needed. 

Monday 22 April 2019

Ansible Plays and Play books

Ansible Plays and Play books
Plays maps hosts to tasks
A play can have multiple tasks
A play book can have multiple plays.
at HOME dir:-
[ansible@ansibleserver ~]$ cat .vimrc
autocmd FileType yaml setlocal ai ts=2 sw=2 et

[ansible@ansibleserver playbooks]$ cat firstplay.yaml
---
- name: first yaml file
  hosts: db
  vars_prompt:
  - name: "sitename"
    prompt: "what is new state name?"
  tasks:
  - debug: msg="new state name is {{sitename}}"
...
[ansible@ansibleserver playbooks]$ ansible-playbook firstplay.yaml
what is new state name?:

PLAY [first yaml file] ***************************************************************************************************************

TASK [Gathering Facts] ***************************************************************************************************************
ok: [10.25.12.10]

TASK [debug] *************************************************************************************************************************
ok: [10.25.12.10] => {
    "msg": "new state name is TS"
}

PLAY RECAP ***************************************************************************************************************************
10.25.12.10                : ok=2    changed=0    unreachable=0    failed=0

ANSIBLE modules

Ansible Modules:-
There are three types of modules existed
1)Core Modules : these are built in modules
2)Extra Modules: these are third party modules
3) Deprecated Modules: these are no longer available.

to display:
$ansible -doc     -l
$ansible-doc  ping
$ansible host1 -m setup|more
$ansible host1   -m setup -a "filter=ansible_mounts"

How to use specific Python version as interpreter in Ansible?

Ansible needs 2.X version as interpreter.
we can declare required python version in inventory file
[ansible@ansibleserver ~]$ cat inventory_python
10.25.12.10 ansible_python_interpreter=/usr/bin/python2.7

[ansible@ansibleserver ~]$ ansible all -i inventory_python -m ping -u ansible
10.25.12.10 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

Note:- if version not existed throws error.

Ansible inventory

inventory Features:-
1)Behavioral Parameters
2)Groups
3)Group of Groups
4)Assign Variables
5)Scaling Out using multiple files
6)Static/Dynamic
examples:-
cat /etc/ansible/ansible.cfg|grep -i inventory
[ansible@ansibleserver ~]$ cat /etc/ansible/ansible.cfg |grep -i inventory
inventory      = /etc/ansible/hosts

#cat /etc/ansible/hosts
10.25.12.11
10.25.12.10
10.25.12.13
[db]
10.25.12.10

[web]
10.25.12.13

[datacenter:children]
db
web

To know List of Ansible hosts:-
[ansible@ansibleserver ~]$ ansible all --list-hosts
  hosts (3):
    10.25.12.10
    10.25.12.11
    10.25.12.13
[ansible@ansibleserver ~]$ ansible db --list-hosts
  hosts (1):
    10.25.12.10
[ansible@ansibleserver ~]$ ansible web --list-hosts
  hosts (1):
    10.25.12.13
[ansible@ansibleserver ~]$ ansible datacenter --list-hosts
  hosts (2):
    10.25.12.10
    10.25.12.13

=================
we can create local inventories as well.
ex:-
[ansible@ansibleserver ~]$ cat inventory
10.25.12.13 ansible_ssh_user=ansible ansible_ssh_pass=ansible
[ansible@ansibleserver ~]$ ansible all -i inventory -m ping
10.25.12.13 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
[ansible@ansibleserver ~]$ ansible all -i inventory -a 'df -h'
10.25.12.13 | CHANGED | rc=0 >>
Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   18G  2.9G   15G  17% /
devtmpfs               481M     0  481M   0% /dev
tmpfs                  490M     0  490M   0% /dev/shm
tmpfs                  490M  6.9M  484M   2% /run
tmpfs                  490M     0  490M   0% /sys/fs/cgroup
/dev/sda1              497M  119M  379M  24% /boot

[ansible@ansibleserver ~]$ ansible all -i inventory -a 'hostname'
10.25.12.13 | CHANGED | rc=0 >>
clinet.example.com

==============
[ansible@ansibleserver ~]$ cat inventory
10.25.12.13 ansible_ssh_user=ansible ansible_ssh_pass=ansible
10.25.12.11 ansible_ssh_user=ansible ansible_ssh_pass=ansible ansible_python_interpreter=/usr/bin/python
[ansible@ansibleserver ~]$ ansible all -i inventory -a 'hostname'
10.25.12.11 | CHANGED | rc=0 >>
yumserver.example.com

10.25.12.13 | CHANGED | rc=0 >>
clinet.example.com

==============
Declaring inventory Varibles:-
[ansible@ansibleserver ~]$ cat inventory
10.25.12.13 ansible_ssh_user=ansible ansible_ssh_pass=ansible
10.25.12.11 ansible_ssh_user=ansible ansible_ssh_pass=ansible ansible_python_interpreter=/usr/bin/python
[db]
10.25.12.11

[web]
10.25.12.13

[datacenter:children]
db
web

[datacenter:vars]
ansible_ssh_user=student
ansible_ssh_pass=student
[ansible@ansibleserver ~]$

[ansible@ansibleserver ~]$ ansible datacenter -i inventory -m ping
10.25.12.11 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
10.25.12.13 | SUCCESS => {
    "changed": false,
    "ping": "pong"
}

ANSIBLE Architecture

1) Ansible Architecture:-
inventory+modules=Ansible playbook
Ansible Playbook --> Ansible config -->PYTHON --> SSH --> multiple clients