This shows you the differences between two versions of the page.
userspace:opsi-pkg [2013/04/17 13:54] phimeca add force mode |
userspace:opsi-pkg [2021/08/23 08:37] |
||
---|---|---|---|
Line 1: | Line 1: | ||
- | 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" | ||
- | The script is on github: wget https:// | ||
- | |||
- | **The script always ask before modifying something** on OPSI (except when using --yes switches). 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] [--ping] [--list] [--add] [--delete] | ||
- | --call {shutdown, reboot, wakeup, delete, fire, popup " | ||
- | [--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 | ||
- | --quiet, -q do not print info log | ||
- | --verbose, -v print more log | ||
- | --debug | ||
- | --default | ||
- | --yes, -y | ||
- | --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. | ||
- | --ping | ||
- | --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 {shutdown, reboot, wakeup, delete, fire, popup " | ||
- | Call an action on given hosts. Combine it with: -hg, -h. | ||
- | --setup, -s | ||
- | --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 tata computer | ||
- | opsi-pkg -l -p -h tata | ||
- | |||
- | # list installed packages on every computer | ||
- | opsi-pkg -l -p -h | ||
- | |||
- | - | ||
- | |||
- | # list host groups | ||
- | opsi-pkg -l -hg | ||
- | |||
- | # create an host group " | ||
- | opsi-pkg -a -hg pc 'all desktop pc' -y | ||
- | |||
- | # create an host group " | ||
- | opsi-pkg -a -hg chicago ' | ||
- | |||
- | # add to host group " | ||
- | opsi-pkg -a -hg pc -h tata toto titi | ||
- | |||
- | # add to host group " | ||
- | opsi-pkg -a -hg pc -h | ||
- | |||
- | # delete host titi from host group " | ||
- | opsi-pkg -d -hg pc -h titi | ||
- | |||
- | # delete host group " | ||
- | opsi-pkg -d -hg pc | ||
- | |||
- | # list package groups | ||
- | opsi-pkg -l -pg | ||
- | |||
- | # create a package group " | ||
- | opsi-pkg -a -pg base ' | ||
- | |||
- | - | ||
- | |||
- | # call ' | ||
- | opsi-pkg -c popup ' | ||
- | |||
- | # delete host tutu from OPSI | ||
- | opsi-pkg -c delete -h tutu | ||
- | |||
- | # install firefox on computer tata | ||
- | opsi-pkg -s -p firefox -h tata | ||
- | |||
- | # install firefox on computers that belongs to ' | ||
- | # already install and up-to-date | ||
- | opsi-pkg -s -p firefox -hg pc --force | ||
- | |||
- | # install firefox on computers that belongs to ' | ||
- | opsi-pkg -s -p firefox -hg pc | ||
- | |||
- | # install base packages on computers that belongs to ' | ||
- | opsi-pkg -s -pg base -hg pc | ||
- | |||
- | ====== | ||
- | 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 | ||
- | |||
- | titi 10.0.0.104 | ||
- | tata 10.0.0.200 | ||
- | toto 10.0.0.170 | ||
- | tutu 10.0.0.64 | ||
- | </ |