utorok 7. marca 2023

anisble playbook - update only redhat

How can we solve conditions in ansible? 





Ansible is very simple: We want to os update but only on Redhat machines? How? 


Like this:



 ---

- hosts: all


  tasks:

    - name: "update OS"

      command: yum update -y

      when: ansible_os_family == 'RedHat'





      when: ansible_os_family == 'RedHat' - it is condition -- only RedHat OS family (like RHEL, Centos, etc..)


Žiadne komentáre:

Zverejnenie komentára