sobota 5. februára 2022

ansible update on three servers

 ansible and yum update: yum update -y on three servers





1) vi /etc/ansible/hosts 

- add servers 


2) check all ansible hosts 


[root@localhost ~]# ansible all --list-hosts

  hosts (3):

    10.0.2.5

    10.0.2.7

    10.0.2.6


3) let's try update on three servers


ansible all -a "yum update -y"

there is an output


[root@localhost ~]# ansible all -a "yum update -y"
[WARNING]: Consider using the yum module rather than running 'yum'.  If you need to use command because yum is insufficient you can add 'warn: false' to this command task or set 'command_warnings=False' in ansible.cfg to get rid of this
message.
10.0.2.5 | CHANGED | rc=0 >>
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.upjs.sk
 * epel: ftp.upjs.sk
 * extras: ftp.upjs.sk
 * openstack-train: ftp.upjs.sk
 * rdo-qemu-ev: ftp.upjs.sk
 * updates: ftp.upjs.sk


10.0.2.6 | CHANGED | rc=0 >>
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: tux.rainside.sk
 * extras: tux.rainside.sk
 * updates: tux.rainside.sk




10.0.2.7 | CHANGED | rc=0 >>
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: merlin.fit.vutbr.cz
 * extras: merlin.fit.vutbr.cz
 * updates: merlin.fit.vutbr.cz


on all three servers you can see the PID of yum!




first server
1) [root@localhost ~]# ip -c a s
enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:3d:58:2b brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.5/24 brd 10.0.2.255 scope global noprefixroute dynamic enp0s3
       valid_lft 422sec preferred_lft 422sec
    inet6 fe80::bad7:61e5:2648:f1be/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
[root@localhost ~]#

2) [root@localhost ~]# ps aux | grep -i yum
root      9628 27.2 11.9 455044 121756 pts/0   S+   13:58   1:22 /usr/bin/python /usr/bin/yum update -y
root     17284  0.0  0.0 112812  1004 pts/1    R+   14:03   0:00 grep --color=auto -i yum

Second server: 
1) [root@localhost ~]# ip -c a s
enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:3d:58:2b brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.5/24 brd 10.0.2.255 scope global noprefixroute dynamic enp0s3
       valid_lft 422sec preferred_lft 422sec
    inet6 fe80::bad7:61e5:2648:f1be/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
[root@localhost ~]#

2) [root@localhost ~]# ps aux | grep -i yum
root      9871 27.2 11.9 455044 121756 pts/0   S+   13:58   1:22 /usr/bin/python /usr/bin/yum update -y
root     17284  0.0  0.0 112812  1004 pts/1    R+   14:03   0:00 grep --color=auto -i yum

Third server

3) [root@localhost ~]# ip -c a s
 enp0s3: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc pfifo_fast state UP group default qlen 1000
    link/ether 08:00:27:b4:5f:c7 brd ff:ff:ff:ff:ff:ff
    inet 10.0.2.7/24 brd 10.0.2.255 scope global noprefixroute dynamic enp0s3
       valid_lft 337sec preferred_lft 337sec
    inet6 fe80::bad7:61e5:2648:f1be/64 scope link tentative noprefixroute dadfailed
       valid_lft forever preferred_lft forever
    inet6 fe80::df61:e74a:dca6:7f0a/64 scope link noprefixroute
       valid_lft forever preferred_lft forever
[root@localhost ~]# ps aux | grep -i yum
root      9578 15.8 11.9 455044 121684 pts/0   S+   13:58   1:23 /usr/bin/python /usr/bin/yum update -y
root     14997  0.0  0.0 112812  1004 pts/1    R+   14:07   0:00 grep --color=auto -i yum
[root@localhost ~]#



Žiadne komentáre:

Zverejnenie komentára