├── LICENSE ├── README.md ├── ghe-configuration ├── ghe-config.json └── github-enterprise.ghl ├── group_vars └── github └── provision-ghe.yml /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Jamie Jones 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # GitHub Enterprise Deployment and Configuration 2 | 3 | This playbook deploys and configures an instance of GitHub Enterprise into the Amazon Web Services (AWS) cloud. To use it, first edit the `group_vars/github` inventory file to contain the details of your Amazon subscription, instance deployment details as well as the preferred management console password for your new instance. 4 | 5 | Then run the playbook, like this: 6 | 7 | ansible-playbook -i provision-ghe.yml 8 | 9 | When the playbook run completes, you should be able to see the GitHub Enterprise instance running in the AWS account you provided. 10 | 11 | This is a very simple playbook and could serve as a starting point for more complete GitHub Enterprise configuration playbooks. 12 | 13 | ### Ideas for Improvement 14 | 15 | Here are some ideas for ways that this playbook could be extended: 16 | 17 | - Include more than AWS as deployment options. Seperate relevant configuration variables into necessary files. 18 | - Update the playbook and GitHub Enterprise configuration to use the latest release (2.8.6 at the time of this writing) and related API. 19 | 20 | We would love to see contributions and improvements, so please fork this repository on GitHub and send us your changes via pull requests. 21 | 22 | ### Credits 23 | This playbook was originally created by Lee Faus ([**@leefaus**](https://github.com/leefaus)). He's pretty good at this stuff. 24 | -------------------------------------------------------------------------------- /ghe-configuration/ghe-config.json: -------------------------------------------------------------------------------- 1 | { 2 | "private_mode": false, 3 | "signup_enabled": true, 4 | "github_hostname": "github.example.com", 5 | "github_ssl": { 6 | "enabled": false, 7 | "cert": null, 8 | "key": null 9 | }, 10 | "auth_mode": "default" 11 | } 12 | -------------------------------------------------------------------------------- /ghe-configuration/github-enterprise.ghl: -------------------------------------------------------------------------------- 1 | GitHub Enterprise license should replace this file 2 | -------------------------------------------------------------------------------- /group_vars/github: -------------------------------------------------------------------------------- 1 | --- 2 | ec2_access_key: {} 3 | ec2_secret_key: {} 4 | ec2_region: us-east-1 5 | ec2_zone: 6 | ec2_image: ami-511ba53a #GitHub Enterprise v2.3.2 7 | ec2_instance_type: r3.large 8 | ec2_keypair: mykey 9 | ec2_security_group: ghe 10 | ec2_instance_count: 1 11 | ec2_tag: ghe 12 | ebs_optimized: yes 13 | server_type: ghe-server 14 | aws_timeout: 320 15 | mc_password: 16 | 17 | -------------------------------------------------------------------------------- /provision-ghe.yml: -------------------------------------------------------------------------------- 1 | --- 2 | #Provision GitHub Enterprise 3 | - hosts: localhost 4 | gather_facts: False 5 | 6 | vars_files: 7 | - group_vars/github 8 | 9 | tasks: 10 | - name: Launch AWS GHE Instance 11 | ec2: 12 | access_key: "{{ ec2_access_key }}" 13 | secret_key: "{{ ec2_secret_key }}" 14 | keypair: "{{ ec2_keypair }}" 15 | group: "{{ ec2_security_group }}" 16 | type: "{{ ec2_instance_type }}" 17 | image: "{{ ec2_image }}" 18 | region: "{{ ec2_region }}" 19 | instance_tags: "{'group':'{{ ec2_security_group }}','Name':'{{ server_type }}'}" 20 | count: "{{ ec2_instance_count }}" 21 | wait: true 22 | volumes: 23 | - volume_size: 10 24 | device_name: /dev/sdb 25 | device_type: gp2 26 | delete_on_termination: true 27 | register: ec2 28 | 29 | - name: Wait for Admin Port to come up (Port 8443) 30 | wait_for: host={{ item.public_dns_name }} port=8443 delay=60 timeout={{ aws_timeout }} state=started 31 | with_items: ec2.instances 32 | 33 | - name: Setup License and Admin Password 34 | local_action: command curl -L -X POST -k 'https://{{ ec2.instances[0].public_ip }}:8443/setup/api/start' -F license=@ghe-configuration/github-enterprise.ghl -F "password={{ mc_password }}" 35 | 36 | - name: Configure Instance Through JSON 37 | local_action: command curl -L -X PUT -k 'https://api_key:{{ mc_password }}@{{ ec2.instances[0].public_ip }}:8443/setup/api/settings' --data-urlencode "settings=`cat ghe-configuration/ghe-config.json`" 38 | 39 | - name: Rerun Configure for Settings to Take Effect 40 | local_action: command curl -L -X POST -k 'https://api_key:{{ mc_password }}@{{ ec2.instances[0].public_ip }}:8443/setup/api/configure' 41 | 42 | - name: Wait for Non-HTTPS Web Admin (Port 8080) 43 | wait_for: host={{ ec2.instances[0].public_ip }} port=8080 delay=60 timeout={{ aws_timeout }} state=started 44 | --------------------------------------------------------------------------------