tiochan
2012-May-24 13:06 UTC
[Puppet Users] Puppet on Windows: Avoid download msi files if they aren''t going to be installed
Hi all! I''m new on puppet, and I making my firsts classes. I have defined an example class to install 7Zip on Windows servers, it runs right, but I would like to improve it. The problem is that each time that I execute the "puppet agent --test" it downloads the 7zip.msi file, although it is really installed. So, my question is: Is possible to avoid the download of the associated source file, I there is no need to install it? This is the code: class software_dir { file { ''SOFTWARE_DIR'': path => ''C:\\SOFTWARE'', ensure => directory, } } class 7Zip() { include software_dir $7Zip_source = ''puppet://puppet.upc.edu/modules/windows/7z920.msi'' $7Zip_path = ''C:\\SOFTWARE\\7z920.msi'' $7Zip_package_name = ''7-zip 9.20'' file { $7Zip_path: source => $7Zip_source; } package { $7Zip_package_name: ensure => installed, provider => ''msi'', source => File[$7Zip_path], } } Thanks in advance. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/BO6yk8wHFasJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jeff McCune
2012-May-24 20:42 UTC
Re: [Puppet Users] Puppet on Windows: Avoid download msi files if they aren''t going to be installed
On Thu, May 24, 2012 at 6:06 AM, tiochan <tiochan@gmail.com> wrote:> Hi all! > > I''m new on puppet, and I making my firsts classes. >Welcome!> I have defined an example class to install 7Zip on Windows servers, it > runs right, but I would like to improve it. > The problem is that each time that I execute the "puppet agent --test" it > downloads the 7zip.msi file, although it is really installed. >When using a file resource, Puppet should only transfer the file if there is a mis-match between the local file and the copy on the puppet master. Could you paste the output of puppet agent --test so we can see why the file is being transfered more than once? Do you happen to be removing the MSI from C:\Software\ between puppet runs? If so, Puppet will just put the file right back in place.> So, my question is: > Is possible to avoid the download of the associated source file, I there > is no need to install it? > > This is the code: > > > class software_dir { > > file { ''SOFTWARE_DIR'': > path => ''C:\\SOFTWARE'', > ensure => directory, > } > } > > class 7Zip() { > > include software_dir > > $7Zip_source = ''puppet://puppet.upc.edu/modules/windows/7z920.msi'' > $7Zip_path = ''C:\\SOFTWARE\\7z920.msi'' > $7Zip_package_name = ''7-zip 9.20'' > > file { $7Zip_path: > source => $7Zip_source; > } > > package { $7Zip_package_name: > ensure => installed, > provider => ''msi'', > source => File[$7Zip_path],I think this line above should be source => "${7Zip_path}" It shouldn''t contain a reference to the _resource_ File[$7Zip_path] but instead simply the string that contains the path. I''m not sure this is actually the problem though. I think the output of puppet agent --test will help diagnose this further. -Jeff -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
tiochan
2012-May-25 08:58 UTC
Re: [Puppet Users] Puppet on Windows: Avoid download msi files if they aren''t going to be installed
Jeff, thank for your reply. Really puppet downloads the file only once, this is not in fact a problem. I re-made the previous code to simplify it: class 7Zip() { include software_dir file { ''C:\\SOFTWARE\\7z920.msi'': source => ''puppet://puppet.upc.edu/modules/windows/7z920.msi'', } package { ''7-zip 9.20'': ensure => installed, provider => ''msi'', source => ''C:\\SOFTWARE\\7z920.msi'', } } I can see that if the msi has been installed (by puppet), puppet will not try to install again, this is correct. But always, if it has been installed or not, the file C:\\SOFTWARE\\7z920.msi is downloaded. A band of having a software repository mounted as a mapped drive... Is possible to avoid that the msi file to being downloaded if it is not going to be installed? Thanks again. -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/4y1VTSJ2QFsJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
jcbollinger
2012-May-25 12:43 UTC
[Puppet Users] Re: Puppet on Windows: Avoid download msi files if they aren''t going to be installed
On May 25, 3:58 am, tiochan <tioc...@gmail.com> wrote: This stanza:> file { ''C:\\SOFTWARE\\7z920.msi'': > source => ''puppet://puppet.upc.edu/modules/windows/7z920.msi'', > }tells Puppet that there is supposed to be a file C:\\SOFTWARE\ \7z920.msi on the system, and its content is supposed to exactly match that of puppet://puppet.upc.edu/modules/windows/7z920.msi. That''s altogether independent of whatever use that file may have. If the file is missing when Puppet runs then it will download a fresh copy. If it is present then Puppet will check its content; it will download a fresh copy only if the content does not match. If you do not want the file downloaded every time then either 1) leave it in place where Puppet puts it (per your instructions), or 2) remove that stanza, because it is a lie if you don''t actually want the file to be there.> A band of having a software repository mounted as a mapped drive... Is > possible to avoid that the msi file to being downloaded if it is not going > to be installed?If you make the MSI file accessible to the system via a mapped drive or network share then you can exercise option (2) above without losing the ability to run the installer. John -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
Jeff McCune
2012-May-25 14:49 UTC
Re: [Puppet Users] Re: Puppet on Windows: Avoid download msi files if they aren''t going to be installed
On Fri, May 25, 2012 at 5:43 AM, jcbollinger <John.Bollinger@stjude.org>wrote:> > On May 25, 3:58 am, tiochan <tioc...@gmail.com> wrote: > > This stanza: > > > file { ''C:\\SOFTWARE\\7z920.msi'': > > source => ''puppet://puppet.upc.edu/modules/windows/7z920.msi'', > > } > > tells Puppet that there is supposed to be a file C:\\SOFTWARE\ > \7z920.msi on the system, and its content is supposed to exactly match > that of puppet://puppet.upc.edu/modules/windows/7z920.msi. That''s > altogether independent of whatever use that file may have. If the > file is missing when Puppet runs then it will download a fresh copy. > If it is present then Puppet will check its content; it will download > a fresh copy only if the content does not match. > > If you do not want the file downloaded every time then either > 1) leave it in place where Puppet puts it (per your instructions), or > 2) remove that stanza, because it is a lie if you don''t actually want > the file to be there. > > > > A band of having a software repository mounted as a mapped drive... Is > > possible to avoid that the msi file to being downloaded if it is not > going > > to be installed? > > > If you make the MSI file accessible to the system via a mapped drive > or network share then you can exercise option (2) above without losing > the ability to run the installer. >You can also provide a plain HTTP(S) URI to the source parameter and it will only be downloaded if it''s not already installed. -Jeff -- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
tiochan
2012-May-29 06:47 UTC
[Puppet Users] Re: Puppet on Windows: Avoid download msi files if they aren''t going to be installed
As I can see, the best bet (and perhaps it would be a need) is having a global respository accessible via netbios, NFS and HTTP for puppet, so software is not needed to be transferred each time. Thank you, John. El viernes, 25 de mayo de 2012 14:43:40 UTC+2, jcbollinger escribió:> > > On May 25, 3:58 am, tiochan <tioc...@gmail.com> wrote: > > This stanza: > > > file { ''C:\\SOFTWARE\\7z920.msi'': > > source => ''puppet://puppet.upc.edu/modules/windows/7z920.msi'', > > } > > tells Puppet that there is supposed to be a file C:\\SOFTWARE\ > \7z920.msi on the system, and its content is supposed to exactly match > that of puppet://puppet.upc.edu/modules/windows/7z920.msi. That''s > altogether independent of whatever use that file may have. If the > file is missing when Puppet runs then it will download a fresh copy. > If it is present then Puppet will check its content; it will download > a fresh copy only if the content does not match. > > If you do not want the file downloaded every time then either > 1) leave it in place where Puppet puts it (per your instructions), or > 2) remove that stanza, because it is a lie if you don''t actually want > the file to be there. > > > > A band of having a software repository mounted as a mapped drive... Is > > possible to avoid that the msi file to being downloaded if it is not > going > > to be installed? > > > If you make the MSI file accessible to the system via a mapped drive > or network share then you can exercise option (2) above without losing > the ability to run the installer. > > > John >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/L-8IAmThoBcJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.
tiochan
2012-May-29 07:52 UTC
Re: [Puppet Users] Re: Puppet on Windows: Avoid download msi files if they aren''t going to be installed
That worked, thanks a lot. El viernes, 25 de mayo de 2012 16:49:30 UTC+2, Jeff McCune escribió:> > On Fri, May 25, 2012 at 5:43 AM, jcbollinger wrote: > >> >> On May 25, 3:58 am, tiochan wrote: >> >> This stanza: >> >> > file { ''C:\\SOFTWARE\\7z920.msi'': >> > source => ''puppet://puppet.upc.edu/modules/windows/7z920.msi'', >> > } >> >> tells Puppet that there is supposed to be a file C:\\SOFTWARE\ >> \7z920.msi on the system, and its content is supposed to exactly match >> that of puppet://puppet.upc.edu/modules/windows/7z920.msi. That''s >> altogether independent of whatever use that file may have. If the >> file is missing when Puppet runs then it will download a fresh copy. >> If it is present then Puppet will check its content; it will download >> a fresh copy only if the content does not match. >> >> If you do not want the file downloaded every time then either >> 1) leave it in place where Puppet puts it (per your instructions), or >> 2) remove that stanza, because it is a lie if you don''t actually want >> the file to be there. >> >> >> > A band of having a software repository mounted as a mapped drive... Is >> > possible to avoid that the msi file to being downloaded if it is not >> going >> > to be installed? >> >> >> If you make the MSI file accessible to the system via a mapped drive >> or network share then you can exercise option (2) above without losing >> the ability to run the installer. >> > > You can also provide a plain HTTP(S) URI to the source parameter and it > will only be downloaded if it''s not already installed. > > -Jeff >-- You received this message because you are subscribed to the Google Groups "Puppet Users" group. To view this discussion on the web visit https://groups.google.com/d/msg/puppet-users/-/1pfiR_8DTzIJ. To post to this group, send email to puppet-users@googlegroups.com. To unsubscribe from this group, send email to puppet-users+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/puppet-users?hl=en.