salt/states/roles/maintain/gitlabarch/init.sls

175 lines
4.7 KiB
Text

gitlab:
pkg.installed
mariadb:
pkg.installed
gitlab_nginx:
pkg.installed:
- name: nginx
#managed files
/etc/webapps/gitlab/gitlab.yml:
file.managed:
- source: salt://roles/maintain/gitlab/conf_files/gitlab.yml
- user: root
- group: root
- mode: 644
/etc/webapps/gitlab/database.yml:
file.managed:
- source: salt://roles/maintain/gitlab/conf_files/database.yml
- user: gitlab
- group: gitlab
- mode: 600
- template: jinja
/etc/webapps/gitlab/resque.yml:
file.managed:
- source: salt://roles/maintain/gitlab/conf_files/resque.yml
- user: root
- group: root
- mode: 644
/etc/webapps/gitlab-shell/config.yml:
file.managed:
- source: salt://roles/maintain/gitlab/conf_files/config.yml
- user: gitlab
- group: gitlab
- mode: 600
/usr/share/webapps/gitlab/config/initializers/smtp_settings.rb:
file.managed:
- source: salt://roles/maintain/gitlab/conf_files/smtp_settings.rb
- user: root
- group: root
- mode: 644
- template: jinja
/usr/share/webapps/gitlab/config/environments/production.rb:
file.managed:
- source: salt://roles/maintain/gitlab/conf_files/production.rb
- user: root
- group: root
- mode: 644
/etc/redis.conf:
file.managed:
- source: salt://roles/maintain/gitlab/conf_files/redis.conf
- user: root
- group: root
- mode: 644
/etc/tempfiles.d/redis.conf:
file.managed:
- source: salt://roles/maintain/gitlab/conf_files/tmp_redis.conf
- user: root
- group: root
- mode: 644
- makedirs: true
/etc/nginx/conf.d/gitlab.conf:
file.managed:
- source: salt://roles/maintain/gitlab/conf_files/gitlab.conf
- user: root
- group: root
- makedirs: true
- dir_mode: 755
- mode: 644
#add users git and gitlab to redis group
git_user:
user.present:
- name: git
- groups:
- redis
gitlab_user:
user.present:
- name: gitlab
- groups:
- redis
#migrate redis database as gitlab user if necessary
redis-running:
service.running:
- name: redis
- enable: true
- watch:
- file: /etc/redis.conf
- file: /etc/tempfiles.d/redis.conf
gitlab_rake_db:
cmd.run:
- name: "bundle-2.3 exec rake db:migrate RAILS_ENV=production"
- cwd: "/usr/share/webapps/gitlab"
- runas: gitlab
- watch:
- pkg: gitlab
#global git configuration
gitlab_git_name:
git.config_set:
- name: user.name
- value: "Actaeus Curabitur"
- user: gitlab
- global: true
gitlab_git_email:
git.config_set:
- name: user.email
- value: "actcur@actcur.com"
- user: gitlab
- global: true
gitlab_git_crlf:
git.config_set:
- name: core.autocrlf
- value: "input"
- user: gitlab
- global: true
#create symlink
symlink_repos:
file.symlink:
- name: /var/lib/gitlab/repositories
- target: /mnt/repos
- force: true
#verify perms for repos are right
/var/lib/gitlab/repositories/:
file.directory:
- user: gitlab
- group: gitlab
- dir_mode: 4770
#start services
gitlab.target:
service.running:
- enable: true
- watch:
- file: /etc/webapps/gitlab/gitlab.yml
- file: /etc/webapps/gitlab/database.yml
- file: /etc/webapps/gitlab/resque.yml
- file: /etc/webapps/gitlab-shell/config.yml
- file: /etc/nginx/conf.d/gitlab.conf
- file: /usr/share/webapps/gitlab/config/initializers/smtp_settings.rb
- file: /usr/share/webapps/gitlab/config/environments/production.rb
gitlab-workhorse:
service.running:
- enable: true
- watch:
- file: /etc/webapps/gitlab/gitlab.yml
- file: /etc/webapps/gitlab/database.yml
- file: /etc/webapps/gitlab/resque.yml
- file: /etc/webapps/gitlab-shell/config.yml
- file: /etc/nginx/conf.d/gitlab.conf
- file: /usr/share/webapps/gitlab/config/initializers/smtp_settings.rb
- file: /usr/share/webapps/gitlab/config/environments/production.rb
gitlab-unicorn:
service.running:
- enable: true
- watch:
- file: /etc/webapps/gitlab/gitlab.yml
- file: /etc/webapps/gitlab/database.yml
- file: /etc/webapps/gitlab/resque.yml
- file: /etc/webapps/gitlab-shell/config.yml
- file: /etc/nginx/conf.d/gitlab.conf
- file: /usr/share/webapps/gitlab/config/initializers/smtp_settings.rb
- file: /usr/share/webapps/gitlab/config/environments/production.rb
gitlab-sidekiq:
service.running:
- enable: true
- watch:
- file: /etc/webapps/gitlab/gitlab.yml
- file: /etc/webapps/gitlab/database.yml
- file: /etc/webapps/gitlab/resque.yml
- file: /etc/webapps/gitlab-shell/config.yml
- file: /etc/nginx/conf.d/gitlab.conf
- file: /usr/share/webapps/gitlab/config/initializers/smtp_settings.rb
- file: /usr/share/webapps/gitlab/config/environments/production.rb