Uploaded image for project: 'Puppet'
  1. Puppet
  2. PUP-1171

host type should have an optional canonical_hostname parameter

    XMLWordPrintable

    Details

    • Type: New Feature
    • Status: Closed
    • Priority: Normal
    • Resolution: Won't Fix
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: None
    • Labels:
    • Template:

      Description

      If you compare the behavior of the Exec type to the Host type, Exec is more flexible because it has a command => parameter. This is useful if you would like to create multiple Execs with different namevars, but similar commands.

      When working with the Host type, I've found that the namevar becomes the "canonical_hostname", and there is no way to override this. Here's a specific example of when having multiple Host resources with the same namevar would be useful:

        @@host  { "$fqdn":
          host_aliases  => $hostname,
          ip            => $private_ip_interface,
          tag           => "normal_server_private-${region}",
        }
       
        @@host  { "${fqdn}":
          host_aliases  => $hostname,
          ip            => $public_ip_interface,
          tag           => "normal_server_public-${region}",
        }
      

      Since both exported resources have the same namevar, I receive a parse error:

      Error 400 on SERVER: Duplicate definition: Host[puppet.dev.server.com] is already defined in file /etc/puppet/modules/hosts/manifests/collect.pp at line 33; cannot redefine at /etc/puppet/modules/hosts/manifests/collect.pp:43 on node puppet.dev.server.com

      However, If the Host type had the ability to pass a canonical hostname (fqdn) argument, I could do:

        @@host  { "${fqdn}-private":
          canonical_hostname => $fqdn
          host_aliases  => $hostname,
          ip            => $private_ip_interface,
          tag           => "normal_server_private-${region}",
        }
       
        @@host  { "${fqdn}-public":
          canonical_hostname => $fqdn
          host_aliases  => $hostname,
          ip            => $public_ip_interface,
          tag           => "normal_server_public-${region}",
        }
      

        Attachments

          Activity

            People

            Assignee:
            Unassigned
            Reporter:
            redmine.exporter redmine.exporter
            Votes:
            1 Vote for this issue
            Watchers:
            11 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:

                Zendesk Support