From 6aa7e75c0aba7255559b9742a702e2046c2892d9 Mon Sep 17 00:00:00 2001 From: Josh Matthews Date: Mon, 5 Feb 2018 14:27:32 -0500 Subject: [PATCH] Add saltbot. --- saltbot/files/saltbot.conf | 8 +++++++ saltbot/init.sls | 43 ++++++++++++++++++++++++++++++++++++++ saltbot/map.jinja | 5 +++++ top.sls | 1 + 4 files changed, 57 insertions(+) create mode 100644 saltbot/files/saltbot.conf create mode 100644 saltbot/init.sls create mode 100644 saltbot/map.jinja diff --git a/saltbot/files/saltbot.conf b/saltbot/files/saltbot.conf new file mode 100644 index 00000000..a8e81e76 --- /dev/null +++ b/saltbot/files/saltbot.conf @@ -0,0 +1,8 @@ +exec nodejs /home/saltbot/saltbot/bot.js + +start on (local-filesystems and net-device-up IFACE!=lo) +stop on runlevel [016] + +env HOME=/root/saltbot + +chdir /root/saltbot/ diff --git a/saltbot/init.sls b/saltbot/init.sls new file mode 100644 index 00000000..bd4b3365 --- /dev/null +++ b/saltbot/init.sls @@ -0,0 +1,43 @@ +{% from tpldir ~ '/map.jinja' import bot %} + +npm: + pkg.installed: + - name: nodejs + - version: 8.9.4-1nodesource1 + - skip_verify: True + +saltbot: + git.latest: + - branch: master + - target: /root/saltbot/ + - name: https://github.com/jdm/saltbot.git + - rev: {{ bot.rev }} + npm.bootstrap: + - name: /root/saltbot/ + - require: + - pkg: npm + - git: saltbot + service.running: + - enable: True + - name: saltbot + - require: + - npm: saltbot + - watch: + - file: /etc/init/saltbot.conf + - git: saltbot + +node-ppa: + pkgrepo.managed: + - humanname: Node PPA + - name: deb https://deb.nodesource.com/node_8.x trusty main + - require_in: + - pkg: npm + +/etc/init/saltbot.conf: + file.managed: + - source: salt://{{ tpldir }}/files/saltbot.conf + - user: root + - group: root + - mode: 644 + - require: + - git: saltbot \ No newline at end of file diff --git a/saltbot/map.jinja b/saltbot/map.jinja new file mode 100644 index 00000000..2ac73feb --- /dev/null +++ b/saltbot/map.jinja @@ -0,0 +1,5 @@ +{% + set bot = { + 'rev': '8fe6e22293ffca887a5de421c0c8f02c75756370' + } +%} diff --git a/top.sls b/top.sls index 24940135..ac828932 100644 --- a/top.sls +++ b/top.sls @@ -48,4 +48,5 @@ base: - intermittent-failure-tracker - upstream-wpt-webhook - nginx + - saltbot - salt.master