Ansible example of different versions of Same OS

This is another quick example of how you can accomplish the same thing when using different versions of the same flavour of Linux.

In this example, this will disable NFS on with a  Redhat 6 or a Redhat 7 machine, this follows on from the other Ansible Example I posted the other week.

The code is below and I hope you find this helpful, I should really put these on on my repo.

  name: "Disable NFS"
  hosts: disablenfs
  remote_user: root
  gather_facts: true
    - name: Disable NFS 6
      shell: "chkconfig nfs off"
      when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "6"
    - name: Disable NFS 7
      shell: "systemctl disable nfs"
      when: ansible_os_family == "RedHat" and ansible_distribution_major_version == "7"

I am always interested in your thoughts so if you have any comments or feedback then please feel free to add any comments, or you can mail me  here.

Related Posts Plugin for WordPress, Blogger... 


Fixmestick Anti Virus Tool

The Most Important Tech of the 21st Century So Far