From: Scott Mayhew <smayhew@redhat.com>
To: kdevops@lists.linux.dev
Subject: [PATCH v2 04/10] devconfig: set /etc/hostname earlier
Date: Sat, 9 Mar 2024 18:35:57 -0500 [thread overview]
Message-ID: <20240309233603.1306533-5-smayhew@redhat.com> (raw)
In-Reply-To: <20240309233603.1306533-1-smayhew@redhat.com>
I noticed that opensuse-tumbleweed guestfs VMs were still showing up
as 'localhost.localdomain', even though /etc/hostname had the correct
hostnames.
Update /etc/hostname before the distro-specific install tasks, so that
the reboot that occurs causes the hostname change to actually take
effect.
Signed-off-by: Scott Mayhew <smayhew@redhat.com>
---
playbooks/roles/devconfig/tasks/main.yml | 21 ++++++++++++---------
1 file changed, 12 insertions(+), 9 deletions(-)
diff --git a/playbooks/roles/devconfig/tasks/main.yml b/playbooks/roles/devconfig/tasks/main.yml
index 1f18e588..1e67f91e 100644
--- a/playbooks/roles/devconfig/tasks/main.yml
+++ b/playbooks/roles/devconfig/tasks/main.yml
@@ -17,6 +17,18 @@
setup:
tags: always
+# Update /etc/hostname first so the change gets picked up by the reboot
+# that occurs during the distro-specific tasks
+
+- name: Ensure /etc/hostname is set
+ become: yes
+ become_flags: 'su - -c'
+ become_method: sudo
+ template:
+ src: hostname
+ dest: /etc/hostname
+ tags: hostname
+
# Distro specific
- name: Install dependencies
import_tasks: install-deps/main.yml
@@ -28,15 +40,6 @@
# Distro agnostic stuff goes below
-- name: Ensure /etc/hostname is set
- become: yes
- become_flags: 'su - -c'
- become_method: sudo
- template:
- src: hostname
- dest: /etc/hostname
- tags: hostname
-
- name: Check if the developer has a git config
delegate_to: localhost
stat:
--
2.43.0
next prev parent reply other threads:[~2024-03-09 23:36 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-09 23:35 [PATCH v2 00/10] add initial support for testing nfs with krb5 Scott Mayhew
2024-03-09 23:35 ` [PATCH v2 01/10] nfsd: make sure the appropriate fsprogs package is installed Scott Mayhew
2024-03-09 23:35 ` [PATCH v2 02/10] update_etc_hosts: fix up hostnames on debian guestfs hosts Scott Mayhew
2024-03-09 23:35 ` [PATCH v2 03/10] nfsd: use EXTRA_VAR_INPUTS for export options Scott Mayhew
2024-03-09 23:35 ` Scott Mayhew [this message]
2024-03-09 23:35 ` [PATCH v2 05/10] nfsd: add a pipefs-directory config to nfs.conf Scott Mayhew
2024-03-09 23:35 ` [PATCH v2 06/10] bringup: move the update_etc_hosts task to run early Scott Mayhew
2024-03-09 23:36 ` [PATCH v2 07/10] bringup: clean up the nfs-related make targets Scott Mayhew
2024-03-09 23:36 ` [PATCH v2 08/10] gen_hosts/gen_nodes: clean up nfsd-related stuff Scott Mayhew
2024-03-09 23:36 ` [PATCH v2 09/10] kconfigs: clean up Kconfig.bringup.goals Scott Mayhew
2024-03-09 23:36 ` [PATCH v2 10/10] fstests/nfs: add krb5 support Scott Mayhew
2024-03-11 12:57 ` [PATCH v2 00/10] add initial support for testing nfs with krb5 Jeff Layton
2024-03-11 22:05 ` Luis Chamberlain
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240309233603.1306533-5-smayhew@redhat.com \
--to=smayhew@redhat.com \
--cc=kdevops@lists.linux.dev \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox