Variables¶
The following variables are supported:
expand¶
Boolean value indicating if load items from file paths or URLs or just treat files and URLs as plain text.
If set to true this role will attempt to load items from the especified paths and URLs.
If set to false each file path or URL found on user_tasks will be treated as plain text.
This variable is set to true by default.
ansible localhost -m include_role -a name=constrict0r.task \
-e "expand=true configuration='/home/username/my-config.yml' titles='user_tasks'"
If you wish to override the value of this variable, specify an item_path and an item_expand attributes when passing the item, the item_path attribute can be used with URLs too:
ansible localhost -m include_role -a name=constrict0r.task \
-e "{expand: false,
user_tasks: [ \
item_path: '/home/username/my-config.yml', \
item_expand: false \
], titles: 'user_tasks'}"
To prevent any unexpected behaviour, it is recommended to always specify this variable when calling this role.
user_tasks¶
Absolute file path or URL to a .yml file containing ansible tasks to execute.
Each file or URL on this variable will be checked to see if it exists and if it does, the task is executed.
This variable is empty by default.
# Including from terminal.
ansible localhost -m include_role -a name=constrict0r.task -K -e \
"{user_tasks: [item_path: https://is.gd/vVCfKI, item_expand: false]}"
# Or:
# Including from terminal.
ansible localhost -m include_role -a name=constrict0r.task -K -e \
"{user_tasks: [https://is.gd/vVCfKI], expand: false}"
# Including on a playbook.
- hosts: servers
roles:
- role: constrict0r.task
user_tasks:
- item_path: https://is.gd/vVCfKI
item_expand: false
# Or:
# Including on a playbook.
- hosts: servers
roles:
- role: constrict0r.task
user_tasks:
- https://is.gd/vVCfKI
expand: false
# To a playbook from terminal.
ansible-playbook -i inventory my-playbook.yml -K -e \
"{user_tasks: [item_path: https://is.gd/vVCfKI, item_expand: false]}"
# Or:
# To a playbook from terminal.
ansible-playbook -i inventory my-playbook.yml -K -e \
"{user_tasks: [https://is.gd/vVCfKI], expand: false}"
configuration¶
Absolute file path or URL to a .yml file that contains all or some of the variables supported by this role.
It is recommended to use a .yml or .yaml extension for the configuration file.
This variable is empty by default.
# Using file path.
ansible localhost -m include_role -a name=constrict0r.task -K -e \
"configuration=/home/username/my-config.yml"
# Using URL.
ansible localhost -m include_role -a name=constrict0r.task -K -e \
"configuration=https://my-url/my-config.yml"
To see how to write a configuration file see the YAML file format section.