code: def add_host(self, host, group_names=None, host_vars=None):
          
          gnames = group_names if group_names else []
          hvars = host_vars if host_vars else {}
  
          # Add in ansible's magic variables.  Assign them here because this is
          # just about the earliest point we can calculate them before anything
          # ansible-related (e.g. Stack.configure(), ``bang --host``) executes.
          gnames.sort()
          hvars[A.server.GROUP_NAMES] = gnames
          hvars[A.server.INV_NAME] = host
          hvars[A.server.INV_NAME_SHORT] = host.split('.')[0]
  
          self.groups_and_vars.merge(host, hvars)
  
          for gname in group_names:
              self.groups_and_vars.append(gname, host)
docs: Used by deployers to add hosts to the inventory.
  
          :param str host:  The host identifier (e.g. hostname, IP address) to
              use in the inventory.
  
          :param list group_names:  A list of group names to which the host
              belongs.  **Note:  This list will be sorted in-place.**
  
          :param dict host_vars:  A mapping object of host *variables*.  This can
              be a nested structure, and is used as the source of all the
              variables provided to the ansible playbooks.  **Note:  Additional
              key-value pairs (e.g. dynamic ansible values like
              ``inventory_hostname``) will be inserted into this mapping
              object.**