Skip to content

Commit

Permalink
feat: add playbook and template for meta/main.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
jomrr committed Feb 16, 2024
1 parent 72c1153 commit 37ac9c0
Show file tree
Hide file tree
Showing 2 changed files with 58 additions and 0 deletions.
27 changes: 27 additions & 0 deletions playbooks/meta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
# play: ansible-collection-meta
# file: playbooks/meta.yml

- name: "Play: generate meta/main.yml for roles inventory"
hosts: all
become: false
gather_facts: true
tasks:
- name: "Ensure that role and meta directory exist"
ansible.builtin.file:
path: "{{ ansible_chroot_dir }}/meta"
state: directory
mode: "0755"

- name: "Install ansible-lint"
ansible.builtin.pip:
name: ansible-lint
state: present
extra_args: "--user --upgrade"

- name: "Generate meta/main.yml for role {{ meta_role_name }}"
ansible.builtin.template:
src: "main.yml.j2"
dest: "{{ ansible_chroot_dir }}/meta/main.yml"
mode: "0755"
validate: "ansible-lint --strict %s"
31 changes: 31 additions & 0 deletions playbooks/templates/main.yml.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# role: {{ meta_role_name }}
# file: meta/main.yml

galaxy_info:
namespace: {{ meta_namespace }}
role_name: {{ meta_role_name }}
author: {{ meta_author }}
company: {{ meta_company }}
description: {{ meta_role_description }}
license: {{ meta_license }}
issue_tracker_url: {{ meta_issue_tracker_url }}
min_ansible_version: "{{ meta_min_ansible_version }}"
{% if not meta_platforms %}platforms: []{% endif %}
{% if meta_platforms %}
platforms:
{% for platform in meta_platforms %}
- name: {{ platform.name }}
versions:
{% for version in platform.versions %}
- {{ version }}
{% endfor %}
{% endfor %}
{% endif %}
{% if not meta_galaxy_tags %}galaxy_tags: []{% endif %}
{% if meta_galaxy_tags %}
galaxy_tags:
{% for tag in meta_galaxy_tags %}
- {{ tag }}
{% endfor %}
{% endif %}

0 comments on commit 37ac9c0

Please sign in to comment.