第6章 Installing and configuring the Ansible code bot


The Ansible code bot scans existing content collections, roles, and playbooks hosted in GitHub repositories, and proactively creates pull requests whenever best practices or quality improvement recommendations are available.

Ansible code bot scans your code repositories to recommend code quality improvements. It promotes Ansible best practices while avoiding common errors that can lead to bugs or make code harder to maintain. The bot automatically submits pull requests to the repository, which proactively alerts the repository owner to a recommended change to their content. You can configure Ansible code bot to scan your existing Git repositories (both public and private).

注記

Your organization must have an active subscription to Red Hat Ansible Automation Platform to use the Ansible code bot. However, IBM watsonx Code Assistant is not required to use the Ansible code bot.

After the Ansible code bot is installed, it automatically scans the selected repositories that are in Jinja format. Once the scanning is complete, the code bot generates an initial PR for each repository; the initial PR also contains the scan schedule configured to run weekly. You must review the initial PR for the suggested changes and merge the PR. Once the initial PR is merged, the scan schedule is triggered, and the subsequent repository scans are performed weekly. If required, you can change the scan schedule to a daily or monthly cadence.

You can access the Ansible code bot dashboard that displays all your repositories that have the bot installed along with their scan status. From the dashboard, you can start a manual scan, view the scan history, and view the repository. From GitHub, you can configure a schedule to scan your repository at regular intervals, and add or remove a repository from being scanned. For more information, see Managing repository scans.

重要

Ansible code bot is supported on the following GitHub versions:

  • GitHub.com
  • GitHub Enterprise Cloud

    Ansible code bot is not supported on GitHub Enterprise Server. For more information, see GitHub’s plans in the GitHub documentation.

The following examples are code recommendations that the Ansible code bot can suggest:

  • Available alternatives for deprecated legacy syntax or implementation patterns
  • Module version changes and updates, such as:

    • Adding any new required parameters
    • Flagging deprecated parameters
    • Removing unused parameters
  • Applying YAML best practices
  • Adding comment blocks
  • Fixing casing issues in name fields

6.1. Installing the Ansible code bot

Install the Ansible code bot to get code recommendations for your repositories, and then log in to the Ansible code bot dashboard to monitor and manage your repository scans.

Procedure

  1. Log in to GitHub by using the account associated with your organization.
  2. Go to the Ansible code bot GitHub app.
  3. Select the Ansible repositories that you want the app to access:

    • All repositories: Provides access to read the metadata of all repositories.
    • Only select repositories: Provides access to read the metadata of only the repositories that you select.
  4. Optional: If you selected Only select repositories in the previous step, select the repositories that you want the Ansible code bot to access from the Select repositories list.
  5. Click Install & Authorize. A message is displayed that specifies the following permissions are granted automatically to the bot during installation:

    • Read access to metadata
    • Read and write access to code and pull requests
  6. When prompted, log in to your Red Hat Single Sign-On account as an organization administrator.
  7. Log in to the Ansible code bot dashboard:

    1. On the Authorize Ansible code bot page, verify your account and repository permissions.
    2. Click Authorize Ansible.

      From the Authorize Ansible code bot page, the following actions occur:

      • Ansible code bot verifies that you are a part of an organization that has an active subscription to Red Hat Ansible Automation Platform.
      • GitHub requests read permissions to access the repositories associated with your account.

        On successful authorization, you are logged in to Ansible code bot dashboard. The dashboard displays all your repositories that have the Ansible code bot installed along with their scan status.

Verification

After the Ansible code bot is installed, it automatically scans the selected repositories that are in Jinja format. When the scanning is complete, the code bot generates an initial PR for each repository; the initial PR also contains the scan schedule configured to run weekly.

Perform the following tasks:

  1. Review the initial PR for the suggested changes, and merge the PR.

    After you merge the initial PR, the configured scan schedule is triggered, and the subsequent repository scans are performed weekly.

    注記

    If you do not merge the initial PR, the weekly scan schedule is not triggered and the Ansible code bot dashboard displays the repositories without any associated scan history.

    The following illustration is an example of an initial PR being created:

    Ansible code bot settings
  2. Optional: If required, you can manually scan your repositories or change the scan schedule to a daily or monthly cadence.
  3. Modify scanned repositories by adding repositories or removing existing repositories from being scanned.
Red Hat logoGithubRedditYoutubeTwitter

詳細情報

試用、購入および販売

コミュニティー

会社概要

Red Hat は、企業がコアとなるデータセンターからネットワークエッジに至るまで、各種プラットフォームや環境全体で作業を簡素化できるように、強化されたソリューションを提供しています。

多様性を受け入れるオープンソースの強化

Red Hat では、コード、ドキュメント、Web プロパティーにおける配慮に欠ける用語の置き換えに取り組んでいます。このような変更は、段階的に実施される予定です。詳細情報: Red Hat ブログ.

Red Hat ドキュメントについて

Legal Notice

Theme

© 2026 Red Hat
トップに戻る