Giter Club home page Giter Club logo

ansible-jenkins's Introduction

Ansible Jenkins

Setup a server with Jenkins using Ansible.

Installation

Install pip:

sudo apt-get install python-pip

Install python requirements:

sudo pip install -r ./requirements.txt

Copy vars.yml.dist to vars.yml and change the variables to your need.

Digital Ocean configuration

Download the Digital Ocean dynamic inventory plugin:

wget https://raw.githubusercontent.com/ansible/ansible/devel/plugins/inventory/digital_ocean.py -O dohosts && chmod 0755 dohosts
wget https://raw.githubusercontent.com/ansible/ansible/devel/plugins/inventory/digital_ocean.ini

Create a new API key on the API access page and add the client_id and api_key to digital_ocean.ini.

AWS Configuration

Create a new S3 bucket using the AWS Console and add the bucket name to vars.yml.

Create a new user using IAM and add the access_key and secret_key to vars.yml.

Add an user policy to the new user to allow access to the bucket. For example:

```
{
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket",
        "s3:GetBucketLocation",
        "s3:ListBucketMultipartUploads"
      ],
      "Resource": "arn:aws:s3:::mybucket",
      "Condition": {}
    },
    {
      "Effect": "Allow",
      "Action": [
        "s3:AbortMultipartUpload",
        "s3:DeleteObject",
        "s3:DeleteObjectVersion",
        "s3:GetObject",
        "s3:GetObjectAcl",
        "s3:GetObjectVersion",
        "s3:GetObjectVersionAcl",
        "s3:PutObject",
        "s3:PutObjectAcl",
        "s3:PutObjectAclVersion"
      ],
      "Resource": "arn:aws:s3:::mybucket/*",
      "Condition": {}
    }
  ]
}
```

Playbooks

provision

Provision a server with Jenkins:

ansible-playbook site.yml

backup.yml

Backup Jenkins to S3:

ansible-playbook playbooks/backup.yml

restore.yml

Restore Jenkins from S3:

ansible-playbook playbooks/restore.yml

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.