Monday 15 March 2010

Need to copy a file via puppet only if a Windows MSI package is not installed -


I am new to Windows using the puppet. I try to install MSI package from the shared folder on my network But for permissions, the shared folder is only "read", there are no "execution" permissions in it, so when the puppet agent runs and tries to install MS, it fails.

What do I have to do, just copy the MSI installer into a local directory if the package is to be installed.

How to install this package and copy the local DIR:

  class app_install {package {'7-ZIP 9.38 (x64 version)': Provider = & Gt; Windows, make sure that & gt; Installed, source = & gt; 'C: \\ temp \ 7zip_testInstall.msi', install_options = & gt; ['INSTALLDIR = C: \ apps64 \ 7-zip'],} file {'c: /temp/7zip_testInstall.msi': make sure => 'File', mode = & gt; '0660', group = & gt; 'Domain user', source = & gt; 'C: \\ temp \ 7zip_testInstall.msi',}  

}

When I run a puppet and finds that the package is not installed, that file For copies of AC: \ temp, then the revenues to install the package This expected behavior is on the aftermath of the puppet agent, it finds that the package has already been installed, so it leaves the installation, but then the installer will get it again to copy c: \ temp If the installer is absent from c: \ temp - the fact that it is a temporary folder, it becomes very clean every time.

What I'm trying to avoid is to copy the installer if the package has already been installed.

I'm sure how to know about it.

Please advice and thank you!

Fr3edom21.

I was able to answer my question.

Instead of using "File Resource" to copy MSI from network: c: \ temp, I executed the "Exec resource" via a file copy only if uninstalled for the program Registry key version value is missing. Like it:

  exec {'copy msi to c: \ temp': command = & gt; 'C: \\ windows \ system32 \ cmd.exe / c "copy \\ server \ repo \ 7zip_testinstall.msi c: \\ temp"', as long as & gt; 'C: \ Windows \ System32 \ reg.exe query HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Uninstall \ {23170F69-40C1-2702-0938-00000100000 / F 9.38.00.0',}  

I hope that this kind of help helps anyone with this problem.

If you go this route, to consider some things:

  • If you have 32-KB version of the puppet on a 64-bit machine, C: \ Windows \ System 32 Really (via Windows) is redirected to C: \ Windows \ SystemWOW64 , where 32-bit systems have 32 binary live. If you want 64-bit system 32 binary, you should consider using the c: \ Windows \ sysnative . If you are on the 64-bit version of the puppet, then you are not subject to this issue and use not sysnative because it does not exist. If you are on the puppet 3.7.3+, then you can use it to handle the mixed environment. See for more information.
  • HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ uninstall is one of four different possible places, again with 32-bit puppet, you are subject to registry redirection Registry modules are not used. If the software can be installed as 32-bit, you may need to see that it exists even on HKEY_LOCAL_MACHINE \ SOFTWARE \ WOW6432Node \ Microsoft \ Windows \ CurrentVersion \ uninstall Or no, if you are not under the 64-bit puppet or Registry Redirector.

Fr3edom21.


No comments:

Post a Comment