Variables¶
The following variables are supported:
users¶
List of users to be created. Each non-empty username listed on users will be created.
This list can be modified by passing an users array when including the role on a playbook or via –extra-vars from a terminal.
This variable is empty by default.
# Including from terminal.
ansible localhost -m include_role -a name=constrict0r.groups -K -e \
"{users: [mary, jhon]}"
# Including on a playbook.
- hosts: servers
roles:
- role: constrict0r.groups
users:
- mary
- jhon
# To a playbook from terminal.
ansible-playbook -i inventory my-playbook.yml -K -e \
"{users: [mary, jhon]}"
group¶
List of groups to add all users into. Each non-empty username will be added to the groups specified on this variable.
This list can be modified by passing an groups array when including the role on a playbook or via –extra-vars from a terminal.
This variable is empty by default.
# Including from terminal.
ansible localhost -m include_role -a name=constrict0r.groups -K -e \
"{group: [disk, sudo]}"
# Including on a playbook.
- hosts: servers
roles:
- role: constrict0r.groups
group:
- disk
- sudo
# To a playbook from terminal.
ansible-playbook -i inventory my-playbook.yml -K -e \
"{group: [disk, sudo]}"
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.groups -K -e \
"configuration=/home/username/my-config.yml"
# Using URL.
ansible localhost -m include_role -a name=constrict0r.groups -K -e \
"configuration=https://my-url/my-config.yml"
To see how to write a configuration file see the YAML file format section.