Updated on 2024-09-04 GMT+08:00

Ansible

This action aims to execute the uploaded playbook on the host. Here is the configuration page.

Table 1 Parameters

Parameter

Description

Action Name

Name of an added deployment action. Max 128 characters. Do not start or end with a space. Use letters, digits, spaces, and these special characters: -_,;:./().

Environment

Select a host cluster as the deployment object.

Playbook Source

Artifact and Repo are available.

Playbook File

You can select an existing playbook file from Artifact or a playbook file uploaded from a local host.

NOTE:

Local software packages or files uploaded to Artifact can be reused.

Entry File Path

The entry file path of playbook.

Control Options

  • Enable this action.
  • Continue the task even if this action fails.

The following describes how to use playbook based on the playbook source:

CodeArts Artifact

  1. On the tab displaying application action details, select Artifact for Playbook Source, and click on the right of Playbook File.
  2. In the displayed Select File dialog box, select the corresponding playbook file compression package.

  3. Enter the entry file path of playbook.
  4. The entry file path is the directory generated after the playbook package is decompressed.

    • If the directory after decompression is similar to that shown in the following figure, the entry file path is AnsibleDemo/install.yml.

    • If the directory after decompression is similar to that shown in the following figure, the entry file path is install.yml.

CodeArts Repo

  1. On the tab displaying application action details, select Repo for Playbook Source.
  2. Select the code repository address (that is, the SSH URL of the code repository for storing playbook) from the Repo drop-down list.
  3. Select a code repository before selecting a branch.
  4. Select the entry file path.

    The entry file path is generated after the playbook package is decompressed.

  5. Configure parameters.

    Switch to the Parameter tab and click Create Now to add parameters for the Ansible application action or replace parameters in the all file.

    After an application task is executed, the corresponding build task is downloaded to a specified path.

    The following is an example of the architecture and content of the ALL file:

    tomcat_url: http://mirror.olnevhost.net/pub/apache/tomcat/tomcat-7/v7.0.78/bin/apache-tomcat-7.0.78.tar.gz 
    war_url: http://test.com/xxx.war     
    Figure 1 File architecture
    • If an added parameter exists in the playbook all file, the parameter with the same name in the all file will be replaced. Otherwise, the parameter will be used as a new parameter.
    • The parameter name cannot contain the following characters: decimal points (.), hyphens (-), and colons (:).

If you encounter any problem during deployment, see Solutions to Common Problems.