theforeman / foreman_default_hostgroup

A plugin to set the default hostgroup when hosts are created.
GNU General Public License v3.0
11 stars 29 forks source link

foreman_default_hostgroup.yaml incorrect facts_map match #25

Open SDpyro opened 7 years ago

SDpyro commented 7 years ago

My example: https://paste.fedoraproject.org/525270/48409017/ Windows hosts are matching as Linux/CentOS/7

Please advise the proper methodology of doing this or please (begging) come up with a workaround or fix. Thanks for your VALUABLE time and contribution to the foreman/puppet community! -Thomas

GregSutcliffe commented 7 years ago

Hmm, that looks like it should work - can you share the facts yaml from an affected host?

SDpyro commented 7 years ago

# puppet facts --render-as yaml with some minor scrubbing of identifying data.

--- !ruby/object:Puppet::Node::Facts
name: hostname.example.com
values:
  aio_agent_version: 1.8.2
  architecture: x86_64
  augeas:
    version: 1.4.0
  augeasversion: 1.4.0
  bios_release_date: 12/17/2015
  bios_vendor: American Megatrends Inc.
  bios_version: '2.0'
  blockdevice_sda_model: Samsung SSD 850
  blockdevice_sda_size: 512110190592
  blockdevice_sda_vendor: ATA
  blockdevices: sda
  boardassettag: Default string
  boardmanufacturer: Supermicro
  boardproductname: X10SRL-F
  boardserialnumber: XXXXXXXXXXXX
  chassisassettag: Default string
  chassistype: Main System Chassis
  concat_basedir: "/opt/puppetlabs/puppet/cache/concat"
  disks:
    sda:
      model: Samsung SSD 850
      size: 476.94 GiB
      size_bytes: 512110190592
      vendor: ATA
  dmi:
    bios:
      release_date: 12/17/2015
      vendor: American Megatrends Inc.
      version: '2.0'
    board:
      asset_tag: Default string
      manufacturer: Supermicro
      product: X10SRL-F
      serial_number: XXXXXXXXXXXX
    chassis:
      asset_tag: Default string
      type: Main System Chassis
    manufacturer: Supermicro
    product:
      name: Super Server
      serial_number: 0123456789
      uuid: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  domain: example.com
  facterversion: 3.5.0
  filesystems: xfs
  fqdn: hostname.example.com
  gid: root
  hardwareisa: x86_64
  hardwaremodel: x86_64
  hostname: hostname
  id: root
  identity:
    gid: 0
    group: root
    privileged: true
    uid: 0
    user: root
  interfaces: eth0,eth1,lo
  ipaddress: 10.10.80.123
  ipaddress6: fe80::ec4:7aff:feaa:5984
  ipaddress6_eth0: fe80::ec4:7aff:feaa:5984
  ipaddress6_lo: "::1"
  ipaddress_eth0: 10.10.80.123
  ipaddress_lo: 127.0.0.1
  is_pe: false
  is_virtual: false
  kernel: Linux
  kernelmajversion: '3.10'
  kernelrelease: 3.10.0-514.2.2.el7.x86_64
  kernelversion: 3.10.0
  load_averages:
    15m: 0.05
    1m: 0.1
    5m: 0.04
  lsbdistcodename: Core
  lsbdistdescription: CentOS Linux release 7.3.1611 (Core)
  lsbdistid: CentOS
  lsbdistrelease: 7.3.1611
  lsbmajdistrelease: '7'
  lsbminordistrelease: '3'
  lsbrelease: ":core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch"
  macaddress: 0c:c4:7a:aa:59:84
  macaddress_eth0: XXXXXXXXXXXXXXXXX
  macaddress_eth1: XXXXXXXXXXXXXXXXX
  manufacturer: Supermicro
  memory:
    swap:
      available: 31.44 GiB
      available_bytes: 33755754496
      capacity: 0%
      total: 31.44 GiB
      total_bytes: 33755754496
      used: 0 bytes
      used_bytes: 0
    system:
      available: 61.54 GiB
      available_bytes: 66074599424
      capacity: 1.78%
      total: 62.65 GiB
      total_bytes: 67270340608
      used: 1.11 GiB
      used_bytes: 1195741184
  memoryfree: 61.54 GiB
  memoryfree_mb: 63013.6484375
  memorysize: 62.65 GiB
  memorysize_mb: 64153.99609375
  mountpoints:
    "/":
      available: 396.96 GiB
      available_bytes: 426235564032
      capacity: 1.25%
      device: "/dev/mapper/vg_01-lv_root"
      filesystem: xfs
      options:
      - rw
      - seclabel
      - relatime
      - attr2
      - inode64
      - noquota
      size: 401.97 GiB
      size_bytes: 431609524224
      used: 5.00 GiB
      used_bytes: 5373960192
    "/boot":
      available: 3.60 GiB
      available_bytes: 3862978560
      capacity: 9.84%
      device: "/dev/sda1"
      filesystem: xfs
      options:
      - rw
      - seclabel
      - relatime
      - attr2
      - inode64
      - noquota
      size: 3.99 GiB
      size_bytes: 4284481536
      used: 401.98 MiB
      used_bytes: 421502976
    "/dev/shm":
      available: 31.33 GiB
      available_bytes: 33635082240
      capacity: 0.00%
      device: tmpfs
      filesystem: tmpfs
      options:
      - rw
      - seclabel
      - nosuid
      - nodev
      size: 31.33 GiB
      size_bytes: 33635168256
      used: 84.00 KiB
      used_bytes: 86016
    "/home.local":
      available: 34.17 GiB
      available_bytes: 36691959808
      capacity: 12.95%
      device: "/dev/mapper/vg_01-lv_home"
      filesystem: xfs
      options:
      - rw
      - seclabel
      - relatime
      - attr2
      - inode64
      - noquota
      size: 39.25 GiB
      size_bytes: 42148941824
      used: 5.08 GiB
      used_bytes: 5456982016
    "/run":
      available: 31.21 GiB
      available_bytes: 33508401152
      capacity: 0.38%
      device: tmpfs
      filesystem: tmpfs
      options:
      - rw
      - seclabel
      - nosuid
      - nodev
      - mode=755
      size: 31.33 GiB
      size_bytes: 33635168256
      used: 120.89 MiB
      used_bytes: 126767104
    "/run/user/0":
      available: 6.27 GiB
      available_bytes: 6727036928
      capacity: 0%
      device: tmpfs
      filesystem: tmpfs
      options:
      - rw
      - seclabel
      - nosuid
      - nodev
      - relatime
      - size=6569372k
      - mode=700
      size: 6.27 GiB
      size_bytes: 6727036928
      used: 0 bytes
      used_bytes: 0
    "/run/user/1397754897":
      available: 6.27 GiB
      available_bytes: 6727036928
      capacity: 0%
      device: tmpfs
      filesystem: tmpfs
      options:
      - rw
      - seclabel
      - nosuid
      - nodev
      - relatime
      - size=6569372k
      - mode=700
      - uid=1397754897
      - gid=1397752321
      size: 6.27 GiB
      size_bytes: 6727036928
      used: 0 bytes
      used_bytes: 0
    "/run/user/42":
      available: 6.27 GiB
      available_bytes: 6727020544
      capacity: 0.00%
      device: tmpfs
      filesystem: tmpfs
      options:
      - rw
      - seclabel
      - nosuid
      - nodev
      - relatime
      - size=6569372k
      - mode=700
      - uid=42
      - gid=42
      size: 6.27 GiB
      size_bytes: 6727036928
      used: 16.00 KiB
      used_bytes: 16384
    "/sys/fs/cgroup":
      available: 31.33 GiB
      available_bytes: 33635168256
      capacity: 0%
      device: tmpfs
      filesystem: tmpfs
      options:
      - ro
      - seclabel
      - nosuid
      - nodev
      - noexec
      - mode=755
      size: 31.33 GiB
      size_bytes: 33635168256
      used: 0 bytes
      used_bytes: 0
  mtu_eth0: 1500
  mtu_eth1: 1500
  mtu_lo: 65536
  netmask: 255.255.254.0
  netmask6: 'ffff:ffff:ffff:ffff::'
  netmask6_eth0: 'ffff:ffff:ffff:ffff::'
  netmask6_lo: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
  netmask_eth0: 255.255.254.0
  netmask_lo: 255.0.0.0
  network: 10.10.80.0
  network6: 'fe80::'
  network6_eth0: 'fe80::'
  network6_lo: "::1"
  network_eth0: 10.10.80.0
  network_lo: 127.0.0.0
  networking:
    domain: example.com
    fqdn: hostname.example.com
    hostname: hostname
    interfaces:
      eth0:
        bindings:
        - address: 10.10.80.123
          netmask: 255.255.254.0
          network: 10.10.80.0
        bindings6:
        - address: fe80::ec4:7aff:feaa:5984
          netmask: 'ffff:ffff:ffff:ffff::'
          network: 'fe80::'
        ip: 10.10.80.123
        ip6: fe80::ec4:7aff:feaa:5984
        mac: XXXXXXXXXXXXXXXXX
        mtu: 1500
        netmask: 255.255.254.0
        netmask6: 'ffff:ffff:ffff:ffff::'
        network: 10.10.80.0
        network6: 'fe80::'
      eth1:
        mac: 0c:c4:7a:aa:59:85
        mtu: 1500
      lo:
        bindings:
        - address: 127.0.0.1
          netmask: 255.0.0.0
          network: 127.0.0.0
        bindings6:
        - address: "::1"
          netmask: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
          network: "::1"
        ip: 127.0.0.1
        ip6: "::1"
        mtu: 65536
        netmask: 255.0.0.0
        netmask6: ffff:ffff:ffff:ffff:ffff:ffff:ffff:ffff
        network: 127.0.0.0
        network6: "::1"
    ip: 10.10.80.123
    ip6: fe80::ec4:7aff:feaa:5984
    mac: XXXXXXXXXXXXXXXXX
    mtu: 1500
    netmask: 255.255.254.0
    netmask6: 'ffff:ffff:ffff:ffff::'
    network: 10.10.80.0
    network6: 'fe80::'
    primary: eth0
  operatingsystem: CentOS
  operatingsystemmajrelease: '7'
  operatingsystemrelease: 7.3.1611
  os:
    architecture: x86_64
    distro:
      codename: Core
      description: CentOS Linux release 7.3.1611 (Core)
      id: CentOS
      release:
        full: 7.3.1611
        major: '7'
        minor: '3'
      specification: ":core-4.1-amd64:core-4.1-noarch:cxx-4.1-amd64:cxx-4.1-noarch:desktop-4.1-amd64:desktop-4.1-noarch:languages-4.1-amd64:languages-4.1-noarch:printing-4.1-amd64:printing-4.1-noarch"
    family: RedHat
    hardware: x86_64
    name: CentOS
    release:
      full: 7.3.1611
      major: '7'
      minor: '3'
    selinux:
      config_mode: permissive
      config_policy: targeted
      current_mode: permissive
      enabled: true
      enforced: false
      policy_version: '28'
  osfamily: RedHat
  package_provider: yum
  partitions:
    "/dev/mapper/vg_01-lv_home":
      filesystem: xfs
      mount: "/home.local"
      size: 39.27 GiB
      size_bytes: 42169532416
      uuid: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    "/dev/mapper/vg_01-lv_root":
      filesystem: xfs
      mount: "/"
      size: 402.16 GiB
      size_bytes: 431820374016
      uuid: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    "/dev/mapper/vg_01-lv_swap":
      filesystem: swap
      size: 31.44 GiB
      size_bytes: 33755758592
      uuid: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    "/dev/sda1":
      filesystem: xfs
      mount: "/boot"
      size: 4.00 GiB
      size_bytes: 4294967296
      uuid: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
    "/dev/sda2":
      filesystem: LVM2_member
      size: 472.94 GiB
      size_bytes: 507813822464
      uuid: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  path: "/root/bin:/opt/pbis/bin:/misc/IT/bin:/tools/common/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/opt/puppetlabs/bin:/root/bin:/sbin"
  physicalprocessorcount: 1
  printers: 
  processor0: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor1: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor10: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor11: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor12: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor13: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor14: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor15: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor2: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor3: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor4: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor5: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor6: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor7: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor8: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processor9: Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
  processorcount: 16
  processors:
    count: 16
    isa: x86_64
    models:
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    - Intel(R) Xeon(R) CPU E5-2630 v3 @ 2.40GHz
    physicalcount: 1
    speed: 3.20 GHz
  productname: Super Server
  puppet_vardir: "/opt/puppetlabs/puppet/cache"
  puppetversion: 4.8.1
  root_home: "/root"
  ruby:
    platform: x86_64-linux
    sitedir: "/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.1.0"
    version: 2.1.9
  rubyplatform: x86_64-linux
  rubysitedir: "/opt/puppetlabs/puppet/lib/ruby/site_ruby/2.1.0"
  rubyversion: 2.1.9
  selinux: true
  selinux_config_mode: permissive
  selinux_config_policy: targeted
  selinux_current_mode: permissive
  selinux_enforced: false
  selinux_policyversion: '28'
  serialnumber: XXXXXXXXXX
  service_provider: systemd
  ssh:
    ecdsa:
      fingerprints:
        sha1: SSHFP 3 1 
        sha256: SSHFP 3 2 
      key: 

      fingerprints:
        sha1: SSHFP 4 1 
        sha256: SSHFP 4 2 
      key: 
    rsa:
      fingerprints:
        sha1: SSHFP 1 1 
        sha256: SSHFP 1 2 
      key: 
  sshecdsakey: 
  sshed25519key: 
  sshfp_ecdsa: |-
    SSHFP 3 1 
    SSHFP 3 2 
  sshfp_ed25519: |-
    SSHFP 4 1 
    SSHFP 4 2 
  sshfp_rsa: |-
    SSHFP 1 1 
    SSHFP 1 2 
  sshrsakey: 
  swapfree: 31.44 GiB
  swapfree_mb: 32191.99609375
  swapsize: 31.44 GiB
  swapsize_mb: 32191.99609375
  system_uptime:
    days: 3
    hours: 76
    seconds: 277198
    uptime: 3 days
  timezone: PST
  uptime: 3 days
  uptime_days: 3
  uptime_hours: 76
  uptime_seconds: 277198
  uuid: XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
  virtual: physical
  vmwaretools_version: not installed
  clientcert: hostname.example.com
  clientversion: 4.8.1
  clientnoop: false
timestamp: '2017-01-19T19:31:40.476582895-08:00'
expiration: '2017-01-19T20:01:40.477054565-08:00'
SDpyro commented 7 years ago

This is happening on new installs as well as renamed hosts. Does not seem to be happening on Fedora hosts, just on CentOS and possibly RedHat. force_host_environment = yes force_hostgroup_match = yes

GregSutcliffe commented 7 years ago

Thanks, I'll see if I can reproduce. The second point is interesting - given that Red Hat and CentOS are the top of your facts-map anyway, what are these hosts matching as?

SDpyro commented 7 years ago

The following Columns are BLANK in the Foreman "Hosts" display, Operating System, Environment, Model and Host group for the hosts having this issue. This occurs on rename of host or on a fresh install of CentOS. I verified this is not a problem on RedHat 7.2 or Fedora 24.

SDpyro commented 7 years ago

Ping

GregSutcliffe commented 7 years ago

@SDpyro apologies, been travelling a lot recently. back home now, I'll try to look at this soon.

SDpyro commented 7 years ago

@GregSutcliffe Ping mate, sorry to bug...