81 lines
2.7 KiB
YAML
81 lines
2.7 KiB
YAML
---
|
|
- name: Reload systemd in installer environment
|
|
when: ansible_service_mgr == 'systemd'
|
|
ansible.builtin.systemd:
|
|
daemon_reload: true
|
|
|
|
- name: Set local timezone
|
|
ansible.builtin.file:
|
|
src: /usr/share/zoneinfo/{{ system_cfg.timezone }}
|
|
dest: /mnt/etc/localtime
|
|
state: link
|
|
force: true
|
|
|
|
- name: Setup locales
|
|
block:
|
|
- name: Configure locale.gen
|
|
when: not is_rhel | bool
|
|
ansible.builtin.lineinfile:
|
|
dest: /mnt/etc/locale.gen
|
|
regexp: "{{ item.regex }}"
|
|
line: "{{ item.line }}"
|
|
loop:
|
|
- { regex: "{{ system_cfg.locale }} UTF-8", line: "{{ system_cfg.locale }} UTF-8" }
|
|
|
|
- name: Generate locales
|
|
when: not is_rhel | bool
|
|
ansible.builtin.command: "{{ chroot_command }} /usr/sbin/locale-gen"
|
|
register: configuration_locale_result
|
|
changed_when: configuration_locale_result.rc == 0
|
|
|
|
- name: Compute hostname variables
|
|
ansible.builtin.set_fact:
|
|
configuration_dns_domain: >-
|
|
{{ (system_cfg.network.dns.search | default([]) | first | default('')) | string }}
|
|
configuration_hostname_fqdn: >-
|
|
{{
|
|
hostname
|
|
if '.' in hostname
|
|
else (
|
|
hostname + '.' + (system_cfg.network.dns.search | default([]) | first | default('') | string)
|
|
if (system_cfg.network.dns.search | default([]) | first | default('') | string) | length > 0
|
|
else hostname
|
|
)
|
|
}}
|
|
|
|
- name: Set hostname
|
|
ansible.builtin.copy:
|
|
content: "{{ configuration_hostname_fqdn.split('.')[0] }}"
|
|
dest: /mnt/etc/hostname
|
|
mode: "0644"
|
|
|
|
- name: Add host entry to /etc/hosts
|
|
vars:
|
|
configuration_hostname_short: "{{ hostname.split('.')[0] }}"
|
|
configuration_hostname_entries: >-
|
|
{{ [configuration_hostname_fqdn, configuration_hostname_short] | unique | join(' ') }}
|
|
configuration_hosts_ip: >-
|
|
{{
|
|
system_cfg.network.ip
|
|
if system_cfg.network.ip is defined and (system_cfg.network.ip | string | length) > 0
|
|
else inventory_hostname
|
|
}}
|
|
configuration_hosts_line: >-
|
|
{{ configuration_hosts_ip }} {{ configuration_hostname_entries }}
|
|
ansible.builtin.lineinfile:
|
|
path: /mnt/etc/hosts
|
|
line: "{{ configuration_hosts_line }}"
|
|
state: present
|
|
|
|
- name: Create vconsole.conf
|
|
ansible.builtin.copy:
|
|
content: "KEYMAP={{ system_cfg.keymap }}"
|
|
dest: /mnt/etc/vconsole.conf
|
|
mode: "0644"
|
|
|
|
- name: Create locale.conf
|
|
ansible.builtin.copy:
|
|
content: "LANG={{ system_cfg.locale }}"
|
|
dest: /mnt/etc/locale.conf
|
|
mode: "0644"
|