Ansible Remote Installation in Windows Server R2 vcredist (2008 2010 2012 2013)

Source: Internet
Author: User

Demand:

Remotely installs Vcredist 2008, 2010, 2012, and 20,134 versions on Windows Server R2.


First in the official documents of the ansible to find out if there is a suitable module directly can be used.

The first thing to find is the Win_package module: http://docs.ansible.com/ansible/win_package_module.html , and see the example it gives.

650) this.width=650; "src="/e/u261/themes/default/images/spacer.gif "style=" Background:url ("/e/u261/lang/zh-cn/ Images/localimage.png ") no-repeat center;border:1px solid #ddd;" alt= "Spacer.gif"/>

The feeling can be directly brought to use AH. Would you like to replace the path path with the local path of the exe you want to install?

It was later found that the product_id in Win_package was necessary, but these product_id were not available until the system was installed vcredist. Try to manually install the four Vcredist version on the system before you go to the registry to find product_id. And then wrote product_id into the Ansible-playbook, yes, and finally failed.

Well, you can only find another way, try to use the PowerShell script implementation.


In the beginning, the script to test the installation of vcredits2008 is this:

Vcredist_2008.ps1

$pathvargs _2008 = {c:\tmp\vcredist2008_x64.exe/s/v/qn}

Invoke-command-scriptblock $pathvargs _2008


Then the Ansible-playbook script is like this:

WIN_SHELL.YML:

----Name:run Win_shell hosts:ec2_windows gather_facts:false tasks:-Name:install Mp\vcredist_2008.ps1


Ansible-playbook win_shell.yml execution, found incredibly successful.


Leaf out, click the other three versions of the script, changed the name of the installation package, I thought it would be.

Later, it was found that the version of vcredist2010 is always not installed. Manual installation comparison, the software at the time of installation, 2010 hints of information and the remaining three versions of a little difference, should be in the PowerShell script parameters are not the same.

Well, keep looking for reasons on the Internet.

Finally found a useful article: "mailbag:how to perform a silent install of the Visual C + + redistributable packages"https: blogs.msdn.microsoft.com/astebner/2010/10/20/ Mailbag-how-to-perform-a-silent-install-of-the-visual-c-2010-redistributable-packages/


It turned out that the answer I was looking for was lying on Microsoft's official web. The article mentions Silent Install, unattended Install, Silent repair, Silent uninstall. In four ways, what I'm looking for now is the unattended Install mode, which doesn't require manual interaction. Copy and paste the parameters immediately to use.


So now the VCREDIST_2010.PS1 command has become this:

$pathvargs _2010 = {C:\tmp\vcredist2010_x64.exe/passive/norestart}

Invoke-command-scriptblock $pathvargs _2010


It's the 2010 version. The script is different, the others are the same.


The final Ansible-playbook is this:

Vim Win_shell.yml:

---

-Name:run Win_shell

Hosts:ec2_windows

Gather_facts:false

Tasks

-Name:install 2013 ...

Win_shell:c:\tmp\vcredist_2013.ps1

-Name:install 2008 ...

Win_shell:c:\tmp\vcredist_2008.ps1

-Name:install 2012

Win_shell:c:\tmp\vcredist_2012.ps1

-Name:install 2010 ...

Win_shell:c:\tmp\vcredist_2010.ps1


Test:

Uninstall the previously installed vcredist on the server before running Ansible-playbook win_shell.yml.

I waited silently for the result and finally saw four successful hints. Then, on the server R2 servers, review the registry, and the four versions of Vcredist are installed successfully.


This article is from the "dayandnight" blog, make sure to keep this source http://hellocjq.blog.51cto.com/11336969/1923528

Ansible Remote Installation in Windows Server R2 vcredist (2008 2010 2012 2013)

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.