Here are the ones that I can recall and easily find in the source:

vars
always_run
changed_when
delegate_to
failed_when
ignore_errors
inventory_dir
playbook_dir
register

The vars variable, is a dictionary, that contains all of the above vars as 
key/value pairs.

inventory_file
inventory_hostname_short
inventory_hostname
ansible_ssh_user
hostvars
group_names
groups
defaults
environment

Also, anything from --extra_vars, host_vars/, group_vars/, facts.d/, register, 
etc...

Some of this is mentioned on 
<http://www.ansibleworks.com/docs/playbooks_variables.html> , pay some special 
attention to <http://www.ansibleworks.com/docs/playbooks_variables.html#id22>

But to address some of your specifics:

- current host
inventory_hostname, and inventory_hostname_short

- current group
There isn't really a var that says, this is the current group being acted on, 
but per host has a 'groups' var containing all groups that host is a member of

- current user
Perhaps ansible_ssh_user ?

- current task
This is not exposed

- current role
This is not exposed


-- 
Matt Martz
[email protected]

On December 30, 2013 at 8:54:53 AM, [email protected] ([email protected]) 
wrote:

Does Ansible provide predefined variables to use in scripts? I am looking for 
variables like:
- current host
- current group
- current user
- current task
- current role
etc.

I have not found these variables among these from "gathering facts".
--
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to