簡體   English   中英

在使用 Ansible 配置 azure vm 時安裝軟件

[英]Install Software's while provisioning azure vm using Ansible

I am trying to Create a azure windows VM using ansible and while doing so i would like to install jfrog cli or run a powershell script which can do it.

我有一本可以創建 vm、創建 vm 擴展並從中創建圖像的劇本。 但在創建映像之前,我不知道如何在該虛擬機中安裝軟件。

If you are working on azure windows VMs at your work, you can package your applications which are in .exe and.msi format into chocolatey.nupkg format and host a chocolatey nuget-hosted repo in the artifacts storage application like nexus where you can push稍后使用win_chocolatey ansible 模塊獲取並安裝要在這些 VM 中安裝的這些Chocolatey.nupkg 包

安裝巧克力 package 的示例任務:

- name: "chocolatey task: install packages from internal choco nuget-hosted nexus repo"
  win_chocolatey:
    name: "{{ item.name }}"
    version: "{{ item.version }}"
  loop:
    - { name: 'jdk8', version: '8.0.162' }
    - { name: 'msbuildtools', version: '2.0.1.5' }
    - { name: 'SevenZip', version: '9.2' }

win_chocolatey ansible module: https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html

什么是巧克力味?

Is is a framework to package applications which are in .exe or .msi formats into .nupkg
(nuget packages) which will have a installation script within the package and 
when you run choco commands to install a certain application, it either get
chocolatey packages from opensource chocolatey gallery or for organization 
purpose you might want to create custom package for network and security reasons.

Chocolatey 文檔: https://chocolatey.org/why-chocolatey

如何創建自定義/離線巧克力包? https://chocolatey.org/docs/how-to-create-custom-package-templates

基本 Chocolatey 命令:

choco install <package-name> --version <version> -y --> 默認從https://chocolatey.org/api/v2/獲取 choco 包

choco uninstall <package-name> -y --> 卸載 package。 如果安裝了多個版本的 package,也可以使用 --version 選項

choco source add -n=<AnyName> -s="<URL-Internal-choco-repo>" --> 在 windows 機器上將內部巧克力 nuget 托管的 nexus 存儲庫添加到巧克力源

choco source list --> 列出它獲取包的所有添加源

choco source remove -n="<NameOfSource>" --> 刪除所有巧克力來源列表的任何來源

Chocolatey 命令: https://github.com/chocolatey/choco/wiki/CommandsSources

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM