optimize playbook

Hi all!
I write role for Ansible Galaxy, and have a little problem. I have 2 host groups and need execute different tasks for this groups. At this moment I doing it with the following configuration, this is the root playbook.yml

`

  • hosts: all
    sudo: yes
    sudo_user: root
    vars_files:

  • ‘defaults/main.yml’ # main configuration

  • ‘defaults/repo.yml’ # repositories which must not be changed in normal case
    tasks:

  • include: ‘tasks/install.yml’

  • hosts: streaming-master
    sudo: yes
    sudo_user: root
    vars_files:

  • ‘defaults/main.yml’

  • ‘defaults/repo.yml’
    tasks:

  • include: ‘tasks/configure-master.yml’

  • include: ‘tasks/users.yml’

  • include: ‘tasks/databases.yml’

  • hosts: streaming-slaves
    sudo: yes
    sudo_user: root
    vars_files:

  • ‘defaults/main.yml’

  • ‘defaults/repo.yml’
    tasks:

  • include: ‘tasks/configure-slaves.yml’
    `

Аs you can see, there are many duplicate information (sudo/sudo_user/vars_files), how to avoid it?

Put in in ansible.cfg file, with contain default values for ansible. Like remote user or sudo. And many others :slight_smile: