code: def execute(self, args):
          
          hook_name = os.path.basename(args[0])
          extra_vars = None
          if hook_name in self._actions:
              extra_vars = self._actions[hook_name](args[1:])
          else:
              super(AnsibleHooks, self).execute(args)
  
          charmhelpers.contrib.ansible.apply_playbook(
              self.playbook_path, tags=[hook_name], extra_vars=extra_vars)
docs: Execute the hook followed by the playbook using the hook as tag.