refactor(vars): add system/hypervisor dict inputs
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
---
|
||||
- name: Reload systemd in installer environment
|
||||
when: ansible_service_mgr == 'systemd'
|
||||
ansible.builtin.systemd:
|
||||
daemon_reload: true
|
||||
|
||||
@@ -19,14 +20,15 @@
|
||||
regexp: "{{ item.regex }}"
|
||||
line: "{{ item.line }}"
|
||||
loop:
|
||||
- {regex: en_US\.UTF-8 UTF-8, line: en_US.UTF-8 UTF-8}
|
||||
- { regex: en_US\.UTF-8 UTF-8, line: en_US.UTF-8 UTF-8 }
|
||||
|
||||
- name: Generate locales
|
||||
when: not is_rhel | bool
|
||||
ansible.builtin.command: "{{ chroot_command }} /mnt /usr/sbin/locale-gen"
|
||||
ansible.builtin.command: "{{ chroot_command }} /usr/sbin/locale-gen"
|
||||
register: configuration_locale_result
|
||||
changed_when: configuration_locale_result.rc == 0
|
||||
|
||||
|
||||
- name: Set hostname
|
||||
vars:
|
||||
configuration_hostname_fqdn: >-
|
||||
@@ -34,8 +36,8 @@
|
||||
hostname
|
||||
if '.' in hostname
|
||||
else (
|
||||
hostname + '.' + vm_dns_search
|
||||
if vm_dns_search is defined and vm_dns_search | length
|
||||
hostname + '.' + system_cfg.dns_search
|
||||
if system_cfg.dns_search is defined and system_cfg.dns_search | length
|
||||
else hostname
|
||||
)
|
||||
}}
|
||||
@@ -51,16 +53,22 @@
|
||||
hostname
|
||||
if '.' in hostname
|
||||
else (
|
||||
hostname + '.' + vm_dns_search
|
||||
if vm_dns_search is defined and vm_dns_search | length
|
||||
hostname + '.' + system_cfg.dns_search
|
||||
if system_cfg.dns_search is defined and system_cfg.dns_search | length
|
||||
else hostname
|
||||
)
|
||||
}}
|
||||
configuration_hostname_short: "{{ hostname.split('.')[0] }}"
|
||||
configuration_hostname_entries: >-
|
||||
{{ [configuration_hostname_fqdn, configuration_hostname_short] | unique | join(' ') }}
|
||||
configuration_hosts_ip: >-
|
||||
{{
|
||||
system_cfg.ip
|
||||
if system_cfg.ip is defined and (system_cfg.ip | string | length) > 0
|
||||
else inventory_hostname
|
||||
}}
|
||||
configuration_hosts_line: >-
|
||||
{{ (vm_ip if vm_ip is defined and vm_ip | length > 0 else inventory_hostname) }} {{ configuration_hostname_entries }}
|
||||
{{ configuration_hosts_ip }} {{ configuration_hostname_entries }}
|
||||
ansible.builtin.lineinfile:
|
||||
path: /mnt/etc/hosts
|
||||
line: "{{ configuration_hosts_line }}"
|
||||
|
||||
Reference in New Issue
Block a user