テンプレート名
ACS-ECS-ApplyAnsiblePlayBooks は、インスタンスで Ansible Playbook を実行します。
テンプレートの説明
ECS インスタンスで Ansible Playbook を実行します。CentOS、Alibaba Cloud Linux、Ubuntu のみがサポートされています。
テンプレートタイプ
オートメーション
所有者
Alibaba Cloud
入力パラメーター
|
パラメーター名 |
説明 |
タイプ |
必須 |
デフォルト値 |
制約 |
|
|
targets |
ターゲットインスタンス。 |
JSON |
Yes |
|||
|
sourceType |
プレイブックのストレージタイプ。 |
String |
Yes |
|||
|
sourcePath |
プレイブックが保存されている URL。 |
String |
Yes |
|||
|
playbookFile |
実行するプレイブックの名前。 |
String |
Yes |
|||
|
regionId |
リージョン ID。 |
String |
No |
{{ ACS::RegionId }} |
||
|
tokenInfo |
プレイブックのダウンロードに使用するトークン。GitHub からプレイブックをダウンロードする場合にのみ必要です。 |
String |
No |
"" |
||
|
hosts |
プレイブックの実行に使用する hosts ファイル。 |
String |
No |
/etc/ansible/hosts |
||
|
installDependencies |
|
Boolean |
No |
True |
||
|
workingDir |
プレイブックを実行する作業ディレクトリ。 |
String |
No |
/root/ansible-workspace |
||
|
check |
check パラメーターを使用して、Ansible の実行をチェックします。 |
Boolean |
No |
True |
||
|
extraVariables |
実行時に Ansible に渡す追加変数。 |
String |
No |
color=red |
文字列検証の正規表現: |
|
|
verbose |
プレイブック実行のログ出力の詳細レベル。低詳細度の場合は |
String |
No |
-v |
||
|
rateControl |
タスク実行のレート制御。 |
JSON |
No |
{'Mode': 'Concurrency', 'MaxErrors': 0, 'Concurrency': 10} |
||
|
OOSAssumeRole |
OOS が引き受ける Resource Access Management (RAM) ロール。 |
String |
No |
"" |
出力パラメーター
|
パラメーター名 |
説明 |
タイプ |
|
commandOutput |
String |
このテンプレートの実行に必要なアクセスポリシー
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:DescribeInstances",
"ecs:DescribeInvocationResults",
"ecs:DescribeInvocations",
"ecs:RunCommand"
],
"Resource": "*",
"Effect": "Allow"
}
]
}
詳細
詳細については、「ACS-ECS-ApplyAnsiblePlayBooks」をご参照ください。
テンプレートの内容
FormatVersion: OOS-2019-06-01
Description:
en: 'Use this template to run an Ansible playbook on an ECS instance. This template supports only CentOS, Alibaba Cloud Linux, and Ubuntu.'
zh-cn: 'Use this template to run an Ansible Playbook on an ECS instance. This template supports only CentOS, Alibaba Cloud Linux, and Ubuntu.'
ja: 'このテンプレートを使用して、ECS インスタンスで Ansible Playbook を実行します。このテンプレートは CentOS、Alibaba Cloud Linux、Ubuntu のみをサポートします。'
name-en: ACS-ECS-ApplyAnsiblePlayBooks
name-zh-cn: Run an Ansible Playbook in an instance
name-ja: インスタンスで Ansible Playbook を実行
categories:
- run_command
Parameters:
regionId:
Type: String
Label:
en: RegionId
zh-cn: Region ID
ja: リージョン ID
AssociationProperty: RegionId
Default: '{{ ACS::RegionId }}'
targets:
Label:
en: TargetInstance
zh-cn: Target instance
ja: ターゲットインスタンス
Type: Json
AssociationProperty: Targets
AssociationPropertyMetadata:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: regionId
sourceType:
Type: String
Label:
en: SourceType
zh-cn: The storage type of the playbook
ja: ソースタイプ
AllowedValues:
- oss
- https
- github
sourcePath:
Type: String
Label:
en: SourcePath
zh-cn: The URL where the playbook is stored.
ja: ソースパス
Description:
en: 'Specify the URL in a format such as https://example.com/playbook.yml'
zh-cn: 'Specify the URL in a format such as https://example.com/playbook.yml'
ja: 'https://example.com/playbook.yml のような形式で URL を指定します'
playbookFile:
Label:
en: PlaybookFile
zh-cn: The name of the playbook to run.
ja: Playbook ファイル
Description:
en: 'For example: example.yml'
zh-cn: 'For example: example.yml'
ja: '例:example.yml'
Type: String
tokenInfo:
Type: String
Label:
en: TokenInfo
zh-cn: The token used to download the playbook.
ja: トークン情報
Description:
en: 'Required only when you download a playbook from GitHub.'
zh-cn: 'Required only when you download a playbook from GitHub.'
ja: 'GitHub からプレイブックをダウンロードする場合にのみ必要です。'
Default: ""
hosts:
Type: String
Label:
en: Hosts
zh-cn: The hosts file used to run the playbook.
ja: Hosts
Default: /etc/ansible/hosts
installDependencies:
Label:
en: InstallDependencies
zh-cn: Specifies whether OOS installs Ansible and its dependencies from the PyPI repository.
ja: 依存関係のインストール
Description:
en: 'If set to True, OOS installs Ansible and its dependencies, including Python, from the PyPI repository. If set to False, verify that Ansible and its dependencies are installed on the target instances.'
zh-cn: 'If set to True, OOS installs Ansible and its dependencies, including Python, from the PyPI repository. If set to False, verify that Ansible and its dependencies are installed on the target instances.'
ja: 'True に設定すると、OOS は Python を含む Ansible とその依存関係を PyPI リポジトリからインストールします。False に設定した場合は、Ansible とその依存関係がターゲットインスタンスにインストールされていることを確認してください。'
Type: Boolean
Default: true
workingDir:
Label:
en: WorkingDir
zh-cn: The directory where the playbook is run.
ja: 作業ディレクトリ
Type: String
Default: /root/ansible-workspace
check:
Label:
en: Check
zh-cn: Runs an Ansible execution check using the check parameter.
ja: チェック
Type: Boolean
Default: true
extraVariables:
Type: String
Label:
en: ExtraVariables
zh-cn: The extra variables that are passed to Ansible at runtime.
ja: 追加変数
Description:
en: 'Enter a space-separated list of key-value pairs. For example: color=red flavor=lime'
zh-cn: 'Enter a space-separated list of key-value pairs. For example: color=red flavor=lime'
ja: 'スペースで区切られたキーと値のペアのリストを入力します。例:color=red flavor=lime'
Default: color=red
AllowedPattern: ^$|^\w+\=\S+(\s\w+\=\S+)*$
verbose:
Type: String
Label:
en: Verbose
zh-cn: The verbosity level for logging the playbook execution.
ja: 詳細
Description:
en: 'Specify -v for low verbosity, -vv or -vvv for medium verbosity, and -vvvv for the debug level.'
zh-cn: 'Specify -v for low verbosity, -vv or -vvv for medium verbosity, and -vvvv for the debug level.'
ja: '低詳細度の場合は -v、中詳細度の場合は -vv または -vvv、デバッグレベルの場合は -vvvv を指定します。'
AllowedValues:
- '-v'
- '-vv'
- '-vvv'
- '-vvvv'
Default: '-v'
rateControl:
Label:
en: RateControl
zh-cn: The concurrency rate of the task execution.
ja: レート制御
Type: Json
AssociationProperty: RateControl
Default:
Mode: Concurrency
MaxErrors: 0
Concurrency: 10
OOSAssumeRole:
Label:
en: OOSAssumeRole
zh-cn: The RAM role that OOS assumes.
ja: OOSAssumeRole
Type: String
Default: ''
RamRole: '{{ OOSAssumeRole }}'
Tasks:
- Name: getInstance
Description:
en: Views the ECS instances
zh-cn: Get ECS instances.
ja: ECS インスタンスの表示
Action: 'ACS::SelectTargets'
Properties:
ResourceType: 'ALIYUN::ECS::Instance'
RegionId: '{{ regionId }}'
Filters:
- '{{ targets }}'
Outputs:
instanceIds:
Type: List
ValueSelector: 'Instances.Instance[].InstanceId'
- Name: applyPlaybook
Action: 'ACS::ECS::ApplyAnsiblePlayBook'
Description:
en: Apply the specified playbook
zh-cn: Apply the specified playbook.
ja: 指定されたプレイブックの適用
Properties:
regionId: '{{ regionId }}'
instanceId: '{{ ACS::TaskLoopItem }}'
sourceType: '{{ sourceType }}'
sourcePath: '{{ sourcePath }}'
playbookFile: '{{ playbookFile }}'
tokenInfo: '{{ tokenInfo }}'
hosts: '{{ hosts }}'
installDependencies: '{{ installDependencies }}'
workingDir: '{{ workingDir }}'
check: '{{ check }}'
extraVariables: '{{ extraVariables }}'
verbose: '{{ verbose }}'
Loop:
Items: '{{ getInstance.instanceIds }}'
RateControl: '{{ rateControl }}'
Outputs:
commandOutputs:
AggregateType: 'Fn::ListJoin'
AggregateField: commandOutput
Outputs:
commandOutput:
Type: String
ValueSelector: commandOutput
Outputs:
commandOutput:
Type: String
Value: '{{ applyPlaybook.commandOutputs }}'
Metadata:
ALIYUN::OOS::Interface:
ParameterGroups:
- Parameters:
- sourceType
- sourcePath
- playbookFile
- tokenInfo
- hosts
- installDependencies
- workingDir
- check
- extraVariables
- verbose
Label:
default:
zh-cn: Configure parameters
en: Configure parameters
ja: パラメーターの設定
- Parameters:
- regionId
- targets
Label:
default:
zh-cn: Select instances
en: Select instances
ja: インスタンスの選択
- Parameters:
- rateControl
- OOSAssumeRole
Label:
default:
zh-cn: Advanced options
en: Advanced options
ja: 詳細オプション