通過puppet批量自動安裝軟件

通過puppet安裝軟件。以安裝shotgun_desktop軟件爲例:


1、在 ../puppet/manifests/Workstation.pp 配置文件裏添加以下代碼:

  # install shotgun_desktop
   package{'shotgun_desktop':
   }->
   exec{'rm libQt':
       command => "/usr/bin/rm -rf /opt/Shotgun/Qt/lib/",
   }
   file{'/usr/lib64/libffi.so.5':
       ensure => link,
       target => "/usr/lib64/libffi.so.6",
   }
   file{'/etc/profile.d/shotgun_desktop.sh':
       source => "$svn_files/etc/profile.d/shotgun_desktop.sh",
   }
   file{'/usr/share/applications/shotgun.desktop':
       source => "$svn_files/usr/share/applications/shotgun.desktop",
   }
   file{'/opt/Shotgun/shotgun.png':
       source => "$svn_files/usr/share/shotgun/shotgun.png",   #快捷方式圖標
   }


2、 添加桌面程序 $svn_files/usr/share/applications/shotgun.desktop

 #Managed by puppet
 [Desktop Entry]
 Name=Shotgun
 Version=0.18.55 
 Type=Application
 Categories=GNOME;
 Exec=/opt/Shotgun/Shotgun 
 Terminal=false
 StartupNotify=true
 Icon=/opt/Shotgun/shotgun.png


3、添加環境變量

 #!/bin/sh
 export SGTK_DESKTOP_STARTUP_LOCATION=/opt/Shotgun/Resources/Python/tk-framework-desktopstartup


4、添加程序快捷方式圖標到桌面

$svn_files/usr/local/bin/desktop-shotcut.bash 
 
ln -s /usr/share/applications/shotgun.desktop $XDG_DESKTOP_DIR/shotgun.desktop


這樣就可以像在window一樣,單擊桌面上的快捷方式打開程序了。


如果在mac裏安裝軟件,則需要.pkg文件。一般下載的都是.msg的文件。

需要先把msg 的包解壓成.pkg的包,然後複製到 ../puppet/files/Darwin_16_x86_64/Packages  目錄下

1、在 ../puppet/manifests/Darwin.pp 文件裏添加以下代碼: 

#install shotgun
 exec{ 'Install shotgun':
   command => "/usr/sbin/installer -pkg $puppet_files/Packages/Shotgun_Desktop.pkg  -target /",
   creates => '/Applications/Shotgun.app/Contents/'
 }

2、直接在Applications裏找到shotgun的圖標,雙擊打開。

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章