gitlab安装

- name: disable selinux
  shell: setenforce 0
  ignore_errors: yes

- name: disable selinux conf
  lineinfile:
    path: /etc/selinux/config
    regexp: '^SELINUX=.*$'
    line: 'SELINUX=disabled'

- name: Install requirements package
  yum: name={{ item }} state=installed
  with_items:
    - policycoreutils-python
    - postfix
    - openssh-server
    - curl

- name: start and enable  postfix
  service:
    name: postfix
    state: started
    enabled: yes

- name: Add Gitlab package
  get_url:
    url: "{{ gitlab_download_url }}"
    dest: "{{ gitlab_package_url }}"

- name: install gitlab-ce
  yum: name={{ gitlab_package_url }}  state=present

- name: copy cinfigure  file
  shell: cd /etc/gitlab/  && cp gitlab.rb gitlab.rb.bak

 
- name: ensure gitlab-ce is installed
  shell: cat /opt/gitlab/embedded/service/gitlab-rails/VERSION
  register: gitlab_installed
  ignore_errors: yes

- name: add conf file info
  blockinfile:
    path: /etc/gitlab/gitlab.rb
    block: |
      git_data_dirs({  "default" => { "path" => "/data/software/git-data" } })
      postgresql['data_dir'] = "/data/software/postgresql/data"
      gitlab_rails['backup_path'] = "/data/software/backups"

  
- name: edit host name
  lineinfile:
    path: /etc/gitlab/gitlab.rb
    regexp: '^external_url.*gitlab.example.com.*'
    line: "external_url 'http://{{ host }}'"


- name: Initialize gitlab
  shell: gitlab-ctl reconfigure

  
- name: systemctl start gitlab-runsvdir.service and enable
  service:
    name: gitlab-runsvdir
    state: started
    enabled: yes

 

posted @ 2020-07-11 18:10  solomon123  阅读(162)  评论(0编辑  收藏  举报