Code Monkey home page Code Monkey logo

ansible-playbook-mac's Introduction

Ansible Playbook Template

This is the template I am using when writing new playbooks.

Table of Contents

Requirements

  • Docker (there is no reason podman couldn't work but it is not what I personally use)
  • An AMD64 or ARM64 architecture, if running inside of the included dev container.

If you are not running in a dev container, the following utilities are used alongside the ansible suite itself:

  • Docker or Podman to utilize containerization in testing with molecule
  • SOPS for encrypting sensitive information, using age for encryption
  • Gitleaks so sensitive data gets caught before commit
  • Hadolint for Dockerfile linting
  • yq for YAML parsing wherever necessary. Note that there appear to be two popular yq libraries out there, but this is the one I am using.
  • Optional: Just for convenient command-line running.

Usage

There is no reason why you can't run it standalone in your own development environment, but for convenience I am utilizing a Visual Studio Code Development Container environment, which encapsulates all of the utilities required to operate, including the VS Code plugins that aid in development.

The Dockerfile to create the dev environment uses specific versions of as many libraries as possible. The benefit is that something shouldn't magically break when you have built the exact same container for the 143rd time. The downside is that with enough lack of maintenance things can fall out of rev. I use apt-cache policy <package> every so often just to ensure everything is reasonably up to date.

I also use the Just command runner for convenience. You can see all eligible commands with just --list. By convention, my naming scheme is as follows:

  • deploy - Primary playbook execution of every eligible host
  • deploy-password - Primary playbook execution but password is required for sudo operations
  • deploy-<host> - Primary playbook execution of the given host
  • lint - Perform all linting operations
  • test - Perform all testing operations

Linting

The following linters are used:

Testing

I am using molecule for testing roles and/or playbooks. Wherever possible, it utilizes containerization, but in cases where that is not reasonable, Vagrant and Virtualbox are used to spin up full VMs. In those cases where Vagrant/Virtualbox are used, testing support is only available for amd64 architectures.

Thank You

ansible-playbook-mac's People

Watchers

 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.