diff options
author | Pedro Alvarez Piedehierro <palvarez89@gmail.com> | 2017-05-15 22:14:43 +0100 |
---|---|---|
committer | Pedro Alvarez Piedehierro <palvarez89@gmail.com> | 2017-05-15 22:16:16 +0100 |
commit | 9ea4b18fff0ad4d50a690c6f18145bf360080891 (patch) | |
tree | cdb09198c92c22b1958b5b3dd540d51a6f411a3c | |
parent | 65ba468bf9277393a861ef61f5f6ba77523edfd5 (diff) | |
download | infrastructure-9ea4b18fff0ad4d50a690c6f18145bf360080891.tar.gz |
Add Ansible scripts for Gitlab IRC bot
-rw-r--r-- | baserock_bots/config.js | 30 | ||||
-rw-r--r-- | baserock_bots/gitlab-bot.yml | 41 | ||||
-rw-r--r-- | baserock_bots/gitlab-bst-bot.conf | 19 | ||||
-rw-r--r-- | baserock_bots/gitlab_buildstream_secret.yml | 8 |
4 files changed, 98 insertions, 0 deletions
diff --git a/baserock_bots/config.js b/baserock_bots/config.js new file mode 100644 index 00000000..5c8ea793 --- /dev/null +++ b/baserock_bots/config.js @@ -0,0 +1,30 @@ +module.exports = { + // IRC server to connect to. + server: 'irc.gimp.org', + + // List of channels / people to report to. + reports: { + '#buildstream': ['push', 'merge_request', 'issue'] + // 'somebody': ['push', 'merge_request', 'issue', 'build'] + }, + + // IRC nick/names for the bot + nick: 'gitlab-bst', + userName: 'gitlab-bst', + realName: 'Gitlab Bot for BuildStream', + + // Secret as entered in the Gitlab Webhook instance. + secret: '{{ gitlab_buildstream_secret }}', + + // Port on which to run. + port: 1337, + + // Network interface on which to run the webhook server. + hostname: '0.0.0.0', + + // Instance of lstu to shorten links -- keep empty to not use. + //lstu: 'https://lstu.fr', + + // Whether the irc client debug messages should be printed. + debug: true +} diff --git a/baserock_bots/gitlab-bot.yml b/baserock_bots/gitlab-bot.yml new file mode 100644 index 00000000..f47cacd9 --- /dev/null +++ b/baserock_bots/gitlab-bot.yml @@ -0,0 +1,41 @@ +# Instance-specific configuration for the BuildStream Gitlab IRC bot +--- +- hosts: paste + vars_files: + - gitlab_buildstream_secret.yml + vars: + - gitlab_to_irc_url: https://framagit.org/bnjbvr/gitlab-to-irc + - gitlab_to_irc_branch: master + - gitlab_to_irc_install_location: /home/ubuntu/gitlab-to-irc + tasks: + - name: Download gitlab-to-irc sources + git: + repo: "{{ gitlab_to_irc_url }}" + version: "{{ gitlab_to_irc_branch }}" + dest: "{{ gitlab_to_irc_install_location }}" + + - name: Update packages based on package.json to their latest version. + npm: + path: "{{ gitlab_to_irc_install_location }}" + state: latest + + - name: Install bot configuration file + template: + src: config.js + dest: "{{ gitlab_to_irc_install_location }}/config.js" + + + - name: Install service for the bot + template: + src: gitlab-bst-bot.conf + dest: /etc/init/gitlab-bst-bot.conf + become: yes + + + - name: Start bot service + service: + name: gitlab-bst-bot + enabled: yes + state: started + become: yes + diff --git a/baserock_bots/gitlab-bst-bot.conf b/baserock_bots/gitlab-bst-bot.conf new file mode 100644 index 00000000..b34026a8 --- /dev/null +++ b/baserock_bots/gitlab-bst-bot.conf @@ -0,0 +1,19 @@ +# /etc/init/gitlab-bst-bot.conf + +description "Gitlab irc notifications server" + +start on startup +stop on shutdown + + +# Automatically Respawn: +respawn +respawn limit 99 5 + +setuid ubuntu +setgid ubuntu + +script + cd {{ gitlab_to_irc_install_location }} + exec sudo node index.js +end script diff --git a/baserock_bots/gitlab_buildstream_secret.yml b/baserock_bots/gitlab_buildstream_secret.yml new file mode 100644 index 00000000..53ae22e0 --- /dev/null +++ b/baserock_bots/gitlab_buildstream_secret.yml @@ -0,0 +1,8 @@ +$ANSIBLE_VAULT;1.1;AES256 +35376536656664653761336331643738343738643365623832626464313335383439623761313434 +3634373330363634666566353766373862643266373431380a396566356261653937343131666338 +36356133636465323135643264306461386437613064636164656361656264616239333236353430 +3734343639313337620a396431356335376638316339646362633436613065646366326134363032 +61613132383832346637396666373761363230666234303530646533336363653139643264623862 +39616663643138623538383336323538313963396463653563643134326664643930303135383039 +623636663031333934633261663436303735 |