diff --git a/common/bootstrap/defaults/main.yml b/common/bootstrap/defaults/main.yml index e128598..72a4a8a 100644 --- a/common/bootstrap/defaults/main.yml +++ b/common/bootstrap/defaults/main.yml @@ -1,5 +1,5 @@ -bootstrap_hostname: "{{ ansible_hostname }}" -bootstrap_domain: "{{ ansible_domain }}" +bootstrap_hostname: "{{ inventory_hostname }}" +bootstrap_domain: "{{ ansible_domain | default('ansible.local') }}" bootstrap_shell: ubuntu: /bin/bash diff --git a/common/bootstrap/tasks/archlinux.yml b/common/bootstrap/tasks/archlinux.yml index 20de63a..3a878bf 100644 --- a/common/bootstrap/tasks/archlinux.yml +++ b/common/bootstrap/tasks/archlinux.yml @@ -17,10 +17,3 @@ owner: root group: wheel mode: 0600 - -# currently broken; does not find hostnamectl binary -- name: set hostname (via systemd) - hostname: - name: "{{ bootstrap_hostname }}.{{ bootstrap_domain }}" - use: systemd - ignore_errors: yes diff --git a/common/bootstrap/tasks/common.yml b/common/bootstrap/tasks/common.yml index bd25824..708c679 100644 --- a/common/bootstrap/tasks/common.yml +++ b/common/bootstrap/tasks/common.yml @@ -49,3 +49,7 @@ - name: reload facts setup: + +- name: Set hostname + ansible.builtin.hostname: + name: "{{ bootstrap_hostname }}.{{ bootstrap_domain }}"