-
Notifications
You must be signed in to change notification settings - Fork 4
docs: extend the unattended install docs #81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e78f3ce
22b1915
5ef7ad6
befba01
73097e6
2882511
8731ec0
67f4a5e
a56abc2
a9188b9
58bf760
4b96fba
3cf04be
bf5bcd7
b5e231f
af25bf5
c7b6b8a
6148d3a
c18e178
281807f
0c0b2f4
05b49a7
50bc5b7
80244c2
79bcbe5
f2c2f28
c6e17de
25c6928
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| --- | ||
| sidebar_position: 3 | ||
| sidebar_position: 4 | ||
| --- | ||
|
|
||
| # AutoYaST support | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| --- | ||
| sidebar_position: 3 | ||
| --- | ||
|
|
||
| # Writing a dynamic profile | ||
|
|
||
| It is not unusual that you need to write a profile that adapts dynamically to the underlying system. | ||
| For instance, you might want Agama to take some decisions depending on the hardware of the system | ||
| you are installing. | ||
|
|
||
| Fortunately, Jsonnet can work as a templating language and it offers many structures that allow | ||
| generating data. For that reason, Agama injects the hardware information that you can process using | ||
| the powerful [Jsonnet standard library](https://jsonnet.org/ref/stdlib.html). | ||
|
|
||
| You can access to the hardware information by importing the `hw.libsonnet` library, as you can see | ||
| in the example below. | ||
|
|
||
| ```jsonnet | ||
| // There are included also helpers to search this hardware tree. To see helpers check | ||
| // "/usr/share/agama-cli/agama.libsonnet" | ||
| local agama = import 'hw.libsonnet'; | ||
| // Find the biggest disk which is suitable for installing the system. | ||
| local findBiggestDisk(disks) = | ||
| local sizedDisks = std.filter(function(d) std.objectHas(d, 'size'), disks); | ||
| local sorted = std.sort(sizedDisks, function(x) -x.size); | ||
| sorted[0].logicalname; | ||
| // Find how much physical memory system has. | ||
| local memory = agama.findByID(agama.lshw, 'memory').size; | ||
| { | ||
| product: { | ||
| id: if memory < 8000000000 then 'MicroOS' else 'Tumbleweed', | ||
| }, | ||
| user: { | ||
| fullName: 'Jane Doe', | ||
| userName: 'jane.doe', | ||
| password: '123456', | ||
| }, | ||
| root: { | ||
| password: 'nots3cr3t', | ||
| sshPublicKey: '...', | ||
| }, | ||
| storage: { | ||
| boot: { | ||
| configure: true, | ||
| device: 'boot', | ||
| }, | ||
| drives: [ | ||
| { | ||
| search: findBiggestDisk(agama.selectByClass(agama.lshw, 'disk')), | ||
| alias: 'boot', | ||
| }, | ||
| ], | ||
| }, | ||
| } | ||
| ``` | ||
|
|
||
| Agama ships a few helpers to make it easier to search for the information you need from the hardware | ||
| tree. See | ||
| [agama.libsonnet](https://github.com/agama-project/agama/blob/master/rust/share/agama.libsonnet) for | ||
| further details. | ||
|
|
||
| :::tip Getting hardware information | ||
|
|
||
| You can inspect the available data by installing the `lshw` package and running the following | ||
| command: `lshw -json`. | ||
|
|
||
| ::: | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,118 +4,33 @@ sidebar_position: 2 | |
|
|
||
| # Unattended installation | ||
|
|
||
| One of the main use cases of Agama is unatteded installation. The user provides a file, known as a | ||
| "profile", that describes how the system should look like (partitioning, networking, software | ||
| selection, etc.) and Agama takes care of installing the system according to such a description. This | ||
| approach might sound familiar to AutoYaST users. | ||
| Agama is able to install a system without user interaction. The user provides a definition of the | ||
| system, known as a "profile", that describes how the system should look like (partitioning, | ||
| networking, software selection, etc.) and Agama takes care of installing the system. This approach | ||
| might sound familiar to AutoYaST users. | ||
|
|
||
| Although Agama defines its own [profile | ||
| format](https://github.com/openSUSE/agama/blob/master/rust/agama-lib/share/profile.schema.json), it | ||
| is able to partially handle AutoYaST profiles. Please, check the [AutoYaST support | ||
| section](./autoyast) for further information. | ||
| Agama uses [Jsonnet](https://jsonnet.org/), a superset of JSON, which allows writing readable and | ||
| concise profiles. The example below instructs Agama to install _Tumbleweed_ and create a first user | ||
| so you can log in. | ||
|
|
||
| ## Profile format | ||
|
|
||
| A profile defines which options to use during installation: which product to install, localization | ||
| settings, partitioning schema, etc. Although it sounds similar to AutoYaST, there are some essential | ||
| differences: | ||
|
|
||
| - Profiles are written in [Jsonnet](https://jsonnet.org/) instead of XML. Jsonnet is a superset of | ||
| JSON (so you can use just plain JSON), which allows for writing more readable and concise | ||
| profiles. | ||
| - You can take advantage of Jsonnet to build dynamic profiles, without having to rely on _rules_ or | ||
| _Embedded Ruby (ERB)_. Agama injects hardware information that can be processed using the [Jsonnet | ||
| standard library](https://jsonnet.org/ref/stdlib.html). | ||
|
|
||
| You can check the [Tumbleweed installation | ||
| profile](https://github.com/openSUSE/agama/blob/master/rust/agama-lib/share/examples/profile_tw.json) | ||
| included in the repository to get an impression of how a profile looks like. | ||
|
|
||
| ### A minimal example | ||
|
|
||
| ```json | ||
| ```jsonnet | ||
| { | ||
| "localization": { | ||
| "language": "en_US.UTF-8" | ||
| }, | ||
| "product": { | ||
| "id": "Tumbleweed" | ||
| product: { | ||
| id: "Tumbleweed" | ||
| }, | ||
| "user": { | ||
| "fullName": "Jane Doe", | ||
| "userName": "jane.doe", | ||
| "password": "123456" | ||
| user: { | ||
| fullName: "Jane Doe", | ||
| userName: "jane.doe", | ||
| password: "123456" | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The docs is fine but let me take this opportunity to show that while I am validating all the examples in this PR, I have found a bug in the recent users PR. The first object is what I paste in, the second one is agama output: cc153869b9da:/checkout # agama config generate -
{
user: {
fullName: "Jane Doe",
userName: "jane.doe",
password: "123456"
}
}
{
"user": {
"fullName": "Jane Doe",
"userName": "jane.doe"
}
}
✗ The profile is not valid. Please, check the following errors:
* "password" is a required property. /user
✗ Internal error: the profile was made invalid by InstallSettings round tripIncluding
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, I will check it. |
||
| } | ||
| } | ||
| ``` | ||
|
|
||
| ### Supported configuration values | ||
|
|
||
| Check the [JSON | ||
| Schema](https://github.com/openSUSE/agama/blob/master/rust/agama-lib/share/profile.schema.json) to | ||
| learn about the supported elements. | ||
|
|
||
| Some areas are relatively complex and just looking at the schema may not be enough to fully | ||
| understand how they work. That is definitely the case of the storage setup, that is described in its | ||
| own [separate section](./storage.md). | ||
|
|
||
| ### Dynamic profiles | ||
|
|
||
| The profile can be adapted at runtime depending on the system where the auto-installation is | ||
| running. For such use cases, Agama injects the hardware information into the profile to be processed | ||
| using Jsonnet. | ||
|
|
||
| Please, check [the example | ||
| profile](https://github.com/openSUSE/agama/blob/master/rust/agama-lib/share/examples/profile.jsonnet) | ||
| for further information. | ||
|
|
||
| :::tip Getting hardware information | ||
| You can inspect the available data by installing the `lshw` package and running the following | ||
| command: `lshw -json`. | ||
| ::: | ||
|
|
||
| ### Validating and evaluating a profile | ||
|
|
||
| Agama includes a handy command-line interface available in the `agama` package. Among many other | ||
| things, it allows downloading, validating and evaluating profiles. For instance, we could check the | ||
| result of the previous profile by running the following command: | ||
|
|
||
| ```console | ||
| sudo agama profile evaluate my-profile.jsonnet | ||
| ``` | ||
|
|
||
| :::warning Use `sudo` | ||
| You need to use `sudo` to access the hardware information. | ||
| ::: | ||
|
|
||
| Do you want to check whether your profile is valid? `agama` have you covered. Bear in mind that you | ||
| can only validate JSON profiles (a Jsonnet profile must be evaluated first). | ||
|
|
||
| ```console | ||
| agama profile validate my-profile.json | ||
| ``` | ||
|
|
||
| ### Generating a configuration file | ||
|
|
||
| Writing the profile by hand is relatively easy. However, you might want to ask Agama to do it for | ||
| you. You can boot the installation, use the web interface to tweak all the values and, from the | ||
| terminal, generate the file by running the following command: | ||
|
|
||
| ```console | ||
| sudo agama config show > profile.json | ||
| ``` | ||
|
|
||
| ## Starting the installation | ||
|
|
||
| To start an unattended installation process, you need to tell Agama where to find the profile. When | ||
| using the Live ISO, you must use the `inst.auto` boot option. Please, check the | ||
| [boot options](../boot_options/index.md) for further information. | ||
|
|
||
| If you do not specify any profile, Agama will automatically search for it in a few predefined | ||
| locations. Agama expects a file named `autoinst.jsonnet`, `autoinst.json` or `autoinst.xml` (in that | ||
| order) to be located on: | ||
|
|
||
| - The root of a file system named `OEMDRV`. | ||
| - Or the root (`/`) of the installation environment. | ||
| It is possible to define the storage layout, which software to install, the network configuration, | ||
| etc. Check the [profile format](./unattended/profile) section to learn more. Once you have your | ||
| first profile, you might want to learn how to | ||
| [start the installation](./unattended/working-with-profiles#starting-the-installation). | ||
|
|
||
| The first file found is used as the profile, starting the installation right away. | ||
| Finally, it is worth to mention that although Agama defines its own profile format, it is able to | ||
| partially handle AutoYaST profiles. Please, check the | ||
| [AutoYaST support section](./unattended/autoyast) for further information. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| sidebar_position: 11 | ||
| --- | ||
|
|
||
| # Bootloader configuration | ||
|
|
||
| Agama offers a reduced set of settings to change the bootloader configuration, although it is able | ||
| to set it up correctly in many situations and architectures. | ||
|
|
||
| These options are defined in the `bootloader` section. | ||
|
|
||
| - `stopOnBootMenu`: stop on the menu instead of booting the system automatically. | ||
| - `timeout`: specify how many seconds the bootloader should wait on the menu before booting the | ||
| default entry. Unlike AutoYaST, the timeout should be a positive number. If you want the | ||
| bootloader to stop indefinitely, just set `stopOnBootMenu` to `true`. | ||
| - `extraKernelParams`: additional kernel parameters. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. maybe I would explain here that if there is need for specific kernel parameter for kernel already for installation, then it will be reused in proposal. So it is mainly for parameters that are only for installed system and not installation.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I did not get it, sorry. |
||
|
|
||
| ``` | ||
| { | ||
| bootloader: { | ||
| stopOnBootMenu: true, | ||
| extraKernelParams: "processor.max_cstate=1" | ||
| } | ||
| } | ||
| ``` | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,71 @@ | ||
| --- | ||
| sidebar_position: 7 | ||
| --- | ||
|
|
||
| # Copying files | ||
|
|
||
| In many cases, you might need to copy some files to the installed system. This feature is especially | ||
| useful when you want to tweak your system configuration (for instance, dropping a file to | ||
| `/etc/sysctl.d`), but it can be used in other situations too. | ||
|
|
||
| ## File properties | ||
|
|
||
| Agama provides a `files` key where you can define the source (the content or an URL to fetch the | ||
| file from), the permissions, the owner and the destination of the file. | ||
|
|
||
| - `content`: the content of the file. | ||
| - `url`: alternatively to the `content`, you can define a URL to fetch the file from. The files are | ||
| downloaded and written to the disk at the end of the installation. In addition to the | ||
| [supported URLs](../../urls) you can use a URL relative to the profile (e.g., "/motd"). | ||
| - `destination`: the location of the file in the installed system. | ||
| - `permissions`: a string describing the file permissions in numeric mode (e.g.: `"0640"`). By | ||
| default it is set to `"0644"`). | ||
| - `user`: user owner of the file (`"root"` by default). | ||
| - `group`: group owner of the file (`"root"` by default). | ||
|
|
||
| :::note Working with relative URLs | ||
|
|
||
| If you use the `inst.auto` boot option to specify the URL of the profile, any relative URL will use | ||
| the URL of the profile as its base. | ||
|
|
||
| However, loading the profile using the `agama config load` will not work in the same way. | ||
| Check the [Manually loading a profile](../working-with-profiles#manually-loading-a-profile) section | ||
| for further information. | ||
|
|
||
| ::: | ||
|
|
||
| ## Example | ||
|
|
||
| The example below adds a welcome message to the system and registers a new user by deploying a file | ||
| in `/etc/issue.d`: | ||
|
|
||
| ```jsonnet | ||
| { | ||
| files: [ | ||
| { | ||
| url: "/motd", | ||
| destination: "/etc/issue.d/welcome.issue", | ||
| permissions: "0644", | ||
| }, | ||
| { | ||
| destination: "/etc/sysusers.d/myapp.conf", | ||
| content: ||| | ||
| # Type Name ID GECOS Home | ||
| u myapp - "My Application" /var/lib/myapp | ||
| ||| | ||
| } | ||
| ] | ||
| } | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. JFYI, the InstallSettings round trip makes the remaining attributes explicit: cc153869b9da:/checkout # agama config generate -
{
files: [
{
url: "/motd",
destination: "/etc/issue.d/welcome.issue",
permissions: "0644",
},
{
destination: "/etc/sysusers.d/myapp.conf",
content: |||
# Type Name ID GECOS Home
u myapp - "My Application" /var/lib/myapp
|||
}
]
}
{
"files": [
{
"url": "file:///motd",
"permissions": "0644",
"user": "root",
"group": "root",
"destination": "/etc/issue.d/welcome.issue"
},
{
"content": "# Type Name ID GECOS Home\nu myapp - \"My Application\" /var/lib/myapp\n",
"permissions": "0644",
"user": "root",
"group": "root",
"destination": "/etc/sysusers.d/myapp.conf"
}
]
}
✓ The profile is valid.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Which is wrong, although out of scope. We have the same problem in several places. |
||
| ``` | ||
|
|
||
| ## Binary files | ||
|
|
||
| Although the intention is to work with text files, Agama does not impose any limitation of the kind | ||
| of files you can deploy. So using a URL to a binary file should work too. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I was curious so I checked: not even Jsonnet can represent binary data, which makes sense once you realize it needs a JSON representation. |
||
|
|
||
| :::note Generating a file using a script | ||
|
|
||
| Unlike AutoYaST, Agama does not allow to generate the file using an script. For that use case, you | ||
| might use the [scripts](./scripts) section. | ||
|
|
||
| ::: | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
JFYI, with
/testing_using_container.sh, this fails because there are no disks, and we may want to improve the error formatting: