def set_hostnames
      if @options[:use_beaker_hostnames]
        @hosts.each do |host|
          host[:vmhostname] = host.name
          if host['platform'] =~ /el-7/
            # on el-7 hosts, the hostname command doesn't "stick" randomly
            host.exec(Command.new("hostnamectl set-hostname #{host.name}"))
          elsif host['platform'] =~ /windows/
            @logger.notify('aws-sdk: Change hostname on windows is not supported.')
          else
            next if host['platform'] =~ /f5-|netscaler/
            host.exec(Command.new("hostname #{host.name}"))
            if host['vmname'] =~ /^amazon/
              # Amazon Linux requires this to preserve host name changes across reboots.
              # http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html
              # Also note that without an elastic ip set, while this will
              # preserve the hostname across a full shutdown/startup of the vm
              # (as opposed to a reboot) -- the ip address will have changed.
              host.exec(Command.new("sed -ie '/^HOSTNAME/ s/=.*/=#{host.name}/' /etc/sysconfig/network"))
            end
          end
        end
      else
        @hosts.each do |host|
          host[:vmhostname] = host[:dns_name]
          if host['platform'] =~ /el-7/
            # on el-7 hosts, the hostname command doesn't "stick" randomly
            host.exec(Command.new("hostnamectl set-hostname #{host.hostname}"))
          elsif host['platform'] =~ /windows/
            @logger.notify('aws-sdk: Change hostname on windows is not supported.')
          else
            next if host['platform'] =~ /ft-|netscaler/
            host.exec(Command.new("hostname #{host.hostname}"))
            if host['vmname'] =~ /^amazon/
              # See note above
              host.exec(Command.new("sed -ie '/^HOSTNAME/ s/=.*/=#{host.hostname}/' /etc/sysconfig/network"))
            end
          end
        end
      end
    end
def set_hostnames
      if @options[:use_beaker_hostnames]
        @hosts.each do |host|
          host[:vmhostname] = host.name
          if host['platform'] =~ /el-7/
            # on el-7 hosts, the hostname command doesn't "stick" randomly
            host.exec(Command.new("hostnamectl set-hostname #{host.name}"))
          elsif host['platform'] =~ /windows/
            @logger.notify('aws-sdk: Change hostname on windows is not supported.')
          else
            next if host['platform'] =~ /f5-|netscaler/
            host.exec(Command.new("hostname #{host.name}"))
            if host['vmname'] =~ /^amazon/
              # Amazon Linux requires this to preserve host name changes across reboots.
              # http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/set-hostname.html
              # Also note that without an elastic ip set, while this will
              # preserve the hostname across a full shutdown/startup of the vm
              # (as opposed to a reboot) -- the ip address will have changed.
              host.exec(Command.new("sed -ie '/^HOSTNAME/ s/=.*/=#{host.name}/' /etc/sysconfig/network"))
            end
          end
        end
      else
        @hosts.each do |host|
          host[:vmhostname] = host[:dns_name]
          if host['platform'] =~ /el-7/
            # on el-7 hosts, the hostname command doesn't "stick" randomly
            host.exec(Command.new("hostnamectl set-hostname #{host.hostname}"))
          elsif host['platform'] =~ /windows/
            @logger.notify('aws-sdk: Change hostname on windows is not supported.')
          else
            next if host['platform'] =~ /ft-|netscaler/
            host.exec(Command.new("hostname #{host.hostname}"))
            if host['vmname'] =~ /^amazon/
              # See note above
              host.exec(Command.new("sed -ie '/^HOSTNAME/ s/=.*/=#{host.hostname}/' /etc/sysconfig/network"))
            end
          end
        end
      end
    end
Set the :vmhostname for each host object to be the dns_name, which is accessible
 publicly. Then configure each ec2 machine to that dns_name, so that when facter
 is installed the facts for hostname and domain match the dns_name.

 if :use_beaker_hostnames: is true, set the :vmhostname and hostname of each ec2
 machine to the host[:name] from the beaker hosts file.

 @return [@hosts]
 @api private