Show HN: Posixcube, a shell script automation framework alternative to Ansible
The impetus for this project was that I wanted to move away from Chef because it was costing me an extra administrative server per month. I wanted to try something new, so I didn&#x27;t bother looking into chef-solo. I wanted something agent-less, and it seemed like Ansible was the latest alternative, but when I looked at its YAML, I felt fatigue at learning yet another domain specific language. I thought, &quot;Hey, why not shell scripts?&quot; (insert jwz RegEx joke here). I checked search engines and Stack Overflow, but I couldn&#x27;t find much except for FSS which didn&#x27;t meet my requirements, and I had always wanted to learn more about shell scripting, so I created my own framework called posixcube.sh (open source, MIT license): <a href="https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;posixcube" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;posixcube</a>. There were a few requirements that I had from my Chef cookbooks:<p><pre><code>  * Idempotent file templating with variable substitution
  * Plain-text and encrypted variable files
  * Logical packaging of recipes
  * Roles and a way to check for roles in scripts
  * Repeatable sets of actions for certain types of servers
</code></pre>
So beyond the basics in posixcube.sh of uploading itself to the remote host and providing a consistent API, the above requirements were solved with: cube_set_file_contents, gpg for encryption, &quot;cubes&quot; for logical packaging (although loose scripts and straight commands are also supported), -r ROLE, and cubespecs.ini, respectively.<p>After having migrated an entire Ruby on Rails architecture (<a href="https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;myplaceonline_posixcubes" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;myplaceonline_posixcubes</a>) to posixcube, I thought it went very well, although I certainly see some of the downsides of shell scripting such as checking for error codes in a pipeline, strange HEREDOC interpolation, etc. I also see some of the benefits of complete idempotency, but I didn&#x27;t find the additional procedural checks to emulate idempotency (outside of file templates) that difficult. For the simplest cube example from the previous link which configures an NFS server, see <a href="https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;myplaceonline_posixcubes&#x2F;blob&#x2F;master&#x2F;nfs_server&#x2F;nfs_server.sh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;myplaceonline_posixcubes&#x2F;bl...</a> and for a more complex nginx+Rails cube, see <a href="https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;myplaceonline_posixcubes&#x2F;blob&#x2F;master&#x2F;web&#x2F;web.sh" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;myplaceonline_posixcubes&#x2F;bl...</a><p>You can test it as simply as:<p><pre><code>  git clone https:&#x2F;&#x2F;github.com&#x2F;myplaceonline&#x2F;posixcube
  cd posixcube
  .&#x2F;posixcube.sh -h $SERVER &quot;cube_echo Hello World&quot;
</code></pre>
For more complex examples, see the usage. I&#x27;m open to any feedback and any philosophical debate on this approach versus Ansible, Docker, etc.