User Tools

Site Tools


userspace:opsi-pkg

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

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" 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). So anyone can test it without too much risks :-) 
- 
-Output of the usage helper: 
-<code> 
-$ opsi-pkg 
-usage: opsi-pkg [--help] [--quiet] [--verbose] [--debug] [--default] [--yes] 
-                [--no] [--force] [--ping] [--list] [--add] [--delete] 
-  --call {shutdown, reboot, wakeup, delete, fire, popup "message"} [-h ...] 
-                [--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. 
-  --ping                show host 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 {shutdown, reboot, wakeup, delete, fire, popup "message"} [-h ...] 
-                        Call an action on given hosts. Combine it with: -hg, -h. 
-  --setup, -s           Install products on given hosts. Combine it with: -h, -p. 
-  --uninstall, -u       Uninstall products on given hosts. Combine it with: -h, -p. 
-  --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 "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 -s -p firefox -h tata 
- 
-# install firefox on computers that belongs to 'pc' host group even if it is  
-# already install and up-to-date 
-opsi-pkg -s -p firefox -hg pc --force 
- 
-# 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 
- 
-====== 
-Notes: 
-  OPSI cannot have same name in product group and host group 
-</code> 
- 
-Output of list host (there are colors when using it for real). 
-<code> 
- # opsi-pkg --list --host --ping 
-host                            ip             up    lastSeen              since   mac 
- 
-titi                            10.0.0.104     off   2013-04-12 06:58:54    d     
-tata                            10.0.0.200     on    2013-04-12 08:58:24    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     
-</code> 
userspace/opsi-pkg.txt ยท Last modified: 2021/08/23 08:37 (external edit)