Code Monkey home page Code Monkey logo

alpineset2's Introduction

alpineset2

Toolset bundles Ansible developing and testing tools in a single container.

Install a couple of things first

pip install --user pip-compile-multi
docker network create molecule

Rebuild the requirements.txt

This is done during the docker build but can be done here to see exactly what will be installed

pip-compile --allow-unsafe --no-annotate --output-file=requirements.txt requirements.in

Build the container image with docker or podman

make all
docker run --rm halfwalker/alpineset2 molecule --version

Run the container with bash to use any of the tools

docker run --rm -it quay.io/halfwalker/alpineset2 bash

More detailed run

Specifies the docker network to use locally (created above) - needed to allow molecule container to speak to working container (ubuntu2204 here)

docker run --rm -it --network molecule -e GH_USER=${GH_USER} -e GH_TOKEN=${GH_TOKEN} -e MOLECULE_DISTRO=ubuntu2204 -e DOCKER_HOST=unix:///var/run/docker.sock -v "$(pwd)":"${PWD}" -w "${PWD}" -v /var/run/docker.sock:/var/run/docker.sock quay.io/halfwalker/alpineset2 bash
  • Set GH_USER and GH_TOKEN to your github user/token to avoid rate limiting from github. Use them in ansible tasks (optionally)

    - name: Get latest release for each git package in cloud_tools
      uri:
        url: "https://api.github.com/repos/{{ item.repo }}/releases"
        method: GET
        return_content: true
        status_code: 200
        body_format: json
        validate_certs: false
        user: "{{ lookup('env', 'GH_USER') | default(omit) }}"
        password: "{{ lookup('env', 'GH_TOKEN') | default(omit) }}"
        force_basic_auth: "{% if lookup('env', 'GH_USER') %}yes{% else %}no{% endif %}"
          :
  • MOLECULE_DISTRO is a handy way to specify which geerlingguy container to use. Example molecule.yml

    dependency:
      name: galaxy
    driver:
      name: podman
    
    platforms:
      - name: "cloud_tools-${MOLECULE_DISTRO:-ubuntu2004}"
        # Default to dockerhub unless a local cache is defined
        # Default to ubuntu2004 unless a distro is defined
        image: "${HUB_CACHE:-registry.hub.docker.com}/geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2004}-ansible:latest"
        # Specify not-rootless, otherwise newer ansible fails with 'msg: could not find job'
        # See https://github.com/ansible-community/molecule-podman/issues/77
        rootless: false
          :

Running testinfra pytest manually in container

Can run a test manually, without molecule.

Must set MOLECULE_INVENTORY_FILE env variable first

export MOLECULE_INVENTORY_FILE=/root/.cache/molecule/$(basename ${PWD})/default/inventory/ansible_inventory.yml
pytest --ansible-inventory /root/.cache/molecule/$(basename ${PWD})/default/inventory --connection ansible  --debug -p no:cacheprovider -s molecule/default/tests/test_default.py -vvv

What is bundled inside the container

Generally the containers should bundle the latest stable versions of the tools below. An exact list can be seen in requirements.txt file used for building the container.

alpineset2's People

Contributors

halfwalker avatar

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.