---

# Configure access to machine with authconfig

- name: add only root user to access.conf file
  blockinfile:
    dest: "/etc/security/access.conf"
    backup: yes
    marker: "# {mark} BASIC ANSIBLE MANAGED BLOCK"
    insertafter: "#- : ALL : ALL"
    block: |
      + : root : LOCAL 127.0.01 ::1 cron crond localhost.localdomain
      + : root :{% for host in trusted_nets %} {{ host }}{% endfor %} # IPv4
      + : root :{% for host in trusted_nets_v6 %} {{ host }}{% endfor %} # IPv6
      - : ALL : ALL
    owner: "root"
    group: "root"
    mode: 0644
  register: pamaccess_config

- name: execute authconfig
  command: "/usr/sbin/authconfig --kickstart --disablemd5 --passalgo=sha512  --enableshadow --enablecache --enablepamaccess --enablelocauthorize --disablesssd --disablesssdauth --disableldaptls --disableldap --disableldapauth --enablerfc2307 "
  when: pamaccess_config.changed

- name: fix authconfig bug (sets PATH_LDAP_CACERTS to the wrong in /usr/share/authconfig/authinfo.py)
  file:
    src: /etc/openldap/certs
    dest: /etc/openldap/cacerts
    owner: root
    state: link


---

# Configure access to machine with authconfig

- name: add only root user to access.conf file
  blockinfile:
    dest: "/etc/security/access.conf"
    backup: yes
    marker: "# {mark} BASIC ANSIBLE MANAGED BLOCK"
    insertafter: "#- : ALL : ALL"
    block: |
      + : root : LOCAL 127.0.0.1 ::1 cron crond localhost.localdomain
      + : root :{% for host in trusted_nets %} {{ host }}{% endfor %} # IPv4
      + : root :{% for host in trusted_nets_v6 %} {{ host }}{% endfor %} # IPv6
      - : ALL : ALL
    owner: "root"
    group: "root"
    mode: 0644
  register: pamaccess_config

- name: execute authconfig
  command: "/usr/sbin/authconfig --kickstart --disablemd5 --passalgo=sha512  --enableshadow --enablecache --enablepamaccess --enablelocauthorize --disablesssd --disablesssdauth --disableldaptls --disableldap --disableldapauth --enablerfc2307 "
  when: pamaccess_config.changed

- name: fix authconfig bug (sets PATH_LDAP_CACERTS to the wrong in /usr/share/authconfig/authinfo.py)
  file:
    src: /etc/openldap/certs
    dest: /etc/openldap/cacerts
    owner: root
    state: link


Fix typo in localhost IP
Fix typo in localhost IP
