Sparrowdo reports

Finally I have succeeded in suitable sparrowdo reports format, at least it looks fine for me, ūüôā

Consider installing CPAN modules scenario:

user-create 'foo';
cpan-package-install ('CGI', 'Config::Tiny', 'HTTP::Tiny'), %(
    user =>'foo',
    install-base => '/home/foo/',
);

Now sparrowdo report for it looks like:

{create user foo} modules/create/
  useradd: user 'foo' already exists
  uid=1002(foo) gid=1002(foo) groups=1002(foo)
  user created
  ok      scenario succeeded
  ok      text has 'user created'

{create user foo}
  done
  ok      text has 'done'
  STATUS  SUCCEED

{install cpan packages: CGI Config::Tiny HTTP::Tiny}
  @ CPAN package installer

{install cpan packages: CGI Config::Tiny HTTP::Tiny} modules/cpanm/ params: package:CGI
  install CGI into /home/foo/ user foo ...
  CGI is up to date. (4.35)
  install ok
  ok      scenario succeeded
  ok      text has 'install ok'

{install cpan packages: CGI Config::Tiny HTTP::Tiny} modules/cpanm/ params: package:Config::Tiny
 install Config::Tiny into /home/foo/ user foo ...
 Config::Tiny is up to date. (2.23)
 install ok
 ok      scenario succeeded
 ok      text has 'install ok'

{install cpan packages: CGI Config::Tiny HTTP::Tiny} modules/cpanm/ params: package:HTTP::Tiny
 install HTTP::Tiny into /home/foo/ user foo ...
 HTTP::Tiny is up to date. (0.070)
 install ok
 ok      scenario succeeded
 ok      text has 'install ok'
 STATUS  SUCCEED

Here we find a pattern for report blocks:

{ task description, story path, story parameters }
{ @ story description  }
… scenario output¬† …
… scenario output¬† …
… scenario output¬† …
scenario-status
check-status check-message # first one
check-status check-message  # second one
check-status …
check-status check-message # last one
FINAL-TASK-STATUS

Well … story path, story parameters, story description and check statuses are optional and might not appear at reports, but you always get a task description, scenario-status and final task status.

And finally for those who like pictures here is colorful sparrowdo report gets shapshoted from my console:

sparrowdostdout

Advertisements

Sparrowdo system design

Sparrowdo comprises of three main components.

* server part Рa sparrowdo client, should be installed at master host. Sparrowdo compiles sparrowdo scenarios written on Perl6 into json data. Then json data gets copied to the target host by scp command  and sparrow client gets run remotely on the target host with json data as input parameters.

* client part – a sparrow client, should be installed at target hosts where you run automation deployment and configuration tasks. Sparrow client gets run over ssh at the target host, then installs and finally executes a so called sparrow plugins with parameters gets ready as json data copied heretofore by sparrowdo.

* sparrow plugins Рmultipurpose scenarios written on one of the language of your choice- Perl5, Bash or Ruby. Sparrow plugins get downloaded from sparrowhub.org and then installed by sparrow. Plugins get executed with input parameters comes from json data copied from master host to target server.

Thus, sparrowdo follows a “push” paradigm when there is central ( master ) server where you invoke ( push ) some tasks remotely ( over ssh ) on remote hosts. Below is visual presentation of the system design:

sparrowdo-system

So, sparrowdo is a client sever system, with push approach similar to ansible. To allow full automation sparrowdo comes with –bootstrap(*) option to install sparrow client on target host:

$ sparrowdo –bootstrap –host=192.168.0.1

(*) bootstrap currently only available for CentOS target sever platform.

Read more about this at sparrowdo documentation pages – https://github.com/melezhik/sparrowdo#schema

Sparrowdo core dsl

Sparrowdo core-dsl is end user interface to easily start automation. Let me show a few examples:

# create / remove user:

user-create 'zookeeper';
user-delete 'zookeeper'

# create / remove group:

group-create 'birds';
group-delete 'birds';

# install packages:

package-install ('nano', 'tree', 'mc');

# install CPAN packages:

cpan-package-install ('CGI', 'Config::Tiny', 'HTTP::Tiny')

# manage services:

service-start 'nginx';
service-enable 'nginx';
service-restart 'nginx';

# create / delete directories:

directory-create '/var/data/feathered', %( 
   recursive => 1, 
   owner => 'zookeeper' 
);
directory-delete '/var/data/feathered';

# create files and templates:

file '/var/data/feathered/sparrow-greeting.txt', %( 
   mode    => '644', 
   owner   => 'zookeeper',
   content => 'hello! my name is Brave Sparrow'   
); 
# Template-Toolkit templates are supported:
$ cat templates/sparrow-greeting.tmpl
my name is %name%
I can speak %langauge%
template-create '/var/data/feathered/sparrow-greeting.txt', %( 
    source => ( slurp 'examples/templates/sparrow-greeting.tmpl' ), 
    owner => 'zookeeper', 
    group => 'birds', 
    mode => '644', 
    variables => %( 
        name => 'Brave Sparrow', 
        language => 'English' 
 ),

To know more on core-dsl follow sparrowdo documentaion pages – https://github.com/melezhik/sparrowdo#core-dsl