Commit ebf3151f by Maruyama

init

parents
---
- name: install development tools
yum: name="@Development tools" state=present
---
- name: download and unarchive git-2.4.3
unarchive: src=https://www.kernel.org/pub/software/scm/git/git-2.4.3.tar.gx dest=/tmp/
- name: configure
command: /tmp/git-2.4.3/configure --prefix=/usr/
args:
chdir: /tmp/git-2.4.3
- name: make
command: /usr/bin/make
args:
chdir: /tmp/git-2.4.3
- name: install
command: /usr/bin/make install
args:
chdir: /tmp/git-2.4.3
---
- name: install bundler
command: /usr/bin/gem install bundler --no-ri --no-rdoc
- name: create db user
postgresql_user: name=gitlab role_attr_flags=CREATEDB
- name: create db
postgresql_db: name=gitlabhq_production owner=gitlab
- name: checkout gitlab
git: repo=https://gitlab.com/gitlab-org/gitlab-ce.git version=8-5-stable clone=yes dest=/home/git/gitlab
become: yes
become_user: git
- name: create config/gitlab.yml
template:
src: templates/gitlab.yml.j2
dest: /home/gitlab/config/gitlab.yml
owner: git
group: git
mode: 0644
- name: create secrets file
copy:
remote_src: true
src: /home/git/gitlab/config/secrets.yml.example
dest: /home/git/gitlab/config/secrets.yml
mode: 0600
become: true
become_user: git
- name: update owner for log dir
command: /bin/chown -R git /home/git/gitlab/log
- name: update owner for tmp dir
command: /bin/chown -R git /home/git/gitlab/tmp
- name: update permission for log dir
command: /bin/chmod -R u+rwX,go-w /home/git/gitlab/log
- name: update permission for tmp dir
command: /bin/chmod -R u+rwX /home/git/gitlab/tmp
- name: update permission for pids dir
command: /bin/chmod -R u+rwX /home/git/gitlab/tmp/pids
- name: update permission for sockets dir
command: /bin/chmod -R u+rwX /home/git/gitlab/tmp/soockets
- name: create uploads dir
command: /bin/mkdir /home/git/gitlab/public/uploads
become: yes
become_user: git
- name: update permission for uploads dir
command: /bin/chmod 0700 /home/git/gitlab/public/uploads
- name: update permission for builds dir
command: /bin/chmod -R u+rwX /home/git/gitlab/builds
- name: update permission for artifacts dir
command: /bin/chmod -R u+rwX /home/git/gitlab/shared/artifacts
- name: create unicorn.yml
template:
src: templates/unicorn.yml.j2
dest: /home/gitlab/config/unicorn.yml
owner: git
group: git
mode: 0644
- name: create rack_attack,rb
copy:
remote_src: true
src: /home/git/gitlab/config/initializers/rack_attack.rb.sample
dest: /home/git/gitlab/config/initializers/rack_attack.rb
become: true
become_user: git
- name: set global config
command: /usr/bin/git config --global core.autocrlf input
become: true
become_user: git
- name: create resque.yml
template:
src: templates/resque.yml.j2
dest: /home/git/gitlab/config/resque.yml
owner: git
group: git
mode: 0644
- name: create database.yml
template:
src: templates/database.yml.j2
dest: /home/git/gitlab/config/database.yml
owner: git
group: git
mode: 0640
- name: install gems
command: /usr/bin/bundle install --deployment --without development test mysql aws kerberos
become: true
become_user: git
- name: install gitlab shell
command: /usr/bin/bundle exec rake gitlab:shell:install REDIS_URL=unix:/tmp/redis.sock RAILS_ENV=production
args:
chdir: /home/git/gitlab
become: true
become_user: git
# TODO review gitlab-shell/config.yml
- name: clone gitlab-workhorse
command: /usr/bin/git clone https://gitlab.com/gitlab-org/gitlab-workhorse.git
args:
chdir: /home/git
become: true
become_user: git
- name: checkout gitlab-workhorse
command: /usr/bin/git checkout 0.6.4
args:
chdir: /home/git/gitlab-workhorse
become: true
become_user: git
- name: install gitlab-workhorse
command: /usr/bin/make
become: true
become_user: git
- name: setup gitlab
expect:
command: /usr/bin/bundle exec rake gitlab:setup RAILS_ENV=production
args:
chdir: /home/git/gitlab
responses:
(?i)*: "yes"
become: true
become_user: git
- name: install init script
copy:
remote_src: true
src: /home/git/gitlab/lib/support/init.d/gitlab
dest: /etc/init.d/gitlab
- name: install default configuration file
copy:
remote_src: true
src: /home/git/gitlab/lib/support/init.d/gitlab.default.sample
dest: /etc/default/gitlab
- name: setup logrotate
copy:
remote_src: true
src: /home/git/gitlab/lib/support/logrotate/gitlab
dest: /etc/logrotate.d/gitlab
- name: compile assets
command: /usr/bin/bundle exec rake assets:precompile RAILS_ENV=production
become: true
become_user: git
- name: start gitlab
service:
name: gitlab
state: started
enabled: yes
---
- name: download and extract
unarchive: src=https://storage.googleapis.com/golang/go1.5.3.linux-amd64.tar.gz dest=/usr/local overwrite=yes
- name: make symlinks
command: /bin/ln -sf /usr/local/go/bin/{go,godoc,gofmt} /usr/bin/
---
- name: add yum repository
yumrepo:
name: nginx
baseurl: http://nginx.org/packages/centos/6/$basearch/
gpgcheck: 0
enabled: 1
- name: install nginx
yum:
name: nginx
state: present
- name: create gitlab.conf
template:
src: templates/gitlab.conf.j2
dest: /etc/nginx/conf.d/gitlab.conf
- name: validate nginx configuration file syntax
command: /usr/bin/nginx -t
- name: start nginx
service:
name: nginx
state: started
enabled: yes
---
- name: add repository
yum: name=https://download.postgresql.org/pub/repos/yum/9.4/redhat/rhel-6-x86_64/pgdg-centos94-9.4-2.noarch.rpm state=present
become: yes
- name: install postgresql94
yum: name=postgresql94 state=present
- name: install postgresql94-server
yum: name=postgresql94-server state=present
- name: install postgresql94-devel
yum: name=postgresql94-devel state=present
- name: initdb
command: /sbin/service postgresql-9.4 initdb
- name: start postgresql94 server
service: name=postgresql-9.4 state=started enabled=yes
---
- name: add remi repo
yum: name=http://remi.kazukioishi.net/enterprise/remi-release-6.rpm state=present
- name: install redis
yum: name=redis enablerepo=remi state=latest
- name: disable tcp listen
lineinfile: dest=/etc/redis.conf regexp="^port" line="port 0"
- name: enable unix socket
blockinfile:
dest: /etc/redis.conf
block: |
unixsocket /tmp/redis.sock
unixsocketperm 770
- name: start redis
service: name=redis-server state=restarted enabled=yes
- name: add user redis to group git
user: name=redis groups=git append=yes
---
- name: download and extract
unarchive: src=https://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.8.tar.gz dest=/tmp/
- name: configure
command: /tmp/ruby-2.1.8/configure --prefix=/usr/
args:
chdir: /tmp/ruby-2.1.8
- name: make
command: /usr/bin/make
args:
chdir: /tmp/ruby-2.1.8
- name: install
command: /usr/bin/make install
args:
chdir: /tmp/ruby-2.1.8
---
- hosts: 172.16.18.49
remote_user: root
roles:
- common
- postgresql
- git
- ruby
- go
- redis
- gitlab
- nginx
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