Technotes

Technotes for future me

Ansible copy file

############
# Copy files
############

# RHEL 5 Copy ldap.conf to temp file to prevent reload and ldap breakage for ldap.conf (ldap.conf only)
- name: RHEL 5 Copy ldap.conf to temp file to prevent reload and ldap breakage for ldap.conf (ldap.conf only)
  copy:
    src: /etc/ldap.conf
    remote_src: yes
    dest: /etc/ldap.conf_new
    backup: yes
  when: "ansible_distribution_major_version == '5'"

#  RHEL 6 and 7 Copy pam_ldap.conf to temp file to prevent reload and ldap breakage for pam_ldap.conf
- name: RHEL 6 and 7 Copy pam_ldap.conf to temp file to prevent reload and ldap breakage for pam_ldap.conf
  copy:
    src: /etc/pam_ldap.conf
    remote_src: yes
    dest: /etc/pam_ldap.conf_new
    backup: yes
  when: (ansible_facts['distribution_major_version'] == "6") or (ansible_facts['distribution_major_version'] == "7")

# RHEL 6 and 7 Copy nslcd.conf to temp file to prevent reload and ldap breakage for pam_ldap.conf
- name: RHEL 6 and 7 Copy nslcd.conf to temp file to prevent reload and ldap breakage for pam_ldap.conf
  copy:
    src: /etc/nslcd.conf
    remote_src: yes
    dest: /etc/nslcd.conf_new
    backup: yes
Last updated on 31 Jan 2021
Published on 16 Dec 2019
Edit on GitHub