Coder Social home page Coder Social logo

ansible-ops's Introduction

ansible-ops

R@CMON (Monash eResearch Centre) playbooks and roles

Quick start

A. Install ansible-lint pre-commit hooks

brew install pre-commit
pre-commit install

B. Clone inventory submodule and data.

git submodule init && git submodule update

C. Optional install python crypto library to speed up ansible vault actions

pip install cryptography

D. Optional install redis for fact caching (defaults to jsonfile atm)

brew install redis
brew services start redis
pip install redis
export ANSIBLE_INVENTORY_CACHE_PLUGIN=redis
  1. Setup vault password

    echo XXX > ~/.ansible_vault
  2. Add your own jenkins username & password

    ansible-vault create inventory/prod/group_vars/all/jenkins.yml
    ---
    jenkins_username: XXX
    jenkins_password: XXX

    Do the same for ansible-vault create inventory/test/group_vars/all/jenkins.yml

Notes

  • debugging playbooks

    ansible-playbook --syntax-check
    ansible-playbook --list-hosts #lists valid hosts for a play invocation
    ansible-playbook --check      #predicts changes that may occur
    ansible-playbook --diff       #only works for templates
    ansible-playbook -v/-vvvv     #verbose lvl 1-4
    ansible-lint                  #manually run ansible-lint
    pre-commit run --all-files    #manually run pre-commit hooks

Set strategy: debug on a play to be dropped into a playbook debugger when a playbook fails

usage/examples:

  • install ansible dependencies

    ansible all -m raw -a "apt-get -y install python-dev"
  • patch monash-01 nodes

    ansible-playbook patching.yml -l monash-01
  • patch monash-01 nodes, skipping slack notification and tempest check

    ansible-playbook patching.yml -l monash-01  --skip-tags slack_notification,tempest
  • run security audit on all nodes

    ansible-playbook security_audit.yml
  • run puppet on some nodes (can use a regex)

    ansible "rccomdc3-01*" --become -m puppet
  • update apt cache

    ansible monash-01-compute --become -m command -a 'apt-get update' --become
  • got a list of nodes in fqdn new line delimited?

    ansible $(sed -e 's/.erc.monash.edu.au//g' nodes.txt | tr '\n' ':') -m ping
    
  • no fail patching

    ansible monash-01-compute -o -a 'sudo DEBIAN_FRONTEND=noninteractive apt-get -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold" dist-upgrade --allow-downgrades'`
  • working with ansible vars

    ansible db1-02 -m setup | sed '1 s/^.*$/{/' | jq
    ansible rccomdc1r24-07 -m setup | sed '1 s/^.*$/{/' | jq .ansible_facts.ansible_processor
  • puppet dev cycle

  1. modify code
  2. rsysc with dev server
ansible-playbook puppetdev.yml -e test_host=<test_target> [-t sync,test to optionally do either]

ansible-ops's People

Contributors

brettmilford 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.