Technotes

Technotes for future me

Ansible set permissions of file

    #################
    # Set permissions
    #################

    # RHEL 5 Set correct permissions
    - name: RHEL 5 Set correct permissions
      file:
        path: /etc/ldap.conf
        mode: '0600'
      notify: restart nscd
      when: "ansible_distribution_major_version == '5'"

    # RHEL 6 and 7 Set correct permissions
    - name: RHEL 6 and 7 Set correct permissions
      file:
        path: /etc/pam_ldap.conf
        mode: '0600'
      notify: restart nscd
      when: (ansible_facts['distribution_major_version'] == "6") or (ansible_facts['distribution_major_version'] == "7")

    # RHEL 6 and 7 Set correct permissions
    - name: RHEL 6 and 7 Set correct permissions
      file:
        path: /etc/nslcd.conf
        mode: '0600'
      notify: restart nslcd
      when: (ansible_facts['distribution_major_version'] == "6") or (ansible_facts['distribution_major_version'] == "7")
Last updated on 31 Jan 2021
Published on 16 Dec 2019
Edit on GitHub