Migrate a tool from Salt to Ansible, is it possible and what can be done with Ansible ?

Hello Ansible users,

I made a tool based on Salt Stack, a deployment tool like Ansible.

This tool, Banquise, is made to deploy groups of serveurs (clusters, HPC clusters) and groups of workstations.
https://github.com/oxedions/banquise/tree/alpha3/

Someone asked me if it would be possible to propose an Ansible version of this tool, but I don’t master Ansible as Salt, so I would like to know if some things are possible in Ansible.

To understand the Banquise tool:

Basically, sys admin define it’s nodes into files with the following structure: type > group > node.
For example, compute1 in this file is type “compute” > group “standard”: https://github.com/oxedions/banquise/blob/alpha3/pillar/cluster/nodes/computes.sls

Then, sys admin can define for each group of each type which states (Ansible roles ?) to be installed: https://github.com/oxedions/banquise/blob/alpha3/pillar/cluster/nodes/computes_states.sls

Same for managements serveurs, and sys admin can also define some other parameters (network, nfs, etc : https://github.com/oxedions/banquise/tree/alpha3/pillar/cluster).

Then, sys admin can deploy management server and maintain it using Salt commands. All services (dhcp, dns, etc) will be installed on management nodes, and configuration files generated on the fly. Same for client side on nodes.
For example, the dhcpd.conf file contains:

{% for type in salt’pillar.get’ %}

Hi Ox,

Hope this answers some of your questions:

  1. not by default, but you can a) generate these files from template or b) create inventory plugin that does so

  2. yes, YAML has been a supported inventory format for a while now, look in examples/hosts.yml

  3. no concept of types in Ansible and all hierarchies are just for ‘variable resolution’ Ansible itself only deals with hosts (groups become a property of each host).

Hi Brian Coca,

Thanks a lot for this answer.

After one week of use, I am getting used to Ansible. It is very different than Salt. Salt is more Cauliflower (hierarchy) when Ansible is more Potatoes (groups) :slight_smile:

  1. Ok, I see that is is only static. I found that the Ansible capacity to “gather” groups from different files and format (JSON and YAML) even in different directories in the inventory is a good workaround. Only issue is, if I want to change a hostname, I need to change it in multiple files. This may not append a lot, but I like to have a data only once.
    The idea of using a template is interesting. Do you mean playing a specific role on the ansible “server” itself ?

  2. Thanks a lot! This is a very cool feature. This allows some more readable files when hosts have sophisticated vars.

  3. Workaround I found is using child groups. However, I fail to get a specific information:
    Lets say I create a group “bluehosts”.
    Then, I create two groups, “sky” and “cloud”, with hosts inside, and I set them children of “bluehosts”.
    Is there a way to ask Ansible in templates: give me the children groups of “bluehosts” as a list so I can iterate on it ? Someting like children_groups[“bluehosts”]…
    Today, I need to specify manually a variable topology this way: