이 콘텐츠는 선택한 언어로 제공되지 않습니다.

Chapter 4. Scaffolding an Ansible project with the AI assistant


Use the Ansible VS Code extension’s embedded MCP server to generate a new project structure, and to create and scaffold new content such as playbooks or collections. With the AI assistant, you can ensure the project aligns with best practices and organizational standards without manually creating boilerplate code.

4.1. Prerequisites

  • The Ansible VS Code extension is installed, running, and enabled in Agent Mode.
  • The Ansible MCP server is enabled in the Ansible VS Code extension.
  • Ansible development tools is installed.

4.2. Generate and view best practices for creating Ansible content

Before starting to create content, use the MCP server-enabled Ansible VS Code extension to generate and view Ansible best practices and coding guidelines.

Procedure

  1. Open the Copilot chat window by clicking the GitHub Copilot icon in the VS Code sidebar.
  2. Enter a natural language prompt requesting Ansible best practices. For example:

    • Show me Ansible best practices and coding guidelines so that I can write high-quality playbooks.

      This triggers the ansible_content_best_practices tool, which displays the guidelines for you to read within the editor.

  3. Enter a prompt requesting The Zen of Ansible. For example:

    • Show me the Zen of Ansible

      This triggers the zen_of_ansible tool, which will list Zen of Ansible principles for you to read within the editor.

4.3. Create the project structure with the AI assistant

Enter a prompt in natural language to trigger the project creation tool. When prompted, ansible-creator works in the background to generate the directory structure.

Procedure

  1. In the Copilot chat window, enter a prompt specifying the project name and type. For example:

    • Create a new Ansible playbook project called `webserver-deployment.`

      This triggers the create_ansible_projects tool. The extension then executes ansible-creator init playbook to generate the content.

Verification

After the assistant confirms that the task is complete, verify that the project structure is consistent with the standard layout.

  1. Navigate to the VS Code Explorer view.
  2. Locate the new directory (per the example above, webserver-deployment/).
  3. Confirm the presence of standard artifacts such as:

    1. Initial playbook files.
    2. Recommended configuration files (such as ansible.cfg, inventory).

4.4. Scaffold content with the AI assistant

If you need to generate specific content within the project using specific templates (such as a playbook or execution environment), you can continue the conversation.

Procedure

  • In the GitHub Copilot chat window, enter a natural language prompt requesting help with creating the type of content you need. For example:

    • For a playbook project, enter the prompt: Following best practices, help me create a playbook called 'webserver'…​"
    • For an execution environment, enter the prompt: Create an execution environment definition file using Fedora minimal as the base"
Red Hat logoGithubredditYoutubeTwitter

자세한 정보

평가판, 구매 및 판매

커뮤니티

Red Hat 문서 정보

Red Hat을 사용하는 고객은 신뢰할 수 있는 콘텐츠가 포함된 제품과 서비스를 통해 혁신하고 목표를 달성할 수 있습니다. 최신 업데이트를 확인하세요.

보다 포괄적 수용을 위한 오픈 소스 용어 교체

Red Hat은 코드, 문서, 웹 속성에서 문제가 있는 언어를 교체하기 위해 최선을 다하고 있습니다. 자세한 내용은 다음을 참조하세요.Red Hat 블로그.

Red Hat 소개

Red Hat은 기업이 핵심 데이터 센터에서 네트워크 에지에 이르기까지 플랫폼과 환경 전반에서 더 쉽게 작업할 수 있도록 강화된 솔루션을 제공합니다.

Theme

© 2026 Red Hat
맨 위로 이동