https://github.com/jobcespedes/ansible-lookup-git-semver
Ansible lookup plugin that returns/bumps the version from git current branch latest tag
https://github.com/jobcespedes/ansible-lookup-git-semver
ansible lookup plugin semantic-version semver
Last synced: 2 months ago
JSON representation
Ansible lookup plugin that returns/bumps the version from git current branch latest tag
- Host: GitHub
- URL: https://github.com/jobcespedes/ansible-lookup-git-semver
- Owner: jobcespedes
- Created: 2020-09-25T21:28:57.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2020-10-15T03:22:00.000Z (over 4 years ago)
- Last Synced: 2025-01-09T07:42:21.196Z (4 months ago)
- Topics: ansible, lookup, plugin, semantic-version, semver
- Language: Python
- Homepage:
- Size: 24.4 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# git_semver
Ansible lookup plugin that returns/bumps the version from git latest branch tag. Optionally, it could return tag's branch and commit## Requirements
- python git
- python semantic-version## Install
Drop it in the respective directory
> You can activate a custom lookup by either dropping it into a lookup_plugins directory adjacent to your play, inside the plugins/lookup/ directory of a collection you have installed, inside a standalone role, or in one of the lookup directory sources configured in ansible.cfg[From Ansible docs](https://docs.ansible.com/ansible/latest/plugins/lookup.html#enabling-lookup-plugins)
## Example
```yaml
- vars:
version: "{{ lookup('git_semver', playbook_dir) }}"
version_next_patch: "{{ lookup('git_semver', playbook_dir, bump='patch') }}"
version_next_minor: "{{ lookup('git_semver', playbook_dir, bump='minor') }}"
version_next_major: "{{ lookup('git_semver', playbook_dir, bump='major') }}"
version_list: "{{ lookup('git_semver', playbook_dir, want='list') }}"
version_dict: "{{ lookup('git_semver', playbook_dir, want='dict') }}"
debug:
msg: |
{{ version }}
{{ version_next_patch }}
{{ version_next_minor }}
{{ version_next_major }}
{{ version_list }}
{{ version_dict}}
```