benschubert.infrastructure.github_content module – Get the content of a file or directory on GitHub

Note

This module is part of the benschubert.infrastructure collection (version 0.0.1).

It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install benschubert.infrastructure.

To use it in a playbook, specify: benschubert.infrastructure.github_content.

Synopsis

Parameters

Parameter

Comments

owner

string / required

The owner of the repository

path

string / required

The path inside the repository for the file or directory

ref

string / required

The branch/tag/git id for which to get the path

repo

string / required

The repository name

Examples

- name: Get the license file info for the ansible repo
  github_content:
    owner: ansible
    path: COPYING
    ref: devel
    repo: ansible
  register: _ansible_license

Return Values

Common return values are documented here, the following are the fields unique to this module:

Key

Description

content

dictionary

The information returned by the GitHub content API

Returned: always

Sample: "See https://docs.github.com/en/rest/repos/contents"

msg

string

Information on what happen

Returned: always

Sample: "Retrieved file information"

Authors

  • Benjamin Schubert (@benjaminschubert)