Download and install assets from Github releases page.
Note: Do not modify README.md directly.
It is auto-generated by python generate_readme in readme_src folder.
ansible-galaxy collection install git+https://github.com/QueraTeam/ansible-github.gitAlternatively, you may manually install the install_from_github module itself as a local custom module instead of installing the module through the quera.github Ansible collection. However, it is recommended to use quera.github collection unless you have a good reason not to. Here are the commands to install the install_from_github module as a local custom module:
# Create the user custom module directory
mkdir -p ~/.ansible/plugins/modules
# Install the install_from_github module into the user custom module directory
curl -o ~/.ansible/plugins/modules/install_from_github.py https://raw.githubusercontent.com/QueraTeam/ansible-github/main/plugins/modules/install_from_github.pyThis module can be used to select a release from a Github repository, select an asset from that release based on OS and CPU architecture, download the asset, and install files/directories from the asset.
| Parameter | Type | Description | 
|---|---|---|
| asset_arch_mapping | Type: dict | If the repo uses non-standard strings to specify CPU architecture, you can define a custom mapping between those and standard architectures. For example, if some repo uses 64instead ofx86_64oramd64, you can set this option toamd64: "64"orx86_64: "64". | 
| asset_archive_format | Type: str | If the asset is an archive, you can specify the archive format for unpacking. The format should be one of the formats supported by Python's shutil.unpack_archive()function:zip,tar,gztar,bztar, orxztar. If not provided, the module will use the filename extension to guess the format. | 
| asset_regex | Type: strRequired | A regex for selecting an asset (file name) from all the assets of selected release. If there are multiple assets for different OSes and CPU architectures, you don't need to specify OS (darwin, linux, ...) and architecture (x86_64, amd64, aarch64, arm64, ...) in your regex (just write .*in place of them). This module tries to narrow down assets based on the system's OS and CPU architecture. | 
| move_rules | Type: listRequired | You need to specify how individual items from an asset should be moved to the system. Privide a list of rules. Each rule should specify src_regexanddst, and could specifymode,owner,group. An asset can be a single file, or an archive (.zip,.tar.gz, ...). When asset is an archive, you select bysrc_regexsome paths (directories or files) relative to archive root, and they will move todst. Even if the asset is just a single file (not an archive), you should specify a rule to move that file (src_regexcan be any regex mathing file name, e.g..*). | 
| repo | Type: strRequired | The name of the repository in the format user_or_org/repo_name. | 
| tag | Type: strDefault: latest | The tag to select from releases page. The default ( latest) means the most recent non-prerelease, non-draft release. | 
| version_command | Type: str | The command to get the currently installed version. (e.g. some_command --version) If the output of this command matches the selected asset, downloading and installing the asset is skipped. | 
| version_file | Type: path | Path to a file containing the version of currently installed version. The module reads the version from this file instead of version_commandbefore installing (to skip download if the desired version is installed) and writes the installed version to this file after successful installation. This is useful for non-executable assets which don't have any--versioncommand (e.g. fonts, ...). If you passversion_file, you can't passversion_commandorversion_regexoptions. | 
| version_regex | Type: strDefault: \d+\.\d+(?:\.\d+)? | A regex for extracting version from the output of version_commandor tag name. The default is to match 2 or 3 numbers joined by.. E.g. 1.12.7 or 1.12 | 
- name: install latest version of lego (ACME client)
  quera.github.install_from_github:
    repo: go-acme/lego
    asset_regex: lego.*\.tar\.gz
    version_command: lego --version
    move_rules:
      - src_regex: lego
        dst: /usr/local/bin
        mode: 0755
- name: install a specific version of sentry-cli
  quera.github.install_from_github:
    repo: getsentry/sentry-cli
    tag: "2.8.1"
    asset_regex: sentry-cli-.*
    version_command: sentry-cli --version
    move_rules:
      - src_regex: sentry-cli-.*
        dst: /usr/local/bin/sentry-cli
        mode: 0755
- name: install both executable and data
  quera.github.install_from_github:
    repo: example/example
    asset_regex: example-.*\.zip
    asset_arch_mapping:
      amd64: "64"  # This repo indicates amd64 as example-64.zip instead of example-amd64.zip or example-x86_64.zip.
    version_command: example --version
    move_rules:
      - src_regex: example
        dst: /usr/local/bin
        mode: 0755
      - src_regex: .*\.dat
        dst: /usr/local/share/example
        mode: 0644
- name: install some data file (e.g. font, ...)
  quera.github.install_from_github:
    repo: example/example
    asset_regex: exampledata.dat
    version_file: /usr/local/share/example/exampledata.dat.version
    move_rules:
      - src_regex: exampledata.dat
        dst: /usr/local/share/example