Commit 168ecc59 by Brian Beggs

Merge pull request #2803 from edx/bbeggs/go-server

New playbook and role for go-server
parents bad209ac 44158404
# ansible-playbook -i 'admin.edx.org,' ./hotg.yml -e@/path/to/ansible/vars/edx.yml -e@/path/to/secure/ansible/vars/edx_admin.yml
- name: Install go-server
hosts: all
sudo: True
gather_facts: True
roles:
- aws
- supervisor
- go-server
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
# Defaults for role gocd
#
GO_SERVER_SERVICE_NAME: "go-server"
GO_SERVER_USER: "go"
GO_SERVER_GROUP: "{{ GO_SERVER_USER }}"
GO_SERVER_VERSION: "16.1.0-2855"
GO_SERVER_HOME: "/var/lib/go-server/"
GO_SERVER_CONF_HOME: "/etc/go/"
# Java version settings
GO_SERVER_ORACLEJDK_VERSION: "7u51"
GO_SERVER_ORACLEJDK_BASE: "jdk1.7.0_51"
GO_SERVER_ORACLEJDK_BUILD: "b13"
GO_SERVER_ORACLEJDK_LINK: "/usr/lib/jvm/java-7-oracle"
# java tuning
GO_SERVER_JAVA_HOME: "{{ GO_SERVER_ORACLEJDK_LINK }}"
# Aptitude settings
GO_SERVER_APT_SOURCE: "deb http://dl.bintray.com/gocd/gocd-deb/ /"
GO_SERVER_APT_KEY_URL: "https://bintray.com/user/downloadSubjectPublicKey?username=gocd"
GO_SERVER_APT_NAME: "go-server"
# gocd-oauth-login
GO_SERVER_OAUTH_LOGIN_VERSION: "1.2"
GO_SERVER_OAUTH_LOGIN_MD5: "31ad9ad1fe08452f73c56a44b035ee91"
GO_SERVER_OAUTH_LOGIN_JAR_URL: "https://github.com/gocd-contrib/gocd-oauth-login/releases/download/v{{ GO_SERVER_OAUTH_LOGIN_VERSION }}/github-oauth-login-{{ GO_SERVER_OAUTH_LOGIN_VERSION }}.jar"
GO_SERVER_OAUTH_LOGIN_JAR_DESTINATION: "{{ GO_SERVER_HOME }}/plugins/external/"
# password file setup
GO_SERVER_PASSWORD_FILE_NAME: "password.txt"
GO_SERVER_ADMIN_USERS: ["admin"]
GO_SERVER_CRUISE_CONTROL_DB_DESTIONATION: "/var/lib/go-server/db/h2db/cruise.h2.db"
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
##
# Role includes for role gocd
#
# Example:
#
# dependencies:
# - {
# role: my_role
# my_role_var0: "foo"
# my_role_var1: "bar"
# }
dependencies:
- role: oraclejdk
tags: java
oraclejdk_version: "{{ GO_SERVER_ORACLEJDK_VERSION }}"
oraclejdk_base: "{{ GO_SERVER_ORACLEJDK_BASE }}"
oraclejdk_build: "{{ GO_SERVER_ORACLEJDK_BUILD }}"
oraclejdk_link: "{{ GO_SERVER_ORACLEJDK_LINK }}"
---
#
# edX Configuration
#
# github: https://github.com/edx/configuration
# wiki: https://github.com/edx/configuration/wiki
# code style: https://github.com/edx/configuration/wiki/Ansible-Coding-Conventions
# license: https://github.com/edx/configuration/blob/master/LICENSE.TXT
#
#
#
# Tasks for role go-server
#
# Overview:
#
# Deploys go-server using aptitude!
#
# Dependencies:
# - openjdk7
#
# Example play:
#
# - name: Configure instance(s)
# hosts: go-server
# sudo: True
# vars_files:
# - "{{ secure_dir }}/admin/sandbox.yml"
# gather_facts: True
# roles:
# - common
#
- name: install go-server aptitude repository
apt_repository:
repo: "{{ GO_SERVER_APT_SOURCE }}"
- name: install aptitude key for go-server/go-server
apt_key:
url: "{{ GO_SERVER_APT_KEY_URL }}"
- name: install go-server using apt-get
apt:
name: "{{ GO_SERVER_APT_NAME }}={{ GO_SERVER_VERSION }}"
update_cache: yes
- name: install go-server-oauth-login
get_url:
url: "{{ GO_SERVER_OAUTH_LOGIN_JAR_URL }}"
dest: "{{ GO_SERVER_OAUTH_LOGIN_JAR_DESTINATION }}"
mode: 0776
owner: "{{ GO_SERVER_USER }}"
group: "{{ GO_SERVER_GROUP }}"
- name: setup password file if secret hash exists
template:
src: edx/app/go-server/password.txt.j2
dest: "{{ GO_SERVER_CONF_HOME }}/{{ GO_SERVER_PASSWORD_FILE_NAME }}"
mode: 0600
owner: "{{ GO_SERVER_USER }}"
group: "{{ GO_SERVER_GROUP }}"
when: GO_SERVER_ADMIN_PASSWORD_HASH is defined
- name: install go-server configuration
template:
src: edx/app/go-server/cruise-config.xml.j2
dest: "{{ GO_SERVER_CONF_HOME }}/cruise-config.xml"
mode: 0600
owner: "{{ GO_SERVER_USER }}"
group: "{{ GO_SERVER_GROUP }}"
- name: copy go-server cruise database
copy:
src: cruise.h2.db
dest: "{{ GO_SERVER_CRUISE_CONTROL_DB_DESTIONATION }}"
mode: 0660
owner: "{{ GO_SERVER_USER }}"
group: "{{ GO_SERVER_GROUP }}"
- name: restart go-server
service:
name: "{{ GO_SERVER_SERVICE_NAME }}"
state: restarted
<cruise xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="cruise-config.xsd" schemaVersion="77">
<server artifactsdir="artifacts" siteUrl="http://{{ ansible_fqdn }}:8153" secureSiteUrl="https://{{ ansible_fqdn }}:8154" commandRepositoryLocation="default" serverId="d3a0287d-7698-4afe-a687-c165e8295918">
<security>
<passwordFile path="{{ GO_SERVER_CONF_HOME }}/{{ GO_SERVER_PASSWORD_FILE_NAME }}" />
<admins>
{% for user in GO_SERVER_ADMIN_USERS%}
<user>{{ user }}</user>
{% endfor %}
</admins>
</security>
</server>
</cruise>
\ No newline at end of file
admin:{{ GO_SERVER_ADMIN_PASSWORD_HASH }}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment