Giter VIP home page Giter VIP logo

jenkins-server-iac's Introduction

Jenkins server and supporting infrastructure using Ansible

  • Creates a VPC in an AWS count along with related resources like subnets, route tables, gateways etc

  • Sets up an EC2 instance from a custom ami with jenkins and supporting sorftware installed (to see how to make custom ami using packer: repo link)

  • Configures a jenkins ec2 server:

    • Enables certbot ssl verification
    • Procures intitial jenkins password
    • Sets docker and github authectications as jenkins secrets
    • Adds 2 job pipelines (publishing helm-chart releases: repo link; updating deployed helm-chart with pushes to webapp: see repo)
    • Installs relevant plugins and software

    Note: Webhooks need to be configured for repos for jobs to be triggered: /github-webhook/

Usage

Setup configuration and variables:

  • Change the variables in roles/vars/common-vars.yml as needed
  • Ensure existence of keypair in aws account and private key on system
  • Change or create user-data.sh to contain your server name
  • Create a file .yml in roles/vars/ containing config specific values (use existing refrences)
  • Go through and make changes as needed to jenkins configuration in roles/jenkins_configuration/tasks/main.yml

make sure relevant domain records and resources present in common_vars exist in your aws account

Jenkins Infrastructure Deployment:

export ANSIBLE_HOST_KEY_CHECKING=False

ansible-playbook setup_playbook.yml --extra-var "env=username"

for only network set up, set instance_flag to no

ansible-playbook setup_playbook.yml --extra-var "instance_flag=no env=username"

note: after network setup, instance can be deployed by running the playbook again without any flags

Configure jenkins and install plugins:

ansible-playbook configure_jenkins.yml --extra-var "env=username"

To launch Jenkins Infrastructure using a specific AWS Named Profile and in Debug mode, use:

AWS_PROFILE={{named_profile}} ANSIBLE_DEBUG=true ansible-playbook setup_playbook.yml

Tearing down infrastructure:

ansible-playbook termination_playbook.yml --extra-var "key=app value=jenkins env=username"

for only instance teardown, set network_flag=no

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.