I created a script that permit to **control opsi package** installation **through command line** (I don't like that much GUI and Java of "opsi config editor").\\
The script permits too to **handle host group** and **product group**, a thing that "opsi config editor" does not manage well I think.
The script is on github: wget https://raw.github.com/souch/opsi-misc/master/opsi-pkg and will be update/debug while I'll use it.
**The script always ask before modifying something** on OPSI (except when using --yes switches). And it warn and propose default action if something seems strange/not useful. So anyone can test it without too much risks :-)
Output of the usage helper:
$ opsi-pkg
usage: opsi-pkg [--help] [--quiet] [--verbose] [--debug] [--default] [--yes]
[--no] [--force] [--fire] [--ping] [--list] [--add] [--delete]
[--call [CALL [CALL ...]]]
[--request {setup,uninstall,once,update,custom,userLogin,always,none}]
[--setup] [--uninstall] [--host [HOST [HOST ...]]]
[--package [PACKAGE [PACKAGE ...]]]
[--host-group [HOST_GROUP [HOST_GROUP ...]]]
[--package-group [PACKAGE_GROUP [PACKAGE_GROUP ...]]]
simple opsi package manager interface
optional arguments:
--help show this help message and exit
--quiet, -q do not print info log
--verbose, -v print more log
--debug print even more log
--default answer default answer to every question
--yes, -y answer yes to every question
--no answer no to every question
--force, -f force doing action that does seems to be needed. e.g. install a package on a host that has already the last package installed.
--fire Fire the request now (i.e. push the request to the hosts).
--ping show hosts status (on/off)
--list, -l List something. Combine it with: -h, -p, -h -p, -hg, -pg.
--add, -a Add something. Combine it with: -hg, -pg, -hg -h, -pg -p
--delete, -d Delete something. Combine it with: -hg, -pg, -hg -h, -pg -p.
--call, -c {shutdown, reboot, wakeup, delete, fire, popup "message"}
Launch action (push it to hosts). Combine it with: -h, -hg
--request, -r {setup, uninstall, once, update, custom, userLogin, always}
Set next action (pulled by hosts) on given hosts and packages. Combine it with: -h, -hg, -p, -pg, --fire.
--setup, -s Shortcut for "-request setup".
--uninstall, -u Shortcut for "-request uninstall".
--host [HOST [HOST ...]], -h [HOST [HOST ...]]
Do sthg with host. No host given means every hosts.)
--package [PACKAGE [PACKAGE ...]], -p [PACKAGE [PACKAGE ...]]
Do sthg with package. No package given means every packages.
--host-group [HOST_GROUP [HOST_GROUP ...]], -hg [HOST_GROUP [HOST_GROUP ...]]
Do sthg with host group
--package-group [PACKAGE_GROUP [PACKAGE_GROUP ...]], -pg [PACKAGE_GROUP [PACKAGE_GROUP ...]]
Do sthg with package group
=========
Examples:
# list every packages
opsi-pkg -l -p
# list every hosts and show their up status
opsi-pkg -l -h --ping
-
# list installed packages on every computer
opsi-pkg -l -p -h
# list installed packages on tata computer
opsi-pkg -l -p -h tata
# list package font on every computer
opsi-pkg -l -p font -h
# list packages font and office on tata and titi computers
opsi-pkg -l -p font office -h tata titi
-
# list host groups
opsi-pkg -l -hg
# create an host group "pc" without asking it
opsi-pkg -a -hg pc 'all desktop pc' -y
# create an host group "chicago" and wich has for parent 'pc' host group
opsi-pkg -a -hg chicago 'chicago network' pc
# add to host group "pc" the machines "tata, toto, and titi"
opsi-pkg -a -hg pc -h tata toto titi
# add to host group "pc" every machines of OPSI
opsi-pkg -a -hg pc -h
# delete host titi from host group "pc"
opsi-pkg -d -hg pc -h titi
# delete host group "pc"
opsi-pkg -d -hg pc
# list package groups
opsi-pkg -l -pg
# create a package group "base"
opsi-pkg -a -pg base 'default program'
-
# call 'hello' popup on each computer that belongs to 'pc' host group
opsi-pkg -c popup 'hello' -hg pc
# delete host tutu from OPSI
opsi-pkg -c delete -h tutu
-
# install firefox on computer tata
opsi-pkg -r setup -p firefox -h tata
# install firefox on computers that belongs to 'pc' host group even if it is
# already install and up-to-date and push the setup now
opsi-pkg -s -p firefox -hg pc --force --fire
# install firefox on computers that belongs to 'pc' host group
opsi-pkg -s -p firefox -hg pc
# install base packages on computers that belongs to 'pc' host group
opsi-pkg -s -pg base -hg pc
# uninstall firefox on computers that belongs to 'pc' host group
opsi-pkg -u -p firefox -hg pc
# reset request on package firefox of the computer tata
opsi-pkg -r none -p firefox -h tata
======
Notes:
OPSI cannot have same name in product group and host group
Output of list host (there are colors when using it for real).
# opsi-pkg --list --host --ping
host ip up lastSeen since mac
titi 10.0.0.104 off 2013-04-12 06:58:54 5 d
tata 10.0.0.200 on 2013-04-12 08:58:24 5 d
toto 10.0.0.170 off 2013-03-25 12:49:26 23 d 00:21:72:79:2b:80
tutu 10.0.0.64 off 2013-02-28 09:19:50 300d