GithubHelp home page GithubHelp logo

jmcarp / cos-ansible-base Goto Github PK

View Code? Open in Web Editor NEW

This project forked from centerforopenscience/cos-ansible-base

0.0 3.0 0.0 544 KB

Our base ansible scripts for deployment and orchestration

Ruby 10.85% Shell 2.75% Python 86.40%

cos-ansible-base's Introduction

cos-ansible-base

Requirements

  • ansible >= 1.6
  • virtualbox
  • vagrant >= 1.5
  • invoke (Python task execution library)

Installing Ansible and Vagrant on Mac OSX with homebrew

Virtualbox and Vagrant can be installed with homebrew cask. If you have homebrew installed, run the following in the project directory

$ brew bundle

Installing python requirements

Invoke can be installed with pip

$ pip install invoke
$ pip install -r requirements.txt

Vagrant setup

Once you have Vagrant and ansible installed, follow these steps:

  • Generate your ssh key with ssh-keygen
$ ssh-keygen
  • Run $ vagrant up. Then will start the VM provision with invoke vprovision.
$ vagrant up
$ invoke vprovision

SSH

To ssh into your Vagrant box, you can run (must have invoke installed):

$ invoke vssh -u yourusername

Generating passwords

To generate a password, run

$ invoke genpass

This crypted password can be used by the genericusers role.

Running playbooks

Playbooks can be run with the ansible-playbook command. You need to specify which inventory file with the -i option as well as a user with the -u option. Run in sudo mode with -s

$ ansible-playbook security.yml -i vagranthosts -u sloria -s

Or, using invoke for shorthand:

$ invoke play security.yml -i vagranthosts -u sloria

Provisioning

The site.yml playbook is responsible for provisioning all servers in an inventory.

Run it like so:

$ ansible-playbook site.yml -i vagranthosts -u sloria -s

The above command runs the site.yml playbook using the vagrant inventory file with user sloria in sudo mode.

Or, if you prefer to use invoke:

$ invoke provision -i vagranthosts -u sloria

NOTE: You can also provision the vagrant box by running invoke vprovision with no arguments.

Many of the roles have variables use variables defined in their defaults/main.yml file. You can override these on the command line with the -e option:

$ ansible-playbook site.yml -i vagranthosts -u sloria -e "ssh_test=false"

or, equivalently:

$ invoke provision -u sloria -e "ssh_test=false"

The above would temporarily disable SSH configuration testing.

Deployment

The deploy.yml script is used to deploy the OSF.

To deploy on staging:

$ invoke deploy_staging -u sloria

You will be prompted for the branch to checkout on staging.

To deploy to production:

$ invoke deploy_production -u sloria

This will deploy to the production server, checking out the master branch from Github.

cos-ansible-base's People

Contributors

chrisseto avatar fabianvf avatar jeffspies avatar jmcarp avatar lyndsysimon avatar sloria avatar willist avatar

Watchers

 avatar  avatar  avatar

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.