All Projects → geerlingguy → Ansible Requirements Updater

geerlingguy / Ansible Requirements Updater

Licence: mit
Update your requirements.yml with this grisly Ansible playbook.

Projects that are alternatives of or similar to Ansible Requirements Updater

Ops Cli
Ops - cli wrapper for Terraform, Ansible, Helmfile and SSH for cloud automation
Stars: ✭ 152 (+141.27%)
Mutual labels:  ansible, jinja2
Td4a
Template designer for automation
Stars: ✭ 139 (+120.63%)
Mutual labels:  ansible, jinja2
Ansible Manage Lvm
Stars: ✭ 55 (-12.7%)
Mutual labels:  ansible
Cloud Portal
Self service web portal for different Cloud platforms like Azure, AWS and VMWare vSphere.
Stars: ✭ 60 (-4.76%)
Mutual labels:  ansible
Ansible Role Gitea
Ansible role to deploy a Gitea instance
Stars: ✭ 58 (-7.94%)
Mutual labels:  ansible
Lobsters Ansible
Ansible playbook for lobste.rs
Stars: ✭ 56 (-11.11%)
Mutual labels:  ansible
Ansible Wordpress
Ansible role to set up (multiple) wordpress installations in Debian-like systems (using wp-cli)
Stars: ✭ 58 (-7.94%)
Mutual labels:  ansible
Ansible Role Memcached
Ansible Role - Memcached
Stars: ✭ 54 (-14.29%)
Mutual labels:  ansible
Ansible In Action
Ansible playbook to deploy your Laravel code base to VPS
Stars: ✭ 61 (-3.17%)
Mutual labels:  ansible
Ansible Windows Docker Springboot
Example project showing how to provision, deploy, run & orchestrate Spring Boot apps with Docker Windows Containers on Docker Windows native using Packer, Powershell, Vagrant & Ansible
Stars: ✭ 58 (-7.94%)
Mutual labels:  ansible
Vpn At Home
1-click, self-hosted deployment of OpenVPN with DNS ad blocking sinkhole
Stars: ✭ 1,106 (+1655.56%)
Mutual labels:  ansible
Tahrir
Pyramid app for issuing your own Open Badges
Stars: ✭ 57 (-9.52%)
Mutual labels:  ansible
Manageiq
ManageIQ Open-Source Management Platform
Stars: ✭ 1,089 (+1628.57%)
Mutual labels:  ansible
Ansible Phoenix Build
Sample app with full build and deploy setup of a Phoenix app using ansible
Stars: ✭ 59 (-6.35%)
Mutual labels:  ansible
Mac config
Scripted installation and configuration of Mac OS X apps and preferences
Stars: ✭ 55 (-12.7%)
Mutual labels:  ansible
Docker Ubuntu1804 Ansible
Ubuntu 18.04 LTS (Bionic) Docker container for Ansible playbook and role testing.
Stars: ✭ 61 (-3.17%)
Mutual labels:  ansible
Hkube
Kubernetes cluster deployment to Hetzner Cloud
Stars: ✭ 55 (-12.7%)
Mutual labels:  ansible
Ansible Osx Command Line Tools
An Ansible role for installing OS X Command Line Tools
Stars: ✭ 57 (-9.52%)
Mutual labels:  ansible
Ansible Role Visual Studio Code
Ansible role for installing the Visual Studio Code IDE
Stars: ✭ 58 (-7.94%)
Mutual labels:  ansible
Graphite Stack Ansible Vagrant
Provision a complete Graphite, StatsD & Grafana install using Ansible and (optionally) Vagrant
Stars: ✭ 62 (-1.59%)
Mutual labels:  ansible

Ansible Requirements Updater

Update your requirements.yml with this grisly Ansible playbook.

This is one of the gookiest Ansible playbooks I've ever written.

But it does something I need, and it's a lot faster than doing it manually, and I do it every few months. So it was worth spending two hours automating the process on a Friday night while watching a Blues game.

The playbook does the following:

  1. Reads in a list of role requirements from an existing requirements.yml file (at requirements_file_path).
  2. Loops through all the roles in that list, and gets the latest role version string from Ansible Galaxy.
  3. Generates a new requirements list.
  4. Writes the new list to the requirements.yml file.

If you're really daring and had a few drinks, you can set requirements_file_backup to false, and overwrite your artisinally-handcrafted requirements file with whatever this playbook disgorges 🤮.

You might be wondering at this point: "Why doesn't geerlingguy just run ansible-galaxy update -r requirements.yml?" Well, unfortunately, update is not a thing, and might never be, for roles on Ansible Galaxy. Collections might someday get that functionality (so we can stop updating our requirements.yml files by hand like neanderthals), but until then, you can do it manually, or trust your life to this playbook. I know what I'd do.

Caveats

  • This has only been tested with geerlingguy.* roles, and a few others which follow semantic versioning standards. Since Galaxy allows practically anything as a version (heck, you could probably throw a 🦑 in there and it would work), the playbook will likely break your requirements in new and interesting ways if you use roles that do strange things with versioning.
  • This playbook only handles requirements files with roles in them, not with roles and collections. If you have any collections listed in your requirements file, this playbook will act like they don't exist and they will go 💥.
    • Maybe this playbook will support collections someday, maybe not. Buy my book and I'll be at least 0.0002% more likely to fix issue #1.
  • You should never write a playbook like this. It is dumb. It is inefficient. It is against every one of the best practices I espouse in my book Ansible for DevOps and my blog posts on Ansible. But I did, so 🤷‍♂️.

Usage

Let's assume you have a requirements file (requirements.yml) with contents like:

---
roles:
  - name: geerlingguy.ansible
    version: 1.2.0
  - name: geerlingguy.certbot
    version: 3.0.0
  - name: geerlingguy.docker
    version: 2.1.0

Run the playbook like so:

ansible-playbook main.yml -e "requirements_file_path=path/to/a/requirements.yml"

Go get a coffee (☕️) – it's going to take a while because of how horrifically inefficient it is to use Ansible as a programming language like this playbook does.

Cross your fingers (🤞) and hope it works.

Note: It is highly recommended you track your requirements.yml file in a git repository. That way if this playbook mangles it horrifically, you can git restore requirements.yml and act like nothing happened 🤐.

License

MIT.

Author Information

This playbook was brought into its miserable existence by Jeff Geerling, author of Ansible for DevOps and Ansible for Kubernetes.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].