From 15bb968a47d67f7026bad5ef07688ada9d0f3d62 Mon Sep 17 00:00:00 2001 From: Yusuke Suzuki Date: Thu, 18 Mar 2021 15:55:12 +0900 Subject: [PATCH 1/2] Fix example Signed-off-by: Yusuke Suzuki --- examples/README.md | 10 +++++----- examples/cluster.example.yml | 6 ++++++ examples/user-data.example.yml | 12 +++++++++--- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/examples/README.md b/examples/README.md index 475afa65..678e1e8b 100644 --- a/examples/README.md +++ b/examples/README.md @@ -19,7 +19,7 @@ is as follows: To run the example, launch `placemat` by the following command: ```console -$ sudo placemat cluster.example.yml +$ sudo placemat2 cluster.example.yml ``` The cluster configuration is described in [`cluster.example.yml`](cluster.example.yml). @@ -38,15 +38,15 @@ It downloads boot images, and then starts [dnsmasq][] and [nginx][] on Ubuntu to work as a network boot server. The worker nodes run Qemu's default BIOS to boot from the network. They load -[iPXE][] provided by the boot node, and then load [CoreOS Container Linux][]. +[iPXE][] provided by the boot node, and then load [Flatcar Container Linux][]. They are configured with empty disks, which will be seen as `/dev/vda`. You can log-in to the `boot` node by `ubuntu`/`ubuntu`. As for the worker nodes, they are configured to accept auto login from the console. ```console -$ sudo pmctl node enter boot # login with ubuntu/ubuntu -$ sudo pmctl node enter worker-1 # autologin as "core" user +$ sudo pmctl2 node enter boot # login with ubuntu/ubuntu +$ sudo pmctl2 node enter worker-1 # autologin as "core" user # type Ctrl-q and Ctrl-x to leave from the node console ``` @@ -56,4 +56,4 @@ $ sudo pmctl node enter worker-1 # autologin as "core" user [nginx]: https://nginx.org/ [UEFI HTTP Boot]: https://github.com/tianocore/tianocore.github.io/wiki/HTTP-Boot [iPXE]: https://ipxe.org/ -[CoreOS Container Linux]: https://coreos.com/os/docs/latest/ +[Flatcar Container Linux]: https://kinvolk.io/docs/flatcar-container-linux/latest/ diff --git a/examples/cluster.example.yml b/examples/cluster.example.yml index d380951a..b5f3db23 100644 --- a/examples/cluster.example.yml +++ b/examples/cluster.example.yml @@ -4,6 +4,12 @@ type: external use-nat: true address: 172.16.0.1/24 --- +kind: Network +name: bmc +type: bmc +use-nat: false +address: 172.16.1.1/24 +--- kind: Image name: ubuntu-image url: https://cloud-images.ubuntu.com/releases/20.04/release/ubuntu-20.04-server-cloudimg-amd64.img diff --git a/examples/user-data.example.yml b/examples/user-data.example.yml index 4c9a21ae..b18eaeb7 100644 --- a/examples/user-data.example.yml +++ b/examples/user-data.example.yml @@ -71,14 +71,20 @@ write_files: "networkd": {"units": [{"name": "00-eth0.network", "contents": "[Match]\nName=eth0\n\n[Network]\nAddress=172.16.0.102"}]} } + - path: /etc/resolv.conf + content: | + nameserver 8.8.8.8 + runcmd: - - [ curl, -sSL, -o, /var/lib/dnsmasq/ipxe.efi, "http://boot.ipxe.org/ipxe.efi"] - - [ curl, -sSL, -o, /var/www/html/coreos_production_pxe.vmlinuz, "https://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe.vmlinuz"] - - [ curl, -sSL, -o, /var/www/html/coreos_production_pxe_image.cpio.gz, "https://stable.release.core-os.net/amd64-usr/current/coreos_production_pxe_image.cpio.gz"] + - [ systemctl, stop, systemd-resolved.service ] + - [ systemctl, disable, systemd-resolved.service ] - [ systemctl, enable, dnsmasq.service ] - [ systemctl, start, dnsmasq.service ] - [ systemctl, enable, nginx.service ] - [ systemctl, start, nginx.service ] + - [ curl, -sSL, -o, /var/lib/dnsmasq/ipxe.efi, "http://boot.ipxe.org/ipxe.efi" ] + - [ curl, -sSL, -o, /var/www/html/coreos_production_pxe.vmlinuz, "https://stable.release.flatcar-linux.net/amd64-usr/2605.12.0/flatcar_production_pxe.vmlinuz" ] + - [ curl, -sSL, -o, /var/www/html/coreos_production_pxe_image.cpio.gz, "https://stable.release.flatcar-linux.net/amd64-usr/2605.12.0/flatcar_production_pxe_image.cpio.gz" ] packages: - dnsmasq From b7ef25479ec9afe7a273d2e6d0acac4bdaef6670 Mon Sep 17 00:00:00 2001 From: Yusuke Suzuki Date: Thu, 18 Mar 2021 15:55:51 +0900 Subject: [PATCH 2/2] Expand SUDO_USER env variable Signed-off-by: Yusuke Suzuki --- v2/cmd/placemat2/sub/run.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2/cmd/placemat2/sub/run.go b/v2/cmd/placemat2/sub/run.go index d3400ee8..d09c483f 100644 --- a/v2/cmd/placemat2/sub/run.go +++ b/v2/cmd/placemat2/sub/run.go @@ -51,7 +51,7 @@ func run(yamls []string) error { if config.cacheDir == "" { if os.Getenv("SUDO_USER") != "" { - config.cacheDir = "/home/${SUDO_USER}/placemat_data" + config.cacheDir = os.ExpandEnv("/home/${SUDO_USER}/placemat_data") } else { config.cacheDir = config.dataDir }