Ansible/GitLabの導入 のバックアップ(No.1) |
|
GitLabは公式Webサイトで公開されている「Official Linux packageパッケージ」を利用して導入する。必要なソフトウェアを一括して導入できる。
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}
yum clean all && yum -y update && reboot
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'] 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_
ansible-playbook -i inventory.yml pb_gitlab_server.yml