Skip to content

Instantly share code, notes, and snippets.

@melekes
Last active April 24, 2017 13:28
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 melekes/3cda2237f9cb7d2d525677239a103338 to your computer and use it in GitHub Desktop.
Save melekes/3cda2237f9cb7d2d525677239a103338 to your computer and use it in GitHub Desktop.
Ansible playbook for ABCI counter app https://github.com/tendermint/abci/tree/master/cmd/counter
[Unit]
Description=Counter
Requires=network-online.target
After=network-online.target
[Service]
Environment=""
Restart=on-failure
User={{ user }}
Group={{ group }}
PermissionsStartOnly=true
ExecStart=/usr/local/bin/counter --addr="unix:///socks/app.sock"
ExecReload=/bin/kill -HUP $MAINPID
KillSignal=SIGINT
[Install]
WantedBy=multi-user.target
---
- hosts: all
handlers:
- name: reload systemd
become: true
command: systemctl daemon-reload
tasks:
- name: create log directory if it does not exist
file: >
state=directory
path=/socks
owner={{ user }}
group={{ group }}
- name: change file permissions
file: >
path=/usr/local/bin/counter
owner={{user}}
group={{group}}
mode=0755
- name: copy systemd script
template: >
src="counter.systemd.j2"
dest=/etc/systemd/system/counter.service
owner=root
group=root
mode=0644
notify:
- reload systemd
- service: >
name=counter
state=started
enabled=yes
vars:
user: tendermint
group: tendermint
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment