diff --git a/playbooks/edx-east/gerrit_deploy.yml b/playbooks/edx-east/gerrit_deploy.yml deleted file mode 100644 index 8bdd13b..0000000 --- a/playbooks/edx-east/gerrit_deploy.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -# Deploys gerrit on to a server. -# -# Usage: -# ansible-playbook gerrit_deploy.yml -i gerrit_inventory.ini -e "secure_dir=/path/to/secure/dir" - -- name: Install and configure gerrit - hosts: gerrit - sudo: True - gather_facts: True - vars_files: - - "{{ secure_dir }}/vars/gerrit.yml" - pre_tasks: - - name: update apt - apt: update_cache=yes - roles: - - gerrit diff --git a/playbooks/roles/gerrit/defaults/main.yml b/playbooks/roles/gerrit/defaults/main.yml deleted file mode 100644 index f44f9dd..0000000 --- a/playbooks/roles/gerrit/defaults/main.yml +++ /dev/null @@ -1,27 +0,0 @@ ---- -# -# 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 gerrit -# - -gerrit_app_dir: "{{ COMMON_APP_DIR }}/gerrit" -gerrit_data_dir: "{{ COMMON_DATA_DIR }}/gerrit" - -gerrit_debian_pkgs: - - python-mysqldb - - python-boto -gerrit_release: 2.8.1 -gerrit_user: gerrit2 -gerrit_db_name: reviewdb -gerrit_http_port: 8080 -gerrit_sshd_port: 29418 -gerrit_jre_path: /usr/lib/jvm/java-7-oracle/jre -gerrit_java_exe_path: "{{ gerrit_jre_path }}/bin/java" -gerrit_repo_volume_os_device: /dev/xvdf diff --git a/playbooks/roles/gerrit/handlers/main.yml b/playbooks/roles/gerrit/handlers/main.yml deleted file mode 100644 index 1e3889c..0000000 --- a/playbooks/roles/gerrit/handlers/main.yml +++ /dev/null @@ -1,18 +0,0 @@ ---- -# -# 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 -# -# -# -# Handlers for role gerrit - -- name: gerrit restarted - service: name=gerrit state=restarted - -- name: nginx restarted - service: name=nginx state=restarted diff --git a/playbooks/roles/gerrit/meta/main.yml b/playbooks/roles/gerrit/meta/main.yml deleted file mode 100644 index 09ad458..0000000 --- a/playbooks/roles/gerrit/meta/main.yml +++ /dev/null @@ -1,5 +0,0 @@ ---- -dependencies: - - role: oraclejdk - - role: nginx - nginx_sites: [] diff --git a/playbooks/roles/gerrit/tasks/main.yml b/playbooks/roles/gerrit/tasks/main.yml deleted file mode 100644 index 625bf39..0000000 --- a/playbooks/roles/gerrit/tasks/main.yml +++ /dev/null @@ -1,169 +0,0 @@ ---- -# -# 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 gerrit -# -# Overview: Installs and configures Gerrit on the server. Requires -# several secure variables to be defined that are not defined in this -# role. -# -# -# Dependencies: -# - An existing running database. -# - An S3 bucket containing all of the necessary plugin jars. -# - In addition to the variables defined in defaults/main.yml, the following variables must be defined: -# -# gerrit_github_client_id: alskdjdfkjasdjfsdlfkj -# gerrit_github_client_secret: 0938908450deffaaa87665a555a6fc6de5777f77f -# gerrit_db_hostname: somedb.88374jhyehf.us-east-1.rds.amazonaws.com -# gerrit_db_admin_username: adminuser -# gerrit_db_admin_password: adminpassword -# gerrit_db_password: gerrituserpassword -# gerrit_artifact_s3_bucket: -# name: some-s3-bucket -# aws_access_key_id: "{{ lookup('env', 'AWS_ACCESS_KEY_ID') }}" -# aws_secret_access_key: "{{ lookup('env', 'AWS_SECRET_ACCESS_KEY') }}" -# gerrit_hostname: "gerrit.example.com" -# gerrit_smtp_enabled: false -# gerrit_email: gerrit@example.com -# gerrit_smtp_server: smtp.example.com -# gerrit_smtp_encryption: none -# gerrit_smtp_user: someuser -# gerrit_smtp_pass: somepassword -# -# -# Example play: -# -# - name: Deploy gerrit -# hosts: gerrit -# gather_facts: True -# sudo: True -# roles: -# - gerrit - -- name: system package pre-requisites installed - apt: pkg={{ item }} - with_items: gerrit_debian_pkgs - -- name: user - user: name={{ gerrit_user }} system=yes home={{ gerrit_app_dir }} createhome=no - -- name: directories created - file: path={{ item }} mode=700 owner={{ gerrit_user }} state=directory - with_items: - - "{{ gerrit_app_dir }}" - - "{{ gerrit_app_dir }}/etc" - - "{{ gerrit_data_dir }}" - -- name: repository volume fs exists - shell: file -s {{ gerrit_repo_volume_os_device }} | grep ext4 - ignore_errors: yes - register: is_formatted - -- name: repository volume formatted - command: mkfs -t ext4 {{ gerrit_repo_volume_os_device }} - when: is_formatted | failed - -- name: fstab includes repository volume - lineinfile: > - dest=/etc/fstab - regexp="^{{ gerrit_repo_volume_os_device }}\s" - line="{{ gerrit_repo_volume_os_device }} {{ gerrit_data_dir }} ext4 defaults 0 2" - -# output will look roughly like: -# /dev/foo on /some/mount/point type ext4 (options) -- name: repository volume is mounted - shell: > - mount -l | grep '^{{ gerrit_repo_volume_os_device }} ' - ignore_errors: yes - register: is_mounted - -- name: repository volume mounted - command: mount {{ gerrit_repo_volume_os_device }} - when: is_mounted | failed - -- name: war file downloaded - s3: > - bucket={{ gerrit_artifact_s3_bucket.name }} - object=gerrit-{{ gerrit_release }}.war - dest=/tmp/gerrit.war - mode=get - aws_access_key="{{ gerrit_artifact_s3_bucket.aws_access_key_id }}" - aws_secret_key="{{ gerrit_artifact_s3_bucket.aws_secret_access_key }}" - sudo_user: "{{ gerrit_user }}" - -- name: database created - mysql_db: > - name={{ gerrit_db_name }} - encoding=utf8 - login_host={{ gerrit_db_hostname }} login_user={{ gerrit_db_admin_username }} login_password={{ gerrit_db_admin_password }} - register: db_created - -- name: database user created - mysql_user: > - name={{ gerrit_user }} - password={{ gerrit_db_password }} - host='%' - priv="{{ gerrit_db_name }}.*:ALL" - login_host={{ gerrit_db_hostname }} login_user={{ gerrit_db_admin_username }} login_password={{ gerrit_db_admin_password }} - -- name: configuration uploaded - template: src=gerrit.config.j2 dest={{ gerrit_app_dir }}/etc/gerrit.config mode=600 - sudo_user: "{{ gerrit_user }}" - notify: gerrit restarted - -- name: initialized - command: > - {{ gerrit_java_exe_path }} -jar /tmp/gerrit.war init -d {{ gerrit_app_dir }} --batch --no-auto-start - creates={{ gerrit_app_dir }}/bin - sudo_user: "{{ gerrit_user }}" - notify: gerrit restarted - -- name: artifacts installed from s3 - s3: > - bucket={{ gerrit_artifact_s3_bucket.name }} - object={{ item.jar }} - dest={{ item.dest }}/{{ item.jar }} - mode=get - aws_access_key="{{ gerrit_artifact_s3_bucket.aws_access_key_id }}" - aws_secret_key="{{ gerrit_artifact_s3_bucket.aws_secret_access_key }}" - sudo_user: "{{ gerrit_user }}" - notify: gerrit restarted - with_items: - - { jar: "github-oauth-{{ gerrit_release }}.jar", dest: "{{ gerrit_app_dir }}/lib" } - - { jar: "github-plugin-{{ gerrit_release }}.jar", dest: "{{ gerrit_app_dir }}/plugins" } - - { jar: "singleusergroup-{{ gerrit_release }}.jar", dest: "{{ gerrit_app_dir }}/plugins" } - -- name: plugins installed from war - shell: unzip -p /tmp/gerrit.war WEB-INF/plugins/replication.jar > {{ gerrit_app_dir }}/plugins/replication.jar creates={{ gerrit_app_dir }}/plugins/replication.jar - sudo_user: "{{ gerrit_user }}" - notify: gerrit restarted - -- name: setup ngnix vhost - template: > - src=nginx-gerrit.j2 - dest={{ nginx_sites_available_dir }}/gerrit - -- name: enable gerrit vhost - file: > - src={{ nginx_sites_available_dir }}/gerrit - dest={{ nginx_sites_enabled_dir }}/gerrit - state=link - notify: nginx restarted - -- name: init script configured - template: src=gerritcodereview.j2 dest=/etc/default/gerritcodereview mode=644 - -- name: init script installed - file: src={{ gerrit_app_dir }}/bin/gerrit.sh dest=/etc/init.d/gerrit state=link - -- name: starts on boot - service: name=gerrit enabled=yes diff --git a/playbooks/roles/gerrit/templates/gerrit.config.j2 b/playbooks/roles/gerrit/templates/gerrit.config.j2 deleted file mode 100644 index ed50981..0000000 --- a/playbooks/roles/gerrit/templates/gerrit.config.j2 +++ /dev/null @@ -1,41 +0,0 @@ -# {{ ansible_managed }} - -[gerrit] - basePath = {{ gerrit_data_dir }} - canonicalWebUrl = http://{{ gerrit_hostname }}/ -[database] - type = MYSQL - hostname = {{ gerrit_db_hostname }} - database = {{ gerrit_db_name }} - username = {{ gerrit_user }} - password = {{ gerrit_db_password }} -[auth] - type = HTTP - httpHeader = GITHUB_USER - loginUrl = /login - logoutUrl = /oauth/reset -[sendemail] - enable = {{ gerrit_smtp_enabled }} - smtpServer = {{ gerrit_smtp_server }} - smtpEncryption = {{ gerrit_smtp_encryption }} - smtpUser = {{ gerrit_smtp_user }} - smtpPass = {{ gerrit_smtp_pass }} -[container] - user = {{ gerrit_user }} - javaHome = {{ gerrit_jre_path }} -[sshd] - listenAddress = *:{{ gerrit_sshd_port }} -[httpd] - listenUrl = http://*:{{ gerrit_http_port }}/ - filterClass = com.googlesource.gerrit.plugins.github.oauth.OAuthFilter -[cache] - directory = cache -[github] - url = https://github.com - clientId = {{ gerrit_github_client_id }} - clientSecret = {{ gerrit_github_client_secret }} -[user] - email = {{ gerrit_email }} - anonymousCoward = Anonymous User -[suggest] - accounts = true diff --git a/playbooks/roles/gerrit/templates/gerritcodereview.j2 b/playbooks/roles/gerrit/templates/gerritcodereview.j2 deleted file mode 100644 index ce69859..0000000 --- a/playbooks/roles/gerrit/templates/gerritcodereview.j2 +++ /dev/null @@ -1 +0,0 @@ -export GERRIT_SITE={{ gerrit_app_dir }} diff --git a/playbooks/roles/gerrit/templates/nginx-gerrit.j2 b/playbooks/roles/gerrit/templates/nginx-gerrit.j2 deleted file mode 100644 index fe51dda..0000000 --- a/playbooks/roles/gerrit/templates/nginx-gerrit.j2 +++ /dev/null @@ -1,11 +0,0 @@ -server { - listen 80; - server_name {{ gerrit_hostname }}; - - location / { - proxy_pass http://localhost:{{ gerrit_http_port }}; - proxy_set_header Host $host; - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - } -} \ No newline at end of file