Tag Archives: ansible

  • -

Play(book) with Ansible

Tags : 

Recently I was in a meeting with a customer discussing the software selection for an automation product. The usual suspects were there: Puppet, Chef, Ansible, HP Server Automation/Operations Orchestrator.

A few months ago I tried Puppet in my spare time and just setting it up took a considerable amount of time. Then I tried Ansible. And started right away having fun writing playbooks: in no time I put together some useful books to prepare an entire infrastructure without learning a new language! Having declarative, YAML-based, files is a good choice for me since they can also double as documentation.

Surely Puppet and Chef are good solutions but for a quick start I was really impressed by Ansible and I definitely suggest it (at 3yo is relatively new compared to the others).

For example add some Perl modules and checkout the app from its repo:

- name: CPANM prerequisites
  cpanm: name={{ item }}
  with_items:
    - Term::ReadLine::Perl
    - Term::ReadKey
    - YAML
    - DBD::mysql
    - DateTime
    - Mojo::mysql
    - EV
    - IO::Socket::Socks
    - IO::Socket::SSL
    - Net::DNS::Native
    - Data::Dumper
    - CGI
    - Socket
    - Switch
    - Config::Abstract::Ini
    - List::Util
    - MIME::Lite
  environment:
    http_proxy: http_proxy
    https_proxy: https_proxy
    PERLBREW_ROOT: perlbrew_root
  tags: [ cpan_prerequisistes ]

- name: Copy the code from repository
  git: repo={{ repository }} dest={{ app_home }} force=yes

Give me six hours to chop down a tree and I will spend the first four sharpening the axe.

Abraham Lincoln