added Install gitlab with Ansible and Docker Compose

This commit is contained in:
2023-03-21 10:39:51 +01:00
commit ef94a161c5
14 changed files with 208 additions and 0 deletions

19
gitlab/ansible.cfg Executable file
View File

@@ -0,0 +1,19 @@
[defaults]
inventory = ./inv/
log_path = ~/.ansible/log_ansible.log
privat_key_file = ~/.ssh/ansible
roles_path = ./roles
retry_files_enabled = true
retry_files_save_path = ~/.ansible/retry-files
force_handlers = true
vault_identity_list = ~/.ansible/.vault-pass
#Gather CONFIG
gathering = smart
fact_caching = yaml
fact_caching_connection = ~/.ansible/fact_caching
fact_caching_timeout = 86400
callback_plugins = "$(python3 -m ara.setup.callback_plugins)"
[ara]
api_client = http
api_server = http://127.0.0.1:8000

12
gitlab/create_gitlab.yml Executable file
View File

@@ -0,0 +1,12 @@
#! /usr/bin/env ansible-playbook
---
- name: "Install gitlab in Docker"
gather_facts: true
become: false
hosts: ubuntu
#connection: local
# vars:
# ansible_user: jonnybravo
roles:
- prereq_gitlab
- docker_gitlab

View File

@@ -0,0 +1,6 @@
gitlab_dir:
- "/home/{{ansible_user}}/.gitlab"
- "/home/{{ansible_user}}/.gitlab/config"
- "/home/{{ansible_user}}/.gitlab/log"
- "/home/{{ansible_user}}/.gitlab/data"

21
gitlab/inv/devel/hosts Normal file
View File

@@ -0,0 +1,21 @@
---
test:
hosts:
debian:
ubuntu:
rocky:
vars:
ansible_python_interpreter: "/usr/bin/python3"
ansible_ssh_common_args: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
ansible_user: jonnybravo
ansible_become: true
Prep:
hosts:
mandan01
vars:
ansible_python_interpreter: "/usr/bin/python3"
ansible_ssh_common_args: '-o StrictHostKeyChecking=no -o UserKnownHostsFile=/dev/null'
ansible_user: jonnybravo
ansible_become: true

Binary file not shown.

View File

@@ -0,0 +1,14 @@
---
- name: Template Docker compose
template:
src: docker-compose.yml.j2
dest: "{{gitlab_dir[0]}}/docker-compose.yml"
owner: "{{ansible_user}}"
group: "{{ansible_user}}"
mode: 0777
#- name: deploy Docker Compose stack
# docker_compose:
# project_src: "{{jenkins_dir[0]}}"
# files:
# - docker-compose.yml

View File

@@ -0,0 +1,19 @@
version: '3.8'
services:
web:
image: 'gitlab/gitlab-ce:latest'
restart: always
hostname: 'localhost'
container_name: gitlab-ce
environment:
GITLAB_OMNIBUS_CONFIG: |
external_url 'http://{{ansible_host}}:{{web_port}}'
gitlab_rails['gitlab_shell_ssh_port'] = {{ssh_port}}
ports:
- '{{web_port}}:8929'
- '{{ssh_port}}:22'
volumes:
- '{{gitlab_dir[1]}}:/etc/gitlab'
- '{{gitlab_dir[2]}}:/var/log/gitlab'
- '{{gitlab_dir[3]}}:/var/opt/gitlab'
shm_size: '{{shm_size}}'

View File

@@ -0,0 +1,3 @@
web_port: 8929
ssh_port: 2222
shm_size: "1024m"

View File

@@ -0,0 +1,38 @@
Role Name
=========
A brief description of the role goes here.
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.
Example Playbook
----------------
Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:
- hosts: servers
roles:
- { role: username.rolename, x: 42 }
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@@ -0,0 +1,8 @@
---
# defaults file for roles/prereq-portainer
# portainer direcotorys
#portainer_dir:
# - "/home/{{ansible_user}}/.portainer"
# - "/home/{{ansible_user}}/.portainer/cert"
# - "/home/{{ansible_user}}/.portainer/data"

View File

@@ -0,0 +1,2 @@
---
# handlers file for roles/prereq-portainer

View File

@@ -0,0 +1,52 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@@ -0,0 +1,12 @@
---
# tasks file for roles/prereq-portainer
#- name: check assets
# assets:
#
- name: 0 create default direcotorys
file:
path: "{{item}}"
state: directory
owner: "{{ansible_user}}"
group: "{{ansible_user}}"
loop: "{{gitlab_dir}}"

View File

@@ -0,0 +1,2 @@
---
# vars file for roles/prereq-portainer