Stanislav Tiurikov edited this page Jun 20, 2018 · 35 revisions

Welcome to the Infrastructor wiki!

What is Infrastructor?

Infrastructor is a simple utility to manage and automate setup procedures of your servers. It is an honest automation framework: Infrastructor just connects to a specified list of hosts by SSH and runs commands you tell it to run. It is portable: running on top of Java Virtual Machine Infrastructor can be launcher on many popular OS (Linux, Windows, Mac). It has a rich syntax (based on Groovy programming language) and great extensibility. Infrastructor does not require any additional packages or agents to be installed on the target hosts. The only thing it needs is an SSH connection.

5 minutes tutorial

Installation

Infrastructor can be installed using SDKMAN:

sdk install infrastructor

Or you can download the latest stable release of Infrastructor from the releases page. Unpack the archive and add 'bin' directory to the PATH environment variable.

Make sure Java Virtual Machine 1.8 is installed to run Infrastructor

Testing environment

Now we need a node to apply or first configuration. There are many ways to setup one: Vagrant, VirtualBox, AWS EC2, etc. In this example we will run a docker container which accepts SSH connections on host's port 10022:

docker run -d -p 10022:22 --name infra-test infrastructor/ubuntu-sshd:latest

Creating a simple provisioning script

Let's install some packages to the node. To do so we need to create a file example.groovy with the following content:

inlineInventory {
  node host: 'localhost', port: 10022, username: 'devops', password: 'devops'
}.provision {
  task name: 'install some packages', actions: {
    shell 'sudo apt update'
    ['tmux', 'mc', 'htop'].each { pkg ->
        shell "sudo apt install $pkg -y"
    }
  }
}

The script above consists of two parts:

  • Inventory definition - a set of node to provision.
  • Provisioning plan - a set of tasks/actions to run on the specified inventory.

Running Infrastructor

To run the setup procedure open a command line and execute:

infrastructor run -f example.groovy

We can start a bash session to check the packages have been successfully installed:

docker exec -it infra-test bash

That's it! Enjoy your infrastructure automation with Infrastructor!

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.