Merge "Use hostnamectl to set the container hostname"
This commit is contained in:
commit
8c8a22affa
@ -73,13 +73,6 @@
|
||||
when:
|
||||
- lxc_container_enable_resolved | bool
|
||||
|
||||
- name: Enable hostnamed
|
||||
systemd:
|
||||
name: systemd-hostnamed
|
||||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
|
||||
- name: Enable dbus
|
||||
systemd:
|
||||
name: dbus
|
||||
@ -91,6 +84,19 @@
|
||||
systemd:
|
||||
daemon_reload: true
|
||||
|
||||
- name: Start hostnamed
|
||||
systemd:
|
||||
name: systemd-hostnamed
|
||||
state: started
|
||||
enabled: true
|
||||
daemon_reload: true
|
||||
listen: Enable hostnamed
|
||||
|
||||
- name: Set hostnamectl name
|
||||
command: "/usr/bin/hostnamectl --static --pretty --transient set-hostname {{ inventory_hostname | replace('_', '-') | quote }}"
|
||||
changed_when: false
|
||||
listen: Enable hostnamed
|
||||
|
||||
# NOTE(hwoarang) openSUSE randomly fails to start the service
|
||||
# with an error like the following one
|
||||
# sysctl-container.service: Failed at step CGROUP spawning /sbin/sysctl: No such device
|
||||
|
@ -245,20 +245,6 @@
|
||||
mode: "0644"
|
||||
remote_user: root
|
||||
|
||||
- name: Create hostname
|
||||
copy:
|
||||
dest: "/etc/hostname"
|
||||
content: "{{ inventory_hostname | replace('_', '-') }}"
|
||||
owner: "root"
|
||||
group: "root"
|
||||
mode: "0644"
|
||||
remote_user: root
|
||||
|
||||
- name: Setup hostname
|
||||
command: hostname -F /etc/hostname
|
||||
changed_when: false
|
||||
remote_user: root
|
||||
|
||||
- name: Ensure the hostnamed override directory exists
|
||||
file:
|
||||
path: "/etc/systemd/system/systemd-hostnamed.service.d"
|
||||
|
Loading…
Reference in New Issue
Block a user