---
version: '3'

silent: true

tasks:
  ansible-lint:
    cmd: ansible-lint ./playbooks/
    desc: Lint Ansible playbooks

  jsonnet-lint:
    cmd: |-
      find . \
        -name "*.jsonnet" \
        -o -name "*.libsonnet" \
        -type f \
        | xargs -I{} sh -c 'jsonnet-lint {} && jsonnetfmt -i {}'
    desc: Lint and format Jsonnet files

  lint:
    deps:
      - ansible-lint
      - jsonnet-lint
    desc: Run various linting tasks

  jsonnet:
    aliases:
      - default
    # deps:
    #   - jsonnet-lint
    cmd: |-
      find . \
        -name "*.jsonnet" \
        -type f \
        | xargs -I{} sh ./scripts/jsonnet2yaml.sh {}
    desc: Generate YAML Ansible tasks from Jsonnet sources
