Skip to content

Instantly share code, notes, and snippets.

@scub
Last active March 18, 2018 17:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save scub/2d01605975733a1077449377fb04abe3 to your computer and use it in GitHub Desktop.
Save scub/2d01605975733a1077449377fb04abe3 to your computer and use it in GitHub Desktop.

Rendered consul.service

                  [Install]
                  wantedby = multi-user.target

                  [Service]
                  execstart = /usr/local/bin/consul agent -config-dir=/etc/consul.d/server
                  group = consul
                  environemnt = GOMAXPROCS=2
                  environemntfile = -/etc/sysconfig/consul
                  user = consul
                  killsignal = SIGINT
                  execreload = /bin/kill -s HUP $MAINPID
                  timeoutstopsec = 5
                  restart = on-failure

                  [Unit]
                  after = network.target
                  requires = network-online.target
                  description = Consul service discovery server
                  ```
consul:
unitfile:
Unit:
Description: 'Consul service discovery server'
Requires: 'network-online.target'
After: 'network.target'
Service:
User: 'consul'
Group: 'consul'
Restart: 'on-failure'
EnvironemntFile: '-/etc/sysconfig/consul'
Environemnt: 'GOMAXPROCS=2'
ExecStart: '/usr/local/bin/consul agent -config-dir=/etc/consul.d/server'
ExecReload: '/bin/kill -s HUP $MAINPID'
KillSignal: 'SIGINT'
TimeoutStopSec: '5'
Install:
WantedBy: 'multi-user.target'
consul_install_create_daemon_unit_file:
file.serialize:
- name: '/etc/systemd/system/consul.service'
- dataset: {{ consul.unitfile }}
- formatter: 'configparser'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment