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

87 lines
3.0 KiB
YAML
Raw Normal View History

---
# Base configurations to be implemented anyways.
# installing italian interface translation
- name: Making available also Italian NethGUI
yum:
pkg: nethserver-lang-it
state: present
tags: nethgui
# Trusted networks: LAN
- name: Check for LAN to be added as Trusted Network
shell: /sbin/e-smith/db networks printprop {{ ansible_local.domain.servernet }} Description
register: check_trusted
changed_when: '"Description=Local LAN" not in check_trusted.stdout'
ignore_errors: yes
tags: trustednet
- name: Configuring trusted networks
shell: /sbin/e-smith/db networks set {{ ansible_local.domain.servernet }} network Description "Local LAN" Mask {{ ansible_local.domain.servernetmask }}
when: check_trusted is changed
tags: trustednet
- name: Activating trusted network
shell: /sbin/e-smith/signal-event trusted-networks-modify
when: check_trusted is changed
tags: trustednet
2016-03-15 18:42:01 +00:00
# Preconfiguring DNS anyways
- name: Checking DNS configuration
shell: /sbin/e-smith/db configuration printprop dns NameServers
register: chk_dns
changed_when: "'NameServers={{ ansible_local.domain.extdnsserver1 }}' not in chk_dns.stdout"
2016-03-15 18:42:01 +00:00
ignore_errors: yes
- name: Configuring DNS resolution
shell: /sbin/e-smith/db configuration setprop dns NameServers {{ ansible_local.domain.extdnsserver1 }},{{ ansible_local.domain.extdnsserver2 }}
when: chk_dns is changed
2016-03-15 18:42:01 +00:00
tags: dns-preset
- name: Activating correct DNS resolution
shell: "/sbin/e-smith/signal-event nethserver-base-update"
when: chk_dns is changed
2016-03-15 18:42:01 +00:00
# Hostname and domainname
- name: Configuring hostname
shell: /sbin/e-smith/db configuration set SystemName {{ ansible_local.domain.server }}
register: chg_hostname
when: "'{{ ansible_hostname }}' != '{{ ansible_local.domain.server }}'"
tags: hostname
- name: Configuring domain name
shell: /sbin/e-smith/db configuration set DomainName {{ ansible_local.domain.domainfull }}
register: chg_domainname
when: "'{{ ansible_domain }}' != '{{ ansible_local.domain.domainfull }}'"
tags: domainname
- name: Activating hostname/domainname changes
shell: /sbin/e-smith/signal-event hostname-modify
when: chg_hostname is changed or chg_domainname is changed
tags:
- hostname
- domainname
# Base certificate
- name: Checking CA configuration
shell: /sbin/e-smith/db configuration printprop pki CommonName
ignore_errors: true
register: chk_crt
changed_when: "'CommonName={{ ansible_local.domain.serverfqdn }}' not in chk_crt.stdout"
tags: regen-ca
- name: Configuring CA
shell: /sbin/e-smith/db configuration setprop pki CertificateDuration 3650 CommonName {{ ansible_local.domain.serverfqdn }} CountryCode {{ ansible_local.domain.org_countrycode }} EmailAddress {{ ansible_local.domain.org_email }} Locality "{{ ansible_local.domain.org_city }}" Organization "{{ ansible_local.domain.org_company }}"
tags: regen-ca
when: chk_crt is changed or force_regen_ca|bool
- name: Activating CA and regenerate
shell: /sbin/e-smith/signal-event certificate-update
when: chk_crt is changed or force_regen_ca|bool
tags: regen-ca