tle06 / mgm-infra

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Publish Docker image Docker hub version

Management infrastructure

Description

This image is build to be use with gitlab CI/CD pipeline. The target is to deploy terraform and ansible configuration with gitlab CI/CD.

Supported tags and respective

Image configuration

Build from python:latest

Added packages:

How to use this image

Start mgm-infra

Starting the wikijs instance listening on port 80 is as easy as the following:

docker run -d --restart=unless-stopped tlnk/mgm-infra:tag

how to use this image with gitlab CI/CD

The exemple below show ansible integration with 2 step

  1. lint of the file
  2. ansible deployment with the load of the SSH key and dynamic inventory from terraform
stages:
  - job-ansible-lint
  - job-ansible-deploy

job-ansible-lint:
  stage: job-ansible-lint
  image: tlnk/mgm-infra:tag
  script:
    - cp -r /builds/gitlabusername/infrastructure/ansible /root/ansible
    - cd /root/ansible
    - ansible-lint *.yml -v
  only:
    refs:
      - master
    changes:
      - ansible/*

job-ansible-deploy:
  stage: job-ansible-deploy
  image: tlnk/mgm-infra:tag
  script:
    - eval $(ssh-agent -s)
    - touch /root/.ssh/id_rsa
    - echo "$SSH_PRIVATE_KEY" > /root/.ssh/id_rsa
    - chmod 600 /root/.ssh/id_rsa
    - ansible-playbook -i /etc/ansible/terraform.py -u root ansible/infra.yml
  when: on_success
  only:
    refs:
      - master
    changes:
      - ansible/*

About

License:MIT License


Languages

Language:Dockerfile 61.7%Language:Shell 38.3%