piatok 11. februára 2022

Installing editors via ansible on three servers

Creating playbook to installing editors (nano, mc, vim) on all hosts:



1) creat and check playbook: (yaml file)

- for creating yaml file use yaml validator: http://www.yamllint.com/ 

 [root@localhost ~]# cat /etc/ansible/yum.yaml

---

- hosts: all


  tasks:

  - name: installing edit tools (nano, vim, mc)

    yum:

      name: vim,nano,mc

      update_cache: yes


2) run playbook via command ansible-playbook

[root@localhost ~]# ansible-playbook /etc/ansible/yum.yaml


PLAY [all] **********************************************************************************************************************************************************************************************************************************


TASK [Gathering Facts] **********************************************************************************************************************************************************************************************************************

ok: [10.0.2.6]

ok: [10.0.2.5]

ok: [10.0.2.7]


TASK [installing edit tools (nano, vim, mc)] ************************************************************************************************************************************************************************************************

changed: [10.0.2.7]

changed: [10.0.2.6]

changed: [10.0.2.5]


PLAY RECAP **********************************************************************************************************************************************************************************************************************************

10.0.2.5                   : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

10.0.2.6                   : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0

10.0.2.7                   : ok=2    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0





3) check yum log on one of three servers

on the server 10.0.2.7 /var/log/yum.log


 tail -f /var/log/yum.log


Jan 29 04:47:57 Installed: 2:vim-filesystem-7.4.629-8.el7_9.x86_64

Jan 29 04:48:02 Installed: 2:vim-common-7.4.629-8.el7_9.x86_64

Jan 29 04:48:02 Installed: 2:vim-enhanced-7.4.629-8.el7_9.x86_64

Jan 29 04:53:00 Installed: nano-2.3.1-10.el7.x86_64

Jan 29 04:53:02 Installed: 1:mc-4.8.7-11.el7.x86_64


Žiadne komentáre:

Zverejnenie komentára