4.4. Adding users and groups to an Image Builder blueprint in the web console interface
- A blueprint must exist.
- A CLI text editor such as
emacsmust be installed. To install them:
yum install editor-name
composer-cli blueprints save BLUEPRINT-NAME
- i. For every user to be added, add this block to the file:
[[customization.user]] name = "USER-NAME" description = "USER-DESCRIPTION" password = "PASSWORD-HASH" key = "ssh-rsa (...) key-name" home = "/home/USER-NAME/" shell = "/usr/bin/bash" groups = ["users", "wheel"] uid = NUMBER gid = NUMBERReplace PASSWORD-HASH with the actual password hash. To generate the hash, use a command such as this:
python3 -c 'import crypt,getpass;pw=getpass.getpass();print(crypt.crypt(pw) if (pw==getpass.getpass("Confirm: ")) else exit())'Replace ssh-rsa (…) key-name with the actual public key.Replace the other placeholders with suitable values.Leave out any of the lines as needed, only the user name is required.
- ii. For every user group to be added, add this block to the file:
[[customizations.group]] name = "GROUP-NAME" gid = NUMBERiii. Increase the version number.iv. Save the file and close the editor.
- 6. Import the blueprint back into Image Builder:
composer-cli blueprints push BLUEPRINT-NAME.tomlNote that you must supply the file name including the
.tomlextension, while in other commands you use only the name of the blueprint.
- 7. To verify that the contents uploaded to Image Builder match your edits, list the contents of blueprint:
composer-cli blueprints show BLUEPRINT-NAMECheck if the version matches what you put in the file and if your customizations are present.
ImportantThe Image Builder plug-in for RHEL 7 web console does not show any information that could be used to verify that the changes have been applied, unless you edited also the packages included in the blueprint.
- 8. Exit the privileged shell:
- 9. Open the Image Builder (Image builder) tab on the left and refresh the page, in all browsers and all tabs where it was opened.This prevents state cached in the loaded page from accidentally reverting your changes.