Automation Tool for Windows and Linux


(macmeaker) #1

Hey there,

first of all: thanks for this portal and thanks for Icinga and the community!

I have a small environment with linux and Windows VMs and I want a small automation and
configuration management tool for these environment.
My requirements:

  • Provisioning Linux (and sometimes Windows) VMs on Hyper-V or VMWare
  • Provisioning of middleware like webserver/Apache or database servers
  • At the deployment of servers some tasks like adding in Icinga2

I see many such tools (puppet, Ansible, Chef,…) but I don’t know which I should use. Do someone have some tips or recommendations for me?

Thanks


(Michael Friedrich) #2

I would start simple, and get a demo setup soon enough. Maybe a training even.

I haven’t looked into Chef and SaltStack myself, they call off the plate now.

I would either start with Puppet or Ansible, and a simple task. Install a webserver.

Things to keep in mind:

  • Ansible uses YAML as descriptive language and models the setup based on that
  • Puppet provides its own DSL and allows to model the setup and dependencies

forge.puppet.com is a rich source for well tested modules. They are also providing official modules, like puppetlabs-apache serving a nice job, and allowing to easily setup a webserver within 20 lines of code.

Ansible on the other hand doesn’t have many “generlized” modules, you will build many of them on your own. Ansible Galaxy has lots of examples, some might fit your needs, some might not.

Generally speaking, if you are really a starter, you don’t care about ready-to-use modules. You start with the basics of e.g. managing a user, installing a service and deploying a configuration file.

Then you’ll dive into the differences with Puppet (Master and Agent) and Ansible (deployment via SSH).

In the end, choose the one where you’ll find yourself familiar with, where the answers to your questions were easy to find, and you’ll see community actions.

Still, it doesn’t hurt to get a hands-on training/workshop, as these tools are hard to learn just from a book. Speaking of myself, I’ve had “some” knowledge of Puppet by copying other’s code, and then I’ve attended all three trainings (fundamentals, advanced, infrastructure and scaling) which allows me to use Puppet in the best way there is.

On a long run, I would also suggest to look into lifecycle management with Foreman too, which integrates well with Puppet and Ansible. Foreman is backed by RedHat, who also invest a lot into Ansible.


(macmeaker) #3

Thanks for your answer. Now I looked for Ansible and puppet. Ansible is really simple. I am testing ansible at the moment and I think that can also need a while because there are a lots of modules :slight_smile:

Because of the server provisioning: I only saw some modules to create VMware VMs but no module to provisioning a Ubuntu OS or something else. Is this also possible with Ansible?

Thanks


(Michael Friedrich) #4

Ansible is the tool after having the default template provisioned. There are different tools for that, depending on your infrastructure (VMWare, Openstack, Opennebula, bare metal, …) I would look into these directions combined with Foreman for example.


(macmeaker) #5

Yeah, I know these templating solutions.

Another question: Is it possible to make REST API call in a Ansible Playbook? I want to add the created server to the icinga2 monitoring via the API.


(Michael Friedrich) #6

Sure, Ansible just executes commands if specified. So does the exec resource in Puppet.

I’ve seen playbooks with are in Ansible core which do exactly that with Icinga 2.


(macmeaker) #7

What do you mean with “executes commands”? I can run curl for example and in the variables are the details filled or there are explicit POST/PUT/HTTP Requests possible?

Thanks


(Michael Friedrich) #8

I’m not an Ansible user, I’ve only read some playbooks and listened to talks. I prefer Puppet over Ansible for my tasks, which is why you’ll get more rich answers in that region.

AFAIK @KevinHonka knows Ansible very well. And it does not hurt to just try things out.


(Kevin Honka) #9

making restapi calls is rather easy in ansible, they have a module for it.
I use it to query the ticket from the director API to automagically setup my icinga2 clients.
The code looks something like this:

- name: "Generating ticket"
  uri:
    url: "http://icinga.localdomain/icingaweb2/director/host/ticket?name={{ ansible_fqdn }}"
    user: admin
    password: s3cretPW
    return_content: yes
    validate_certs: False
  register: icinga2_ticket

You can then parse the returned json via filter and use them in other tasks.

For more information take a look here:


(macmeaker) #10

Thanks for this tip. I also found a module for adding a icinga host. Do you know it?:
http://docs.ansible.com/ansible/devel/modules/icinga2_host_module.html

Maybe you could test it too.


(Kevin Honka) #11

Yeah I know of the module.
But I would rather not use it in my case as everything is stored in the director, which the module does not support. I have written my own Python API for icinga2 which will one day become a ansible module of its own.