server-config/roles/nethcfg/tasks/directory.yml

43 lines
1.6 KiB
YAML

---
# Organization
- name: Installing required packages
yum:
pkg: nethserver-directory
state: present
- name: Check organization configuration
shell: /sbin/e-smith/db configuration printprop OrganizationContact City
register: check_org
changed_when: "'City={{ ansible_local.domain.org_city }}' not in check_org.stdout"
ignore_errors: yes
# Password policy
- name: Check for password policy
shell: /sbin/e-smith/db configuration printprop passwordstrength Users
register: chk_passstr
changed_when: "'Users=none' not in chk_passstr.stdout"
ignore_errors: true
tags: password-policy
- name: Configuring password policy
shell: /sbin/e-smith/db configuration setprop passwordstrength PassExpires no Users none Admin strong MaxPassAge 180 MinPassAge 0 PassExpires no PassWarning 7
when: chk_passstr is changed
tags: password-policy
- name: Activating password policy
shell: /sbin/e-smith/signal-event password-policy-update
when: chk_passstr is changed
tags: password-policy
# Organization configuration
- name: Configuring organization
shell: /sbin/e-smith/db configuration setprop OrganizationContact City "{{ ansible_local.domain.org_city }}" Company "{{ ansible_local.domain.org_company }}" CountryCode {{ ansible_local.domain.org_countrycode }} Department "{{ ansible_local.domain.org_department }}" PhoneNumber "{{ ansible_local.domain.org_phone }}" Street "{{ ansible_local.domain.org_street }}"
when: check_org is changed
- name: Activating organization configuration
shell: /sbin/e-smith/signal-event organization-save
when: check_org is changed