Introduction

Hello! Minoca is a new operating system for the world of connected devices. In this post I am going to show you how one can enable configuration management of running Minoca instances by the help of Sparrowdo.

Download the latest Minoca build

$ wget http://www.minocacorp.com/download/nightlies/latest-x86/Minoca-pc.zip $ unzip Minoca-pc.zip

Start Minoca OS instance

$ qemu-system-x86_64 -enable-kvm -m 2000 -net nic,model=i82559er -net user,hostfwd=tcp::2222-:22,hostfwd=tcp::8888-:80 -hda pc.img

Set up remote ssh access

Inside running Minoca instance:

$ opkg update $ opkg install openssh bash $ /etc/init.d/sshd start $ passwd # we will use this password when ssh-ing from the Host OS after `ssh-copy-id` gets run

Inside Host OS:

$ ssh-copy-id -p 2222 root@127.0.0.1 $ ssh -p 2222 root@127.0.0.1 $ exit

Create some Sparrowdo scenario

$ nano sparrowfile use v6; use Sparrowdo; package-install ("nano", "zsh", "nginx"); user "alexey"; directory "/var/data/bar", %( owner => "alexey"); service-stop "nginx"; service-start "nginx"; http-ok %( port => 8888 );

Run Sparrowdo scenario for Minoca instance

$ sparrowdo --host=127.0.0.1 --ssh_user=root --ssh_port=2222 --no_sudo --sparrowfile=sparrowfile --bootstrap --format=production

The output:

running sparrow bootstrap for host: 127.0.0.1 ... bootstrap for minoca Downloading http://www.minocacorp.com/packages/0.4/i686/main/Packages.gz. Inflating http://www.minocacorp.com/packages/0.4/i686/main/Packages.gz. Updated list of available packages in /var/opkg-lists/main. /usr/bin/curl /usr/bin/perl /usr/bin/cpanm /usr/bin/sparrow Outthentic is up to date. (0.3.9) Sparrow is up to date. (0.2.48) running sparrow tasks on 127.0.0.1 ... target OS is - minoca push [task] install packages: nano zsh nginx OK push [task] create user alexey OK push [task] create directory /var/data/bar OK push [task] stop service nginx OK push [task] start service nginx OK push [task] run bash: curl -fsSLk -D - --retry 3 127.0.0.1:8888 -o /dev/ ... OK SPL file /opt/sparrow/sparrow.list is empty get index updates from SparrowHub ... OK set up task box file - /home/melezhik/.sparrowdo//opt/sparrow/task-box.json - OK public@package-generic is uptodate (0.3.7) public@user is uptodate (0.2.1) public@directory is uptodate (0.1.4) public@service is uptodate (0.1.13) public@bash is uptodate (0.1.6) running task box from /opt/sparrow/sparrow-cache/task-box.json ... 2017-09-21 02:27:12 : [task] install packages: nano zsh nginx [path] modules/opkg/ [params] action:install package:nano 2017-09-21 02:27:12 : [task] install packages: nano zsh nginx [path] modules/opkg/ [params] action:install package:zsh 2017-09-21 02:27:12 : [task] install packages: nano zsh nginx [path] modules/opkg/ [params] action:install package:nginx 2017-09-21 02:27:13 : [task] create user alexey [path] modules/create/ 2017-09-21 02:27:13 : [task] create directory /var/data/bar [path] modules/create/ 2017-09-21 02:27:14 : [task] stop service nginx [path] modules/stop/ [params] os:minoca service:nginx 2017-09-21 02:27:14 : [task] start service nginx [path] modules/start/ [params] os:minoca service:nginx 2017-09-21 02:27:14 : [task] run bash: curl -fsSLk -D - --retry 3 127.0.0.1:8888 -o /dev/ ... [path] modules/bash-command/ [params] envvars: