Last-modified: 2020-09-18 (金) 06:16:29 (1310d)
 

GitLabの導入

 GitLabは公式Webサイトで公開されている「Official Linux packageパッケージ」を利用して導入する。必要なソフトウェアを一括して導入できる。https://packages.gitlab.com に接続できれば可能。
 dockerを用いて導入すると、tcp:22をdocker側にバインドするのが少し気になるので。

導入サーバの前提条件

  1. OSはRHEL8(or RHEL7)とする。
  2. 事前導入するソフトウェアパッケージは最小構成。
  3. インターネットに接続可能 ※必要ならproxy設定
     /etc/yum.conf
    proxy=http://proxy.jomura.net:8080/     #as your own
     ~/.bashrc
    export HTTP_PROXY=http://proxy.jomura.net:8080/     #as your own
    export HTTPS_PROXY=${HTTP_PROXY}
  4. パッケージの更新が事前に実行されている
    yum clean all && yum -y update && reboot
  5. Gitlab Webサイト用のFully Qualified Domain Name(FQDN)が用意されている。

playbookの作成

  • Ansibleサーバ上の一般ユーザで実行
  • sudoの場合、become_method: sudo
    cat << "_EOF_" > pb_gitlab_server.yml
    # install gitlab
    
    - hosts: gitlab_servers
      become: true
      become_method: su
      environment: "{{ proxy_env }}"
    
      tasks:
        - name: facts check
          fail:
            msg: "Not compatible with [{{ ansible_os_family }}] {{ ansible_distribution }} {{ ansible_distribution_major_version }}."
          when: ansible_os_family != 'RedHat' or ansible_distribution_major_version|int < 7
    
        - name: install rpms
          yum:
            name: ['curl', '
                  {%- if ansible_distribution_major_version|int == 7 -%}
                    policycoreutils-python
                  {%- else -%}
                    policycoreutils
                  {%- endif -%}
                  ', 'openssh-server', 'tar']
            state: latest
    
        - name: firewalld
          firewalld:
            service: "{{ item }}"
            permanent: true
            state: enabled
            immediate: yes
          loop:
            - http
            - https
    
        - name: Download check script
          get_url:
            url: https://packages.gitlab.com/install/repositories/gitlab/gitlab-ee/script.rpm.sh
            dest: /usr/local/src
            mode: '0755'
    
        - name: Run script.rpm.sh
          shell: bash script.rpm.sh
          args:
            chdir: /usr/local/src
          register: result
          changed_when: '"行うべきことはありません。" not in result.stdout'
    
        - name: Install gitlab-ce
          yum:
            name: gitlab-ee
            state: latest
          environment:
            EXTERNAL_URL: http://{{ inventory_hostname }}
    #      notify:
    #        - gitlab-ctl reconfigure
    
      handlers:
        - name: gitlab-ctl reconfigure
          shell: gitlab-ctl reconfigure
    
    _EOF_

playbookの実行

  • Ansibleサーバ上の一般ユーザで実行
    ansible-playbook -i inventory.yml pb_gitlab_server.yml
  • "Install gitlab-ce"に数分かかる

トップ   編集 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS