--- /dev/null
+---
+
+- hosts: kraken
+ roles:
+ - kraken
+ vars:
+ ansible_ssh_user: "centos"
+
+ # bot specific vars
+ venv: "{{ helga_home }}/venv"
+ helga_nick: 'kraken'
+ helga_irc_host: irc.devel.redhat.com
+ helga_irc_port: 6667
+ helga_use_ssl: false
+ helga_cmd_prefix: '!'
+
+ helga_irc_channels:
+ - bogus
+
+ helga_operators: ['alfredodeza', 'ktdreyer', 'andrewschoen']
+ helga_default_plugins:
+ - dubstep
+ - facts
+ - help
+ - manager
+ - meant_to_say
+ - oneliner
+ - operator
+ - stfu
+ # custom ones
+ - norris
+ - redmine
+ - yall
+ - ugrep
+ - wut
+ - jenkins
+ - excuses
+ - poems
+ - reminders
+ - karma
+ - bugzilla
+
+ helga_external_plugins:
+ - git+https://github.com/alfredodeza/helga-norris#egg=helga-norris
+ - git+https://github.com/alfredodeza/helga-yall#egg=helga-yall
+ - git+https://github.com/alfredodeza/helga-ugrep#egg=helga-ugrep
+ - git+https://github.com/alfredodeza/helga-wut#egg=helga-wut
+ - git+https://github.com/alfredodeza/helga-karma#egg=helga-karma
+ - git+https://github.com/alfredodeza/helga-jenkins#egg=helga-jenkins
+ - git+https://github.com/alfredodeza/helga-excuses#egg=helga-excuses
+
+ helga_pypi_plugins:
+ - helga-redmine
+ - helga-poems
+ - helga-reminders
+ - helga-facts
+ - helga-bugzilla
+ - helga-pika
+
+ bugzilla_xmlrpc_url: 'https://bugzilla.redhat.com/xmlrpc.cgi'
+ bugzilla_ticket_url: 'https://bugzilla.redhat.com/%(ticket)s'
+
+ helga_twitter_consumer_key: "key"
+ helga_twitter_consumer_secret: "consumer_secret"
+ helga_twitter_oauth_token: "token"
+ helga_twitter_oauth_token_secret: "token_secret"
+ helga_twitter_username: "username"
+
+ # needed for helga-pika
+ rabbitmq_user: ""
+ rabbitmq_password: ""
+ rabbitmq_host: ""
+ rabbitmq_exchange:""
+ rabbitmq_routing_keys: []
+
+ # needed for helga-redmine
+ redmine_url: ''
+ # This API key corresponds to the Kraken system account in Ceph's Redmine.
+ redmine_api_key: ''
+
+ # needed for helga-jenkins
+ jenkins_url: ''
+ jenkins_credentials: {}
--- /dev/null
+---
+helga_home: /opt/helga
+helga_settings_path: '{{ helga_home }}/bin/settings.d'
+helga_nick: helga
+helga_irc_host: localhost
+helga_irc_port: 6667
+helga_use_ssl: yes
+helga_operators: []
+helga_irc_channels:
+- "#bots"
+helga_timezone: 'UTC'
+helga_default_plugins:
+- dubstep
+- facts
+- help
+- manager
+- meant_to_say
+- oneliner
+- operator
+- poems
+- reminders
+- stfu
+
+helga_external_plugins: []
+helga_cmd_prefix: '!'
+helga_webhooks_port: 8080
+helga_twitter_api_key: null
+helga_twitter_api_secret: null
+helga_twitter_oauth_token: null
+helga_twitter_oauth_secret: null
+helga_twitter_username: null
+helga_system_packages:
+ - python-devel
+ - git
+ - python-virtualenv
+ - mongodb-server
+ - gcc-c++
+
+helga_ssl_requirements:
+ - openssl
+ - openssl-devel
--- /dev/null
+---
+
+- name: restart helga service
+ service:
+ name: helga
+ status: restarted
--- /dev/null
+---
+
+- name: Create a home for Helga.
+ become: yes
+ file:
+ path: {{ helga_home }}
+ owner: {{ ansible_ssh_user }}
+ group: {{ ansible_ssh_user }}
+ state: directory
+ recurse: yes
+
+- name: Install ssl requirements.
+ become: yes
+ yum:
+ name: {{ item }}
+ state: present
+ with_items: helga_ssl_requirements
+ when: helga_use_ssl
+
+- name: Install GCC
+ become: yes
+ yum:
+ name: gcc
+ state: present
+
+- name: Enable EPEL
+ become: yes
+ yum:
+ name: epel-release
+ state:present
+
+- name: Retrieve software requirements.
+ become: yes
+ yum:
+ name: {{ item }}
+ state: present
+ with_items: "{{ helga_system_packages }}"
+
+- name: Create a virtualenv with latest pip.
+ pip:
+ name: pip
+ virtualenv: {{ helga_home }}
+ extra_args: '--upgrade'
+
+- name: Install Helga.
+ pip:
+ name: helga
+ virtualenv: {{ helga_home }}
+
+- name: Install Helga unreleased enhancements.
+ pip:
+ name: {{ item }}
+ state: present
+ extra_args: "-e"
+ virtualenv: {{ helga_home }}
+ with_items: "{{ helga_external_plugins }}"
+ notify: restart helga service
+
+- name: Install Helga released enhancements.
+ pip:
+ name: {{ item }}
+ state: latest
+ virtualenv: {{ helga_home }}
+ with_items: "{{ helga_pypi_plugins }}"
+ notify: restart helga service
+
+- name: Create settings directory
+ file:
+ path: {{ helga_settings_path }}
+ state: directory
+
+- name: Install base personality.
+ template:
+ src: custom_settings.j2
+ dest: {{ helga_settings_path }}/00_base_settings.py
+
+- name: Install personality customizations (files).
+ copy:
+ src: {{ item }}
+ dest: {{ helga_settings_path }}
+# this one is tricky, because the relative path is relative to
+# roles/common/files
+ with_fileglob:
+ - helga/settings.d/*
+
+- name: Custom settings, ASSEMBLE!
+ assemble:
+ src: {{ helga_settings_path }}/
+ dest: {{ helga_home }}/bin/custom_settings.py
+
+- name: ensure mongod is running
+ become: true
+ service:
+ name: mongod
+ state: started
+
+- name: ensure mongod is set to start at boot (enabled)
+ become: true
+ service:
+ name: mongod
+ enabled: true
+
+- include: systemd.yml
--- /dev/null
+---
+
+
+- name: ensure /etc/sysconfig/ dir exists
+ sudo: true
+ file:
+ path: /etc/sysconfig
+ state: directory
+
+# prevents issues when updating systemd files
+- name: reload systemd
+ sudo: yes
+ command: systemctl daemon-reload
+
+- name: install the systemd configuration file for celery
+ template:
+ src: helga.sysconfig.j2
+ dest: /etc/sysconfig/helga
+ sudo: true
+ notify:
+ - reload systemd
+
+- name: install the systemd unit file for helga
+ template:
+ src: helga.service.j2
+ dest: /etc/systemd/system/helga.service
+ sudo: true
+ notify:
+ - reload systemd
+
+- name: ensure helga is enabled and running
+ sudo: true
+ service:
+ name: helga
+ state: running
+ enabled: yes
--- /dev/null
+[watcher:helga]
+cmd = {{ helga_home }}/bin/helga
+
+stdout_stream.class = FileStream
+stdout_stream.filename=/var/log/circus/helga-stdout.log
+
+stderr_stream.class = FileStream
+stderr_stream.filename=/var/log/circus/helga-stderr.log
+
+
+[env:helga]
+HELGA_SETTINGS=custom_settings
+
+
+[circus]
+statsd = 1
+httpd = 1
+
+[watcher:webapp]
+cmd = {{ helga_home }}/bin/chaussette --fd $(circus.sockets.web)
+numprocesses = 3
+use_sockets = True
+
+[socket:web]
+host = 0.0.0.0
+port = 9999
--- /dev/null
+NICK = '{{ helga_nick }}'
+
+SERVER = {
+ 'HOST': '{{ helga_irc_host }}',
+ 'PORT': {{ helga_irc_port }},
+ 'SSL': {{ helga_use_ssl }},
+}
+
+CHANNELS = [
+ {% for channel in helga_irc_channels %}
+ ('{{ channel }}',),
+ {% endfor %}
+]
+
+OPERATORS = [
+ {% for operator in helga_operators %}
+ '{{ operator }}',
+ {% endfor %}
+]
+
+TIMEZONE = '{{ helga_timezone }}'
+
+ENABLED_PLUGINS = [
+ {% for plugin in helga_default_plugins %}
+ '{{ plugin }}',
+ {% endfor %}
+ {% for plugin in helga_external_plugins %}
+ '{{ plugin }}',
+ {% endfor %}
+]
+
+COMMAND_PREFIX_CHAR = '{{ helga_cmd_prefix }}'
+WEBHOOKS_PORT = {{ helga_webhooks_port }}
+
+# Twitter API
+TWITTER_CONSUMER_KEY = {{ helga_twitter_api_key }}
+TWITTER_CONSUMER_SECRET = {{ helga_twitter_api_secret }}
+TWITTER_OAUTH_TOKEN = {{ helga_twitter_oauth_token }}
+TWITTER_OAUTH_TOKEN_SECRET = {{ helga_twitter_oauth_secret }}
+TWITTER_USERNAME = {{ helga_twitter_username }}
+
+BUGZILLA_XMLRPC_URL = "{{ bugzilla_xmlrpc_url }}"
+BUGZILLA_TICKET_URL = "{{ bugzilla_ticket_url }}"
+
+FACTS_REQUIRE_NICKNAME = True
+
+RABBITMQ_USER = ""
+RABBITMQ_PASSWORD= ""
+RABBITMQ_HOST = ""
+RABBITMQ_EXCHANGE= ""
+
+RABBITMQ_ROUTING_KEYS = []
+
+REDMINE_URL = ''
+# This API key corresponds to the Kraken system account in Ceph's Redmine.
+REDMINE_API_KEY = ''
+
+JENKINS_URL = ''
+
+JENKINS_CREDENTIALS = {}
--- /dev/null
+[Unit]
+Description=helga (kraken) bot service
+After=network.target
+
+[Service]
+Type=simple
+ExecStart={{ app_home }}/bin/helga
+EnvironmentFile=/etc/sysconfig/helga
+User={{ ansible_ssh_user }}
+WorkingDirectory={{ app_home }}/src/
+StandardOutput=journal
+StandardError=journal
+
+[Install]
+WantedBy=multi-user.target
--- /dev/null
+HOME=/home/{{ ansible_ssh_user }}
+HELGA_SETTINGS=custom_settings