Gansible

Installation, usage

cd /path/to/gansible
go build
=> Generates executable file gansible

To run the program:
./gansible <host> <action> <argument>
<host> machine to deploy - corresponds to a directory in conf/
<action> possible action (see full list below)
<argument> optional argument for the action

Configuration

Before using gansible:
cp -r conf.dist/ conf
and adapt parameters.
conf/
    ├── global.yml                  # configuration applied to all hosts by default - can be redefined in each host configuration
    └── mydeployment                # configuration of host call "hdist" (replace "hdist" by a name identifying your host)
        ├── apps
        │   ├── myapp.yml           # example of a web application in go
        │   ├── mypod.yml           # example of an application deployed with podman
        │   ├── secrets
        │   │   └── myapp.env
        │   └── site.fr.yml         # example of a web site
        └── myhost.yml              # machine-wide configuration or parameters that can be used by all apps by default
Notes
  • To use the host name in gansible commands, you need to add a line in /etc/hosts, for ex: 1.2.3.4 myhost
    WARNING: the yaml file name (myhost.yml) must correspond to the host name added in /etc/hosts (myhost).

Run

Typical sequence to deploy a machine:
./gansible hdist init
./gansible hdist system
./gansible hdist postgresql init

# if "all" instead of "myapp" => all apps of this server
./gansible hdist user myapp
./gansible hdist db myapp
./gansible hdist secret myapp
./gansible hdist service myapp

Possible actions

Action [param]Description
System-wide actions
init
system
crowdsec
postgresql restart
postgresql reload
postgresql stop
postgresql start
postgresql status
postgresql init
postgresql pgbackrest
postgresql pgdump
clean pgdump
commit
caddyreload
Application actions
ftp
user
site
service
list
status
restart
start
stop
db
secret