code: def add_host(ip, alias):
      '''
      Add a host to an existing entry, if the entry is not in place then create
      it with the given host
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' hosts.add_host <ip> <alias>
      '''
      hfn = _get_or_create_hostfile()
      if not os.path.isfile(hfn):
          return False
  
      if has_pair(ip, alias):
          return True
  
      hosts = _list_hosts()
  
      # Make sure future calls to _list_hosts() will re-read the file
      __context__.pop('hosts._list_hosts', None)
  
      inserted = False
      for i, h in six.iteritems(hosts):
          for j in range(len(h)):
              if h[j].startswith('#') and i == ip:
                  h.insert(j, alias)
                  inserted = True
      if not inserted:
          hosts.setdefault(ip, []).append(alias)
      _write_hosts(hosts)
      return Truf add_host(ip, alias):
      '''
      Add a host to an existing entry, if the entry is not in place then create
      it with the given host
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' hosts.add_host <ip> <alias>
      '''
      hfn = _get_or_create_hostfile()
      if not os.path.isfile(hfn):
          return False
  
      if has_pair(ip, alias):
          return True
  
      hosts = _list_hosts()
  
      # Make sure future calls to _list_hosts() will re-read the file
      __context__.pop('hosts._list_hosts', None)
  
      inserted = False
      for i, h in six.iteritems(hosts):
          for j in range(len(h)):
              if h[j].startswith('#') and i == ip:
                  h.insert(j, alias)
                  inserted = True
      if not inserted:
          hosts.setdefault(ip, []).append(alias)
      _write_hosts(hosts)
      return True
docs: Add a host to an existing entry, if the entry is not in place then create
      it with the given host
  
      CLI Example:
  
      .. code-block:: bash
  
          salt '*' hosts.add_host <ip> <alias>