Graph-IT Push
The 'graphit/push'-project contains a PHP tool that aside from some helper functionallity is ment to generate configuration files for specified hosts and copy those generated files to the host machine. This allows us a faster setup of systems inside our network (see: 'Server/Rechner hinzufügen'), to update configurations and keep them consistent in case:
- a new server was added
- an old server was removed
- a new client was added
- ...
Installation
Run:
composer create-project --stability dev graphit/push <target folder>
Components
The main components of the graphit/push-project are:
- the push.php executable
- the configuration templates inside the var-folder (see: inventory.json)
- the
inventory.json
-file which holds data regarding the associations between the hosts and the configuration templates and host specific variables. (see: inventory.json)
- the
network.json
-file which holds the key data for the network. (see: network.json)
- the tmp-folder which holds all the generated and collected data.
This is the executable of the push-project.
Usage:
push.php [options] [arguments]
Workflow
The general work flow when using push to handle host configuration files is to:
- Create/Update the
network.json
-file by hand if need be. This is the case whenever a new network host group is added. (see: network.json)
- Create/Update the
inventory.json
-file using the inventory:xxx
-commands of push. (see: inventory.json and push.php).
- In case no dynamic data for the host exists, collect the dynamic data (/etc/network/interfaces and /etc/fstab) using
dynamic:acquire
. (see: push.php)
- Generate the files which need to be synched to the host using the
configuration:xxx
-commands of push. (see: push.php)
- Compare the generated configuration files of a host against the existing configuration using the
configuration:diffsync
-command of push. (see: push.php)
- Copy/Apply the newly generated configuration files to the host using the
configuration:diffsync
-command of push. (see: push.php)
Folders
Here's an overview of the folders which are present inside the project folder.
- bin: contains the push.php executable file
- doc: contains the documentation of the project
- etc: contains
- host and template specific variables for each host (To which groups does the host belong? What IP, MAC adress does it have? Which configuration groups does it belong to? ... ) inside the inventory.json-file.
- the basic configuration of the network itself inside the network.json-file. (What's the domain name? Subnet? IP ranges? Which host groups exist? Which routers and nameservers exist?)
- helper: contains a helper script to remove unneeded services from workstations.
- lib: contains our extension of the ReactPHP-project
- src: contains the rest of the source code of the graphit/push-project.
- var: contains configuration templates which can be processed using the push.php together with the network and host specific configurations (inventory.json, network.json, dynamic.json).
- tmp: contains:
- generated configurations created and updated by
push configuration:generate
and push configuration:allgenerate
. (see: push.php)
- the dynamic.json-file which contains data about the fstab and main network interface of the host and is created and updated by
push dynamic:acquire
. (see: push.php)