Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Redhat tasks #4

Merged
merged 5 commits into from
Jul 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,16 @@
---
- name: Start postfix
systemd:
name: postfix
state: started
enabled: yes

- name: Start sshd
systemd:
name: ssh
state: started
enabled: yes

- name: Reconfigure GitLab
command: gitlab-ctl reconfigure

Expand Down
6 changes: 4 additions & 2 deletions meta/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ galaxy_info:
description: Ansible role to install and config gitlab-ce
company: "Opsta (Thailand) Co.,Ltd."
license: "MIT"
min_ansible_version: 2.1
min_ansible_version: 2.4
platforms:
- name: Ubuntu
versions:
- trusty
- xenial
- name: RedHat
versions:
- 7
galaxy_tags:
- gitlab
- vcs
Expand Down
12 changes: 12 additions & 0 deletions tasks/gitlab_install.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,18 @@
---
- name: Install Gitlab CE
yum:
name: "{{ gitlab_yum_package }}"
state: present
update_cache: yes
when:
- ansible_os_family == "RedHat"
- gitlab_yum_package is defined

- name: Install Gitlab CE
apt:
name: "{{ gitlab_apt_package }}"
state: present
update_cache: yes
when:
- ansible_os_family == "Debian"
- gitlab_apt_package is defined
31 changes: 30 additions & 1 deletion tasks/gitlab_pre.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,42 @@
---
- block:
- name: Install GitLab dependencies
yum:
name: "{{ item }}"
state: present
update_cache: yes
with_items:
- "{{ gitlab_yum_dependencies }}"
notify:
- Start sshd
- Start postfix

- name: Ensure firewalld is enabled
systemd:
name: firewalld
state: started
enabled: yes

- name: Allow some firewall to using
firewalld:
service: "{{ item.1 }}"
permanent: true
state: enabled
immediate: yes
with_indexed_items:
- http
when: ansible_os_family == "RedHat"

- name: Install GitLab dependencies
apt:
name: "{{ item }}"
state: present
update_cache: yes
with_items:
- "{{ gitlab_apt_dependencies }}"
when: ansible_os_family == "Debian"

- name: Run script to check system and add repository for GitLab CE
shell: "curl -L {{ gitlab_script_url }} | bash"
shell: "curl -L -s {{ gitlab_script_url }} | bash"
when:
- gitlab_script_url is defined
14 changes: 9 additions & 5 deletions tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
- name: Include OS family specific variables
include_vars: "{{ item }}"
with_first_found:
- "{{ ansible_os_family }}.yml"
- files: "{{ ansible_os_family }}.yml"
skip: true

- include_tasks: gitlab_pre.yml
- include_tasks: gitlab_install.yml
- block:
- include_tasks: gitlab_pre.yml
- include_tasks: gitlab_install.yml
tags:
- gitlab_install

- block: # Config GitLab
- block: # Configure Gitlab
- include_tasks: gitlab_search_config.yml
- include_tasks: gitlab_post.yml
tags:
- gitlab-config
- gitlab_configure
11 changes: 11 additions & 0 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
gitlab_yum_package: gitlab-ce

gitlab_yum_dependencies:
- ca-certificates
- curl
- policycoreutils-python
- openssh-server
- postfix

gitlab_script_url: https://packages.gitlab.com/install/repositories/gitlab/gitlab-ce/script.rpm.sh