Variables¶
Input¶
The following variables are supported:
validate¶
Boolean value indicating if apply validations or not.
If set to true the following validations are applied:
- Verify if the user can become root.
This variable is set to false by default.
# Including from terminal.
ansible localhost -m include_role -a name=constrict0r.unify -K -e \
"validate=false"
# Including on a playbook.
- hosts: servers
roles:
- role: constrict0r.unify
validate: false
# To a playbook from terminal.
ansible-playbook -i tests/inventory tests/test-playbook.yml -K -e \
"validate=false"
To prevent any unexpected behaviour, it is recommended to always specify this variable when calling this role.
update¶
Boolean variable that defines if update or not the apt cache.
If set to true the apt cache is updated.
This variable is set to false by default.
# Including from terminal.
ansible localhost -m include_role -a name=constrict0r.unify -K -e \
"update=false"
# Including on a playbook.
- hosts: servers
roles:
- role: constrict0r.unify
update: false
# To a playbook from terminal.
ansible-playbook -i tests/inventory tests/test-playbook.yml -K -e \
"update=false"
To prevent any unexpected behaviour, it is recommended to always specify this variable when calling this role.
items¶
List of items to be added to the unified variable.
Each item will be added only if is defined and not empty.
This variable can contain single items, lists, dictionaries, path to files and URLs.
When specifying a path or URL item, the titles variable must not be empty, titles is used as the names of the collections to load from each file.
When specifying file paths, absolute paths must be used, is recommended to always add a .yml or .yaml extension to such files, the same applies for files specified using URLs.
This variable is empty by default.
ansible localhost -m include_role -a name=constrict0r.unify \
--extra-vars "{ \
items: [ \
itemA, itemB, itemC, \
'/home/username/my-config.yml', \
'https://is.gd/lnf6vn'], \
titles: 'items' \
expand: true]}"
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 items will be treated as plain text.
This variable is set to false by default.
ansible localhost -m include_role -a name=constrict0r.unify \
-e "expand=true configuration='/home/username/my-config.yml' titles='items'"
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.unify \
-e "{expand: false,
items: [ \
item_path: '/home/username/my-config.yml', \
item_expand: false \
], titles: 'items'}"
To prevent any unexpected behaviour, it is recommended to always specify this variable when calling this role.
titles¶
Name used as index to load items from files and URLs.
This variable is used when the expand variable is set to true.
This variable is empty by default.
ansible localhost -m include_role -a name=constrict0r.unify \
-e "expand=true items='/home/username/my-config.yml' titles='items'"
To prevent any unexpected behaviour, it is recommended to pass this variable as an empty list [] when not used.
secondary¶
Boolean value indicating if unify the items found on the items_b variable into an unified_b collection.
If set to true this role will build an unified_b collection from the items found on items_b.
This variable is used together with the items_b, expand_b and titles_b variables.
This variable is false by default.
ansible localhost -m include_role -a name=constrict0r.unify \
-e "secondary=true items_b='/home/username/extra-packages.yml' titles_b='items'"
To prevent any unexpected behaviour, it is recommended to always specify this variable when calling this role.
items_b¶
List of items to be added to the unified_b variable.
Each item will be added only if is defined and not empty.
This variable can contain single items, lists, dictionaries, path to files and URLs.
When specifying a path or URL item, the titles_b variable must not be empty, titles_b is used as the names of the collections to load from each file.
When specifying file paths, absolute paths must be used, is recommended to always add a .yml or .yaml extension to such files, the same applies for files specified using URLs.
This variable is empty by default.
ansible localhost -m include_role -a name=constrict0r.unify \
--extra-vars "{ \
items_b: [ \
itemD, itemE, itemF, \
'/home/username/my-config.yml', \
'https://is.gd/lnf6vn'], \
titles_b: 'items' \
expand_b: true]}"
expand_b¶
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 items will be treated as plain text.
This variable is set to false by default.
ansible localhost -m include_role -a name=constrict0r.unify \
-e "expand=true configuration='/home/username/my-config.yml' titles='items'"
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.unify \
-e "{expand: false,
items_b: [ \
item_path: '/home/username/my-config.yml', \
item_expand: false \
], titles: 'items'}"
titles_b¶
Name used as index to load items from files and URLs.
This variable is used when the expand_b variable is set to true.
This variable is empty by default.
ansible localhost -m include_role -a name=constrict0r.unify \
-e "expand_b=true items_b='/home/username/my-config.yml' titles_b='items'"