---
# file: main.yml
- hosts: fotk
remote_user: fakesudo
tasks:
- name: create a developer user
user: name={{ user }}
password={{ password }}
Short follow up to the already mentioned options by quoting the latest Ansible docs docs.ansible.com/latest/playbooks_reuse_roles:
As of Ansible 2.4, you can now use roles inline with any other tasks using import_role or include_role:
---
- hosts: webservers
tasks:
- debug:
msg: "before we run our role"
- import_role:
name: example
- include_role:
name: example
- debug:
msg: "after we ran our role"`
Code snippet is also from Ansible docs.
Be aware of the difference between static (import*) & dynamic (include*) usage.