Be pushy With Chef from Ruby application using “Foodpusher” gem.

Hi guys,

recently for some work tasks I needed to interact with Chef Push Jobs not from knife command line tool but through ruby code…

Screen Shot 2017-08-14 at 11.43.02

For this reason, I decided to write a Ruby gem and I hope it will be useful for the Chef community ūüôā

You can find code and instructions here

Below some code, just to have a look about how to use of this gem.

Let’s say you want push chef-client execution on client01.local and chef-server.

require 'chef/knife'
require 'chef/knife/foodpusher'

job = { 'command' => 'chef-client',
        'nodes' => ['client01.local', 'chef-server'],
        'quorum' => 1,
        'capture_output' => false,
        'env' => {} }

Chef::Config.chef_server_url = 'https://chef.devops.foobar.lan/organizations/chef'
Chef::Config.client_key = '/vagrant/chef-server.local/.chef/chef.pem'
Chef::Config.node_name = 'chef'
Chef::Config.ssl_verify_mode = :verify_none
pusher =

# Start Job
myjob = pusher.start
puts "Job uri #{myjob}"
status = (pusher.status myjob)['status']

# Check Job Status
while status == 'running'
  status = (pusher.status myjob)['status']
  puts status
  sleep 1

# Check Node Status
(pusher.node_status job['nodes']).each do |result|
  puts result

Launch the script and that’s the output

Job uri {"uri"=>"https://chef.devops.foobar.lan/organizations/chef/pushy/jobs/336d0bf2dc771d3127dffead469381b5"}
{"node_name"=>"client01.local", "status"=>"online", "availability"=>"available"}
{"node_name"=>"chef-server", "status"=>"online", "availability"=>"available"}




Test Kitchen – overview sul testing di infrastrutture

Ultimamente mi tocca, con molto piacere, rispolverare un pò di argomenti passati sulla parte di test di infrastrutture tramite Chef.

Al posto di scrivermi il solito spiegone in markdown direi che un post ci sta tutto ūüôā

Iniziamo con scegliere il framework


e il DSL da utilizzare per i nostri test.


Userò InSpec. Riporto il link della documentazione dove sono elencati vari costrutti e metodi da utilizzare.

In .kitchen.yml, all’interno del cookbook, selezioniamo il verifier

  name: inspec

Il file da editare è test/smoke/default/default_test.rb.

Di seguito un pò di test fatti per verificare il ruolo di base di alcuni server

  • Controllo di un nameserver in /etc/resolv.conf
describe file('/etc/resolv.conf') do
  its('content') { should match(/^nameserver\$/) }
  • Controllo NTP
].each do |ntp|
 describe file('/etc/ntp.conf') do
 its('content') { should match(ntp) }
  • Selinux √® disabilitato?
describe command('getenforce') do
 it { should exist }
 its('matcher') { should eq 'Permissive' }

Ora lanciamo ‘kitchen verify’ e verifichiamo il risultato dei test

File /etc/resolv.conf
 ‚úĒ content should match /^nameserver\$/
 File /etc/resolv.conf
 ‚úĒ content should match /^nameserver\$/
 File /etc/ntp.conf
 ‚úĒ content should match /^server\*/
 File /etc/ntp.conf
 ‚úĒ content should match /^server\*/

Test Summary: 4 successful, 0 failures, 0 skipped

Devops trends from MongoDB, Grafana and spammed mailbox. Update #1

Hi all!

this is the first update from my new Big data¬†experimental project…

How can I be updated with devops trend technologies without reading tons of blog?

I started to collect¬†raw data from Twitter timeline and Gmail spammed mailbox¬†that receives messages¬†from websites for job seekers and others like Stack Exchange…

This is the result¬†and the first day of data collecting…I am curious to see what happens with tons of data and some adjustments…

Link to Grafana dashboard


Docker containers high availability using Congruit

Congruit cannot be cool if it does not control Docker containers. From today it does! At moment is still an experimental feature but it seems to work fine.


Start Congruit in friend mode

congruit -debug -friend -token \

foobar -debug \

-gitrepo \

-ssl_cert /vagrant/insecure-domain.crt  \

-ssl_key /vagrant/insecure-domain.key

With¬†these¬†arguments your Congruit instance starts and waits for a work to do…


Start Congruit in Supervisor mode..

Supervisor mode is used to control Congruit “friends” via HTTPS.


-supervisor  -debug

You can find instructions to start and monitor two Docker containers here.

You will find an example of the workplace for managing Dockers in a Linux Centos7 down below:

 "places": ["centos7" , "docker_is_not_installed"],
 "works": ["docker_package_yum"]
 "places": ["docker_is_not_running_systemd"],
 "works": ["docker_start_systemd"]
 "places": ["docker_tomcat_image_is_not_present"],
 "works": ["docker_pull_tomcat"]
 "places": ["everywhere", "docker_tomcat_is_not_running"],
 "works": ["run_tomcat_docker"]

Anno nuovo, configuration management nuovo…

Buon anno a tutti i lettori di ūüôā

Qualche giorno fa, approfittando dell’apparente calma lavorativa tipica delle feste natalizie, ho deciso di studiare GO (

Molto figo, ma soprattutto, usare i puntatori mi ha fatto tornare indietro nel tempo quando “smanettavo” pesantemente¬†in C.

Quel che √® uscito fuori, tra un p√≤ i programmi pieni di “foo” e “foobar” senza senso, √® stato Congruit. Un nuovo configuration management tool scritto in GO ma che opera prettamente in Bash…

Link al repo Github


Naturalmente √® molto minimale ma ha un non so che di “Bash” che lo colora molto di Sys-admin.

Diciamo che nell’ottica Devops √® un p√≤ pi√Ļ Ops. Pull request al repo sono benvenute ūüėČ