我简化的工作看起来像这样:
tSetGlobalVar --->(onSubJobOK)---> tRunJob --->(onSubJobOK)---> tJava
myKey:"firstValue"
((String)globalMap.get("myKey")): "newValue"
也试过这个:
"myKey": "newValue"
System.out.println(((String)globalMap.get("myKey")));
实际产量: firstValue
预期产量: newValue
有没有其他方法可以修改子工作中的全局变量的值并获取主作业中的更新值?
样本输入
这是我输入的一个例子。如您所见,地址列有 2 个值,我想将它们分开然后合并为一个值。
预期产出
这就是输出应该是什么,将值合并到一个单元格中。
Talend 输出
如果我将数据读入 Talend,它看起来像这样:
我想在Ansible中实现变量继承。可以说我有:
group_vars /全部
---
ifaces:
- name: eth0
adress: 10.107.13.236
netmask: 255.255.255.192
routes:
- {from: 10.108.100.34/31, via: 10.107.13.193}
- {from: 10.108.105.128/31, via: 10.107.13.193}
- name: eth1
adress: 10.112.13.236
netmask: 255.255.255.192
gateway: 10.112.13.193
routes:
- {from: 10.2.1.0/26, via: 10.112.13.254}
Run Code Online (Sandbox Code Playgroud)
现在,我想扩展eth0的路由,如下所示:
group_vars /网络服务器
--- ifaces:
- name: eth0
routes:
- {from: 1.2.3.34, via: 5.6.7.8}
- {from: 9.9.9.9/9, via: 5.6.7.8}
Run Code Online (Sandbox Code Playgroud)
我想要的结果是:
---
ifaces:
- name: eth0
adress: 10.107.13.236
netmask: 255.255.255.192
routes:
- {from: 10.108.100.34/31, via: 10.107.13.193}
- {from: 10.108.105.128/31, via: 10.107.13.193}
- {from: …
Run Code Online (Sandbox Code Playgroud) 我正在通过Ansible设置UFW规则.我能够安装它,启动它并拒绝一切.然后我尝试允许来自http,https和ssh的连接.所有为这些项添加允许的尝试都会遇到如下错误:
failed: [lempy1] (item={u'service': u'http'}) => {"failed": true, "item": {"service": "http"}, "msg": "ERROR: Could not find a profile matching 'http'\n"}
failed: [lempy1] (item={u'service': u'https'}) => {"failed": true, "item": {"service": "https"}, "msg": "ERROR: Could not find a profile matching 'https'\n"}
failed: [lempy1] (item={u'service': u'ssh'}) => {"failed": true, "item": {"service": "ssh"}, "msg": "ERROR: Could not find a profile matching 'ssh'\n"}
Run Code Online (Sandbox Code Playgroud)
整个角色如下所示:
---
- name: Install ufw
apt: name=ufw state=present
tags:
- security
- name: Allow webservery things
ufw:
rule: allow …
Run Code Online (Sandbox Code Playgroud) 我正在通过 Terraform 配置一个新服务器,并使用 Ansible 作为本地系统上的配置程序。
Terraform 在 EC2 上配置一个系统,然后运行 Ansible playbook,提供新建系统的 IP 作为库存。
我想使用 Ansible 等待系统完成启动并阻止尝试进一步的任务,直到可以建立连接。到目前为止,我一直在使用手动暂停,这是不方便且不精确的。
Ansible 似乎并没有按照文档所说的那样做(除非我错了,这是一种很可能的情况)。这是我的代码:
- name: waiting for server to be alive
wait_for:
state: started
port: 22
host: "{{ ansible_ssh_host | default(inventory_hostname) }}"
delay: 10
timeout: 300
connect_timeout: 300
search_regex: OpenSSH
delegate_to: localhost
Run Code Online (Sandbox Code Playgroud)
此步骤中发生的情况是,连接未等待超过 10 秒就建立连接,并且失败。如果服务器已启动并且我再次尝试剧本,它会正常工作并按预期执行。
我也尝试过do_until
样式循环,但似乎永远不起作用。文档中给出的所有示例都使用 shell 输出,并且我看不出它有任何适用于非 shell 模块的方法。
如果我尝试注册结果并使用调试模块将其打印出来,我似乎也无法获得任何调试信息。
有人对我做错了什么有什么建议吗?
假设我有一个公共托管区域名称example.com.
。我使用以下 Terraform 代码根据文档的名称动态获取托管区域 ID 。
data "aws_route53_zone" "main" {
name = "example.com." # Notice the dot!!!
private_zone = false
}
Run Code Online (Sandbox Code Playgroud)
在terraform plan
它出现此错误期间:
Error refreshing state: 1 error(s) occurred:
* data.aws_route53_zone.main: no matching Route53Zone found
Run Code Online (Sandbox Code Playgroud)
是否有我应该报告的错误或我遗漏了什么?
我之前在该us-east-1
区域中创建了一个存储桶,其中包含我要在其他区域部署的Lambda代码.当我在us-west-2
区域中尝试使用相同代码的Terraform部署时,我收到以下错误:
Error creating Lambda function: InvalidParameterValueException: Error occurred while GetObject. S3 Error Code: PermanentRedirect. S3 Error Message: The bucket is in this region: us-east-1. Please use this region to retry the request
Run Code Online (Sandbox Code Playgroud)
我认为无法在Terraform的aws_lambda_function
资源中指定S3存储桶的区域.
使用Terraform,是否可以在一个区域中提供S3存储桶,以提供可在其他区域部署的Lambda代码?
Terraform是否支持条件属性?我只想根据变量的值使用属性。
例:
resource "aws_ebs_volume" "my_volume" {
availability_zone = "xyz"
size = 30
if ${var.staging_mode} == true:
snapshot_id = "a_specific_snapshot_id"
endif
}
Run Code Online (Sandbox Code Playgroud)
上面if
包含该属性的语句snapshot_id
是我要寻找的。Terraform是否基于变量的值支持这种属性包含。
我尝试创建一个新的 s3 存储桶并遇到冲突,尽管我知道该存储桶名称是新的、唯一的,并且自使用该名称以来已经过去了很多小时 (8+)。附详细信息。我什至尝试过使用一个新名称,但我知道该名称从来都不是我帐户中的存储桶(而且可能从来都不是存储桶)。
下面日志中的名称是虚构的,而不是我正在使用的名称,该名称对于我的域来说是唯一的且具有命名空间。
如果我使用 aws s3 cli 来创建存储桶(即aws s3 mb s3://{same-bucket-name} --region us-east-2
),其中{same-bucket-name}
是我要创建的存储桶的名称,则它可以正常工作。
2019-07-07T00:12:19.463-0400 [DEBUG] plugin.terraform-provider-aws_v2.18.0_x4: 2019/07/07 00:12:19 [DEBUG] Trying to create new S3 bucket: "my-unique-s3-bucket-name"
2019-07-07T00:12:19.464-0400 [DEBUG] plugin.terraform-provider-aws_v2.18.0_x4: 2019/07/07 00:12:19 [DEBUG] [aws-sdk-go] DEBUG: Request s3/CreateBucket Details:
2019-07-07T00:12:19.464-0400 [DEBUG] plugin.terraform-provider-aws_v2.18.0_x4: ---[ REQUEST POST-SIGN ]-----------------------------
2019-07-07T00:12:19.464-0400 [DEBUG] plugin.terraform-provider-aws_v2.18.0_x4: PUT /my-unique-s3-bucket-name HTTP/1.1
2019-07-07T00:12:19.464-0400 [DEBUG] plugin.terraform-provider-aws_v2.18.0_x4: Host: s3.us-east-2.amazonaws.com
2019-07-07T00:12:19.464-0400 [DEBUG] plugin.terraform-provider-aws_v2.18.0_x4: User-Agent: aws-sdk-go/1.20.12 (go1.12.5; darwin; amd64) APN/1.0 HashiCorp/1.0 Terraform/0.12.2
2019-07-07T00:12:19.464-0400 [DEBUG] plugin.terraform-provider-aws_v2.18.0_x4: Content-Length: 153
2019-07-07T00:12:19.464-0400 [DEBUG] plugin.terraform-provider-aws_v2.18.0_x4: …
Run Code Online (Sandbox Code Playgroud) amazon-s3 amazon-web-services terraform terraform-provider-aws
我想设置一个 Terraform 模块,根据 Terraforms策略分配示例将策略分配给 Azure 资源。
为了分配允许位置策略,我想将允许位置列表作为字符串列表从 variables.tf 文件传递到 main.tf,在那里执行分配。
#Allowed Locations Policy Assignment
resource "azurerm_policy_assignment" "allowedlocations" {
name = "allowed-locations"
scope = var.scope_allowedlocations
policy_definition_id = var.policy_allowedlocations.id
description = "This policy enables you to restrict the locations."
display_name = "Allowed Locations"
parameters = <<PARAMETERS
{
"allowedLocations": {
"value": ${var.listofallowedlocations}
}
}
PARAMETERS
}
Run Code Online (Sandbox Code Playgroud)
# Scope of the Allowed Locations policy
variable "scope_allowedlocations" {
description = "The scope of the allowed locations assignment."
default = …
Run Code Online (Sandbox Code Playgroud) terraform ×5
ansible ×3
talend ×2
amazon-s3 ×1
ansible-2.x ×1
aws-lambda ×1
azure ×1
json ×1
policy ×1
ufw ×1