nodes: 0, module; 1, function_definition; 2, function_name:add_host; 3, parameters; 4, block; 5, identifier:self; 6, identifier:host; 7, default_parameter; 8, default_parameter; 9, expression_statement; 10, expression_statement; 11, expression_statement; 12, comment:# Add in ansible's magic variables.  Assign them here because this is; 13, comment:# just about the earliest point we can calculate them before anything; 14, comment:# ansible-related (e.g. Stack.configure(), ``bang --host``) executes.; 15, expression_statement; 16, expression_statement; 17, expression_statement; 18, expression_statement; 19, expression_statement; 20, for_statement; 21, identifier:group_names; 22, None; 23, identifier:host_vars; 24, None; 25, comment:"""
          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.**
  
          """; 26, assignment; 27, assignment; 28, call; 29, assignment; 30, assignment; 31, assignment; 32, call; 33, identifier:gname; 34, identifier:group_names; 35, block; 36, identifier:gnames; 37, conditional_expression:group_names if group_names else []; 38, identifier:hvars; 39, conditional_expression:host_vars if host_vars else {}; 40, attribute; 41, argument_list; 42, subscript; 43, identifier:gnames; 44, subscript; 45, identifier:host; 46, subscript; 47, subscript; 48, attribute; 49, argument_list; 50, expression_statement; 51, identifier:group_names; 52, identifier:group_names; 53, list; 54, identifier:host_vars; 55, identifier:host_vars; 56, dictionary; 57, identifier:gnames; 58, identifier:sort; 59, identifier:hvars; 60, attribute; 61, identifier:hvars; 62, attribute; 63, identifier:hvars; 64, attribute; 65, call; 66, integer:0; 67, attribute; 68, identifier:merge; 69, identifier:host; 70, identifier:hvars; 71, call; 72, attribute; 73, identifier:GROUP_NAMES; 74, attribute; 75, identifier:INV_NAME; 76, attribute; 77, identifier:INV_NAME_SHORT; 78, attribute; 79, argument_list; 80, identifier:self; 81, identifier:groups_and_vars; 82, attribute; 83, argument_list; 84, identifier:A; 85, identifier:server; 86, identifier:A; 87, identifier:server; 88, identifier:A; 89, identifier:server; 90, identifier:host; 91, identifier:split; 92, string; 93, attribute; 94, identifier:append; 95, identifier:gname; 96, identifier:host; 97, string_content:.; 98, identifier:self; 99, identifier:groups_and_vars
code: def add_host(self, host, group_names=None, host_vars=None):
          """
          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.**
  
          """
          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)