FAQ
Hi,

I just started using puppet agent on windows 32Bit and my manfiests are
working good so far. Now when using the same manifests on a 64Bit Windows
machine I get trouble about the very special Program Files path. :(

Is there a way of using a variable in puppet manifests and the puppet agent
automatically uses the correct Program Files (x86) folder on 64Bit
machines? I checked the facts on the windows machine but it seems that
64Bit is not correctly reported so using a fact to distinguish is not
possible atm.

I'm using puppet 2.7.13


--
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/-/Pxk5e5OmkPIJ.
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.

Search Discussions

  • Josh Cooper at Nov 26, 2012 at 5:41 pm
    Hi Oliver,
    On Wed, Nov 21, 2012 at 8:08 AM, r0k5t4r wrote:
    I just started using puppet agent on windows 32Bit and my manfiests are
    working good so far. Now when using the same manifests on a 64Bit Windows
    machine I get trouble about the very special Program Files path. :(
    Facter 1.6.10 will correctly report 32-bit or 64-bit architecture and
    hardwaremodel. See http://projects.puppetlabs.com/issues/10261.
    However, there is still a bug where a 32-bit OS running on 64-bit
    hardware is reported as 64 instead of 32. See
    https://projects.puppetlabs.com/issues/16948. As a result, you may
    need to do something like:
    https://github.com/puppetlabs/puppetlabs-dism/blob/master/lib/puppet/provider/dism/dism.rb#L7

    Josh

    --
    Josh Cooper
    Developer, Puppet Labs

    --
    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.
  • R0k5t4r at Nov 27, 2012 at 11:04 am
    Hi Josh,

    thanks a lot for pointing this out. I will update the install on all
    windows machines to the latest puppet 2.7.x release. This updates facter
    and the architecture is correctly display unless it's running 32Bit on
    64Bit hardware.

    Regards,
    Oliver
    On Monday, November 26, 2012 6:36:20 PM UTC+1, Josh Cooper wrote:

    Hi Oliver,

    On Wed, Nov 21, 2012 at 8:08 AM, r0k5t4r <oliver_...@gmx.de <javascript:>>
    wrote:
    I just started using puppet agent on windows 32Bit and my manfiests are
    working good so far. Now when using the same manifests on a 64Bit Windows
    machine I get trouble about the very special Program Files path. :(
    Facter 1.6.10 will correctly report 32-bit or 64-bit architecture and
    hardwaremodel. See http://projects.puppetlabs.com/issues/10261.
    However, there is still a bug where a 32-bit OS running on 64-bit
    hardware is reported as 64 instead of 32. See
    https://projects.puppetlabs.com/issues/16948. As a result, you may
    need to do something like:

    https://github.com/puppetlabs/puppetlabs-dism/blob/master/lib/puppet/provider/dism/dism.rb#L7

    Josh

    --
    Josh Cooper
    Developer, Puppet Labs
    --
    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/-/ibGZNj0c-gAJ.
    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.
  • Ad at Nov 27, 2012 at 9:08 pm
    Hey Oliver,

    You can use my winfacts module, or just strip out the os_archtecture fact
    from it:

    https://github.com/adenning/winfacts/blob/master/lib/facter/os_architecture.rb

    That will correctly handle 32-bit OS on 64-bit hardware.

    Adam
    On Tuesday, November 27, 2012 5:04:47 AM UTC-6, r0k5t4r wrote:

    Hi Josh,

    thanks a lot for pointing this out. I will update the install on all
    windows machines to the latest puppet 2.7.x release. This updates facter
    and the architecture is correctly display unless it's running 32Bit on
    64Bit hardware.

    Regards,
    Oliver
    On Monday, November 26, 2012 6:36:20 PM UTC+1, Josh Cooper wrote:

    Hi Oliver,
    On Wed, Nov 21, 2012 at 8:08 AM, r0k5t4r wrote:
    I just started using puppet agent on windows 32Bit and my manfiests are
    working good so far. Now when using the same manifests on a 64Bit Windows
    machine I get trouble about the very special Program Files path. :(
    Facter 1.6.10 will correctly report 32-bit or 64-bit architecture and
    hardwaremodel. See http://projects.puppetlabs.com/issues/10261.
    However, there is still a bug where a 32-bit OS running on 64-bit
    hardware is reported as 64 instead of 32. See
    https://projects.puppetlabs.com/issues/16948. As a result, you may
    need to do something like:

    https://github.com/puppetlabs/puppetlabs-dism/blob/master/lib/puppet/provider/dism/dism.rb#L7

    Josh

    --
    Josh Cooper
    Developer, Puppet Labs
    --
    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/-/NPjtaYgZJfIJ.
    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.
  • R0k5t4r at Nov 30, 2012 at 1:22 pm
    Hi Adam,

    thanks a lot. I have successfully implemented your or_architecture fact on
    our machines. But it looks like it is not workung under Windows 2003
    32Bit.I have to check this...

    Regards,
    Oli

    --
    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/-/IaPfATAAK6QJ.
    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.
  • R0k5t4r at Nov 30, 2012 at 3:27 pm
    Hi Adam,

    The class Win32_OperatingSystem<http://msdn.microsoft.com/en-us/library/aa394239%28VS.85%29.aspx>exists on Vista and above. For older systems you can use
    Win32_ComputerSystem<http://msdn.microsoft.com/en-us/library/aa394102%28VS.85%29.aspx>.
    I found this information here:

    http://www.adminarsenal.com/admin-arsenal-blog/bid/19689/Determining-OS-Architecture

    The following minor change did the trick for windows 2003.

    Facter.add(:os_architecture) do
    confine :operatingsystem => :windows
    setcode do
    result = ''
    require 'win32ole'
    wmi = WIN32OLE.connect('winmgmts://./root/CIMV2')
    winver = Facter.value('kernelmajversion')
    case winver
    when /5.2|5.1|5.0/
    query = wmi.ExecQuery('select SystemType from
    Win32_ComputerSystem')
    query.each do |os|
    result = os.SystemType
    break
    end
    if result == "X86-based PC"
    result = "32-bit"
    else
    result = "64-bit"
    end
    result
    else
    query = wmi.ExecQuery('select OSArchitecture from
    Win32_OperatingSystem')
    query.each do |os|
    result = os.OSArchitecture
    break
    end
    result
    end
    end
    end

    Have a nice weekend.

    On Friday, November 30, 2012 2:16:11 PM UTC+1, r0k5t4r wrote:

    Hi Adam,

    thanks a lot. I have successfully implemented your or_architecture fact on
    our machines. But it looks like it is not workung under Windows 2003
    32Bit.I have to check this...

    Regards,
    Oli
    --
    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/-/m7nPi3HcVlMJ.
    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.
  • Ad at Nov 30, 2012 at 9:53 pm
    Hi Oliver,

    Nice catch! Thanks for posting your patch.

    Cheers,

    Adam
    On Friday, November 30, 2012 9:27:05 AM UTC-6, r0k5t4r wrote:

    Hi Adam,

    The class Win32_OperatingSystem<http://msdn.microsoft.com/en-us/library/aa394239%28VS.85%29.aspx>exists on Vista and above. For older systems you can use
    Win32_ComputerSystem<http://msdn.microsoft.com/en-us/library/aa394102%28VS.85%29.aspx>.
    I found this information here:


    http://www.adminarsenal.com/admin-arsenal-blog/bid/19689/Determining-OS-Architecture

    The following minor change did the trick for windows 2003.

    Facter.add(:os_architecture) do
    confine :operatingsystem => :windows
    setcode do
    result = ''
    require 'win32ole'
    wmi = WIN32OLE.connect('winmgmts://./root/CIMV2')
    winver = Facter.value('kernelmajversion')
    case winver
    when /5.2|5.1|5.0/
    query = wmi.ExecQuery('select SystemType from
    Win32_ComputerSystem')
    query.each do |os|
    result = os.SystemType
    break
    end
    if result == "X86-based PC"
    result = "32-bit"
    else
    result = "64-bit"
    end
    result
    else
    query = wmi.ExecQuery('select OSArchitecture from
    Win32_OperatingSystem')
    query.each do |os|
    result = os.OSArchitecture
    break
    end
    result
    end
    end
    end

    Have a nice weekend.

    On Friday, November 30, 2012 2:16:11 PM UTC+1, r0k5t4r wrote:

    Hi Adam,

    thanks a lot. I have successfully implemented your or_architecture fact
    on our machines. But it looks like it is not workung under Windows 2003
    32Bit.I have to check this...

    Regards,
    Oli
    --
    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/-/7upl5eoH0d8J.
    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.
  • Ad at Dec 6, 2012 at 7:51 pm
    Hey Oliver,

    I finally got around to working on this today, and discovered I fixed it
    long ago and completely forgot to push the change to github. oops :)

    Looks like I took a different approach.

    https://github.com/adenning/winfacts/blob/master/lib/facter/os_architecture.rb

    I only run Puppet on Windows 7 and XP nodes (yeah that's right), but I can
    confirm this handles 32-bit OS on x64 and accounts for some variations I
    ran into with various embedded Windows.

    Adam
    On Friday, November 30, 2012 9:27:05 AM UTC-6, r0k5t4r wrote:

    Hi Adam,

    The class Win32_OperatingSystem<http://msdn.microsoft.com/en-us/library/aa394239%28VS.85%29.aspx>exists on Vista and above. For older systems you can use
    Win32_ComputerSystem<http://msdn.microsoft.com/en-us/library/aa394102%28VS.85%29.aspx>.
    I found this information here:


    http://www.adminarsenal.com/admin-arsenal-blog/bid/19689/Determining-OS-Architecture

    The following minor change did the trick for windows 2003.

    Facter.add(:os_architecture) do
    confine :operatingsystem => :windows
    setcode do
    result = ''
    require 'win32ole'
    wmi = WIN32OLE.connect('winmgmts://./root/CIMV2')
    winver = Facter.value('kernelmajversion')
    case winver
    when /5.2|5.1|5.0/
    query = wmi.ExecQuery('select SystemType from
    Win32_ComputerSystem')
    query.each do |os|
    result = os.SystemType
    break
    end
    if result == "X86-based PC"
    result = "32-bit"
    else
    result = "64-bit"
    end
    result
    else
    query = wmi.ExecQuery('select OSArchitecture from
    Win32_OperatingSystem')
    query.each do |os|
    result = os.OSArchitecture
    break
    end
    result
    end
    end
    end

    Have a nice weekend.

    On Friday, November 30, 2012 2:16:11 PM UTC+1, r0k5t4r wrote:

    Hi Adam,

    thanks a lot. I have successfully implemented your or_architecture fact
    on our machines. But it looks like it is not workung under Windows 2003
    32Bit.I have to check this...

    Regards,
    Oli
    --
    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/-/dwLVirsRsswJ.
    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.

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppuppet-users @
categoriespuppet
postedNov 21, '12 at 4:08p
activeDec 6, '12 at 7:51p
posts8
users3
websitepuppetlabs.com

3 users in discussion

R0k5t4r: 4 posts Ad: 3 posts Josh Cooper: 1 post

People

Translate

site design / logo © 2022 Grokbase