[Solved]Setup after install

Antworten
M4t
Beiträge: 9
Registriert: 24 Mai 2022, 14:48

[Solved]Setup after install

Beitrag von M4t »

Hello,

I'm a new user of opsi, I managed to install this great software on a Rocky Linux 8 VM and I'm reading the full documentation and quick start guide while testing the features.

I see in opsi-configed that there are options for opsi-agent called "setup_after_install" and "sytray_install" that I would like to use when deploying the agent for the first time but I can't find any settings for oca-installation-helper or for the install.conf file .

Is there an appropriate way to install "systray" on the first deployment and have a list of packages scheduled for installation right after the deployment?

thanks in advance for your answers
Zuletzt geändert von M4t am 13 Jun 2022, 11:00, insgesamt 1-mal geändert.
Opsi 4.2 - Rocky Linux 8
Benutzeravatar
j.schneider
uib-Team
Beiträge: 1595
Registriert: 29 Mai 2008, 15:14

Re: Setup after install

Beitrag von j.schneider »

Hello,

you can set the product properties "setup_after_install" and "sytray_install" to any value (global or client-specific) via opsi configed.
The product properties are also used during the initial deployment.

Despite using setup_after_install, you can also simply set some packages to "installed" or "setup".
These packages will then be installed after the installation of the opsi client agent.

Regards,
Jan Schneider
M4t
Beiträge: 9
Registriert: 24 Mai 2022, 14:48

Re: Setup after install

Beitrag von M4t »

Hello,

thank you for your answer, it does work.

The reason why I would like to use the command line argument or the "install.conf" trick is that I would like to manage different bundles of packages right after the first deployment ( ex: corporate bundle, school bundle, core bundle, etc ..) with different software depending on the destination of the computer.

When we configure the deployment of our OS (not opsi), we choose the software that will be installed afterwards, so we would like to be able to install the agent with different arguments.

Maybe I'm not looking at it from the right angle to do this with opsi.
Opsi 4.2 - Rocky Linux 8
Benutzeravatar
j.schneider
uib-Team
Beiträge: 1595
Registriert: 29 Mai 2008, 15:14

Re: Setup after install

Beitrag von j.schneider »

Okay, I understand.
One thing that could help is that, with the latest opsi-client-agents, you can put your client into a host group during installation.

Code: Alles auswählen

# install.conf
[install]
group = some_group
Unfortunately, there is currently no possibility to assign packages to host groups.
But you could use this information in a meta package to decide which packages should be set to setup.
M4t
Beiträge: 9
Registriert: 24 Mai 2022, 14:48

Re: Setup after install

Beitrag von M4t »

Thanks again,

I was wondering if we can assign packages to a host group but no.
But you could use this information in a meta package to decide which packages should be set to setup.
Are you telling that we can put conditions in a meta-package ?

So that meta-packages are all setted up at global level and each will be installed if condition is right ?

If [client] is in [school-deploy] group then install

or something like that ?
Opsi 4.2 - Rocky Linux 8
Benutzeravatar
j.schneider
uib-Team
Beiträge: 1595
Registriert: 29 Mai 2008, 15:14

Re: Setup after install

Beitrag von j.schneider »

Yes, unfortunately, you can't currently assign packages to a host group.

You could create a package "master" and in the setup.opsiscript, something like (uncomplete and untested):

Code: Alles auswählen

[Actions]
DefVar $ProductId$
DefStringList $TempList$

Set $ProductId$ = "core_bundle"
Set $TempList$ = GetReturnListFromSection("OpsiServiceCall_getClientGroupIdents")

; Some processing of $TempList$
if ...
	Set $ProductId$ = "school_bundle"
endif

OpsiServiceCall_setProductActionRequestWithDependencies


[OpsiServiceCall_getClientGroupIdents]
	"method": "objectToGroup_getIdents",
	"params": [
    		"str",
    		{"groupType": "HostGroup","objectId": "%HostID%"}
	]

[OpsiServiceCall_setProductActionRequestWithDependencies]
	"method": "setProductActionRequestWithDependencies"
	"params": [
		"$ProductId$",
		"%HostID%",
		"setup"
	]
M4t
Beiträge: 9
Registriert: 24 Mai 2022, 14:48

Re: Setup after install

Beitrag von M4t »

wow! you rock!

I need to dig deeper into opsi-scripting but with your example it will be easier to get started.

Thanks so much for your time, I'll report back when I've done my testing.

bye
Opsi 4.2 - Rocky Linux 8
M4t
Beiträge: 9
Registriert: 24 Mai 2022, 14:48

Re: Setup after install

Beitrag von M4t »

Hello,

I managed to get it working with your helpfull example.

here is the full script (I am aware that some things could have been written more simply):

Code: Alles auswählen

[Actions]
DefVar $ProductId$
DefStringList $TempList$
DefVar $GrpStr$
Set $ProductId$ = "core_bundle"
Set $TempList$ = GetReturnListFromSection("OpsiServiceCall_getClientGroupIdents")
Set $GrpStr$ = takestring(0, $TempList$)
Set $GrpStr$ = stringReplace($GrpStr$,";%HostID%","")
Set $GrpStr$ = stringReplace($GrpStr$,"HostGroup;","")
set $GrpStr$ = unquote2($GrpStr$,"[]")
set $GrpStr$ = unquote2($GrpStr$,'""')
message "Ce PC fait parti du groupe " + $GrpStr$
; Some processing of $TempList$
Switch $GrpStr$
	Case "deploy_mairie"
		set $ProductId$ = "mairie_bundle"
	EndCase
	Case "deploy_school"
		set $ProductId$ = "school_bundle"
	EndCase
EndSwitch

OpsiServiceCall_setProductActionRequestWithDependencies
ExitWindows /Reboot

[OpsiServiceCall_getClientGroupIdents]
	"method": "objectToGroup_getIdents",
	"params": [
    		"str",
    		'{"groupType": "HostGroup","objectId": "%HostID%"}'
	]

[OpsiServiceCall_setProductActionRequestWithDependencies]
	"method": "setProductActionRequestWithDependencies"
	"params": [
		"$ProductId$",
		"%HostID%",
		"setup"
	]
the additional question is:

Is it possible to run the installation of configured products directly and immediatly (like "on demand" Action from "configed") from the script instead of asking for a reboot?
Opsi 4.2 - Rocky Linux 8
Antworten