oscar-stack / vagrant-config_builder

Configure Vagrant with structured data
Other
23 stars 19 forks source link

Nested roles support #29

Open pradels opened 10 years ago

pradels commented 10 years ago

In some cases can be usefull to assign some roles configuration to another role - add together their functionality.

For example, when I use vagrant-libvirt plugin, there are a lot common arguments, but some arguments are specific depending on the role. Config with nested roles can look like this:

roles:
  base:
    providers:
      - type: libvirt
        driver: qemu
        host: localhost
        connect_via_ssh: true
        username: root
        storage_pool_name: default
        nested: true

  puppetmaster:
    providers:
      - type: libvirt
        cpus: 2
        memory: 1024
    roles: base

  puppetagent:
    providers:
      - type: libvirt
        cpus: 1
        memory: 512
    roles: base

Thanks Lukas

adrienthebo commented 10 years ago

Nested roles would be a really neat feature, but unfortunately they get complex quickly - what happens if you have role that is included multiple times, or what happens if there is a cycle in role requirement?

Sharpie commented 10 years ago

What we would need to do is come up with a sane, well-defined deep merge strategy. It might be possible given that most data structures in config_builder only run so deep and we have some knowledge of which keys should be arrays.