elemental icon indicating copy to clipboard operation
elemental copied to clipboard

Add interactive default behavior for elemental-installer

Open kleberbaum opened this issue 3 years ago • 0 comments

https://github.com/rancher-sandbox/os2/blob/304725eef5c0d6a47d53cd48ca899394668fa57a/docs/installation.md?plain=#L75-L78

Since v0.1.0-alpha17 the default behavior of ros-installer is less Interactive.

Default behavior in v0.1.0-alpha16:

rancher-2177:~ # ros-installer
Configure system using an cloud-config file? [y/N]: N
Authorize GitHub users to root SSH? [y/N]: y
Comma separated list of GitHub users to authorize: kleberbaum
Please enter password for [root]:
Not setting password, leaving root disabled
Run as server or agent (Choose none if building an image)?
1. server
2. agent
3. none
Select Number [1]: 1
Token or cluster secret (optional):

Configuration
-------------

device: /dev/sda

Your disk will be formatted and installed with the above configuration.
Continue? [y/N]: y

The result a working k3s with configured ssh-keys:

rancher-17811:~ # cat /oem/99_custom.yaml
rancherd:
  role: server
stages:
  network:
  - users:
      root:
        name: root
        ssh_authorized_keys:
        - github:kleberbaum
rancher-17811:~ # k3s --version
k3s version v1.23.6+k3s1 (418c3fa8)
go version go1.17.5
rancher-17811:~ # kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.6+k3s1", GitCommit:"418c3fa858b69b12b9cefbcff0526f666a6236b9", GitTreeState:"clean", BuildDate:"2022-04-28T22:16:18Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.6+k3s1", GitCommit:"418c3fa858b69b12b9cefbcff0526f666a6236b9", GitTreeState:"clean", BuildDate:"2022-04-28T22:16:18Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}

image

Default behavior in v0.1.0:

localhost:~ # ros-installer

Configuration
-------------

config_url: /oem/userdata
device: /dev/sda

Your disk will be formatted and installed with the above configuration.
Continue? [y/N]: y

Results in an installation without root password (pw: ros not working):

root@nyx ~# ssh [email protected]
The authenticity of host '89.58.18.155 (89.58.18.155)' can't be established.
ED25519 key fingerprint is SHA256:q2smElaCTu+qVP0jwXydrqf/+KUjO6OwP4jpFMZ69tk.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '89.58.18.155' (ED25519) to the list of known hosts.
([email protected]) Password:
([email protected]) Password:
([email protected]) Password:
Received disconnect from 89.58.18.155 port 22:2: Too many authentication failures
Disconnected from 89.58.18.155 port 22

Behavior in v0.1.0 with ros-installer -config-file:

#cloud-config
rancherd:
  # The role of this node.  Every cluster must start with one node as role=cluster-init.
  # After that nodes can be joined using the server role for control-plane nodes and
  # agent role for worker only nodes.  The server/agent terms correspond to the server/agent
  # terms in k3s and RKE2
  role: server

# Assigns these keys to the first user in users or root if there
# is none
ssh_authorized_keys:
  - github:kleberbaum
localhost:~ # ros-installer -config-file https://gist.githubusercontent.com/kleberbaum/04ebf13ed040085cdea52fc99d38c970/raw/82474598368e9f4e6113fe45ad2346caee2f5ba4/ros.yaml

Configuration
-------------

config_url: https://gist.githubusercontent.com/kleberbaum/04ebf13ed040085cdea52fc99d38c970/raw/82474598368e9f4e6113fe45ad2346caee2f5ba4/ros.yaml
device: /dev/sda

Your disk will be formatted and installed with the above configuration.
Continue? [y/N]: y

v0.1.0 with working k3s and configured ssh-keys:

v220220537161189606:~ # cat /oem/99_custom.yaml
#cloud-config
rancherd:
  role: server
rancheros: {}
ssh_authorized_keys:
- github:kleberbaum
v220220537161189606:~ # k3s --version
k3s version v1.23.6+k3s1 (418c3fa8)
go version go1.17.5
v220220537161189606:~ # kubectl version
Client Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.6+k3s1", GitCommit:"418c3fa858b69b12b9cefbcff0526f666a6236b9", GitTreeState:"clean", BuildDate:"2022-04-28T22:16:18Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}
Server Version: version.Info{Major:"1", Minor:"23", GitVersion:"v1.23.6+k3s1", GitCommit:"418c3fa858b69b12b9cefbcff0526f666a6236b9", GitTreeState:"clean", BuildDate:"2022-04-28T22:16:18Z", GoVersion:"go1.17.5", Compiler:"gc", Platform:"linux/amd64"}

image

kleberbaum avatar May 10 '22 21:05 kleberbaum