我简化的工作看起来像这样:
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 模块的方法。
如果我尝试注册结果并使用调试模块将其打印出来,我似乎也无法获得任何调试信息。
有人对我做错了什么有什么建议吗?
我试图为我的S3存储桶创建一个远程后端。
provider "aws" {
version = "1.36.0"
profile = "tasdik"
region = "ap-south-1"
}
terraform {
backend "s3" {
bucket = "ops-bucket"
key = "aws/ap-south-1/homelab/s3/terraform.tfstate"
region = "ap-south-1"
}
}
resource "aws_s3_bucket" "ops-bucket" {
bucket = "ops-bucket"
acl = "private"
versioning {
enabled = true
}
lifecycle {
prevent_destroy = true
}
tags {
Name = "ops-bucket"
Environmet = "devel"
}
}
Run Code Online (Sandbox Code Playgroud)
我尚未执行任何操作,到目前为止,该存储桶尚不存在。因此,terraform要求我做一个init
。但是当我尝试这样做时,我得到了
$ terraform init
Initializing the backend...
Successfully configured the backend "s3"! Terraform will automatically
use …
Run Code Online (Sandbox Code Playgroud) 我需要增加 ECS 任务中的堆栈大小。
是否aws_ecs_task_definition
支持 ulimit 堆栈大小?如果有的话,语法是什么?
amazon-web-services amazon-ecs terraform terraform-provider-aws
I have a domain registered on Route 53. This domain points towards some name servers of an old Route53 route. I'm now building my Terraform script to create a new Route53 zone. Is it possible to set the name servers when creating this? I tried the following, but that didn't work:
resource "aws_route53_record" "dev-ns" {
zone_id = "${aws_route53_zone.main.zone_id}"
name = "dev.example.com"
type = "NS"
ttl = "30"
records = [
"ns1.aws",
"ns2.aws",
"ns3.aws",
"ns4.aws",
]
}
Run Code Online (Sandbox Code Playgroud)
I could imagine that …
我想设置一个 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) 我正在尝试以vpc_config
块为条件部署 Lambda 函数。我试过在里面使用 countvpc_config
但不可能在那里使用 count 语句。根据资源的文档,如果您按如下方式传入空列表,则该vpc_config
部分将被忽略:
vpc_config {
subnet_ids = []
security_group_ids = []
}
Run Code Online (Sandbox Code Playgroud)
我可以确认这确实按预期工作(没有尝试配置 VPC)。
因此,我尝试将条件用于subnet_ids
and security_group_ids
- 类似的东西var.vpc_function ? var.subnet_ids : []
- 但你不能在条件语句中传入一个列表。我最接近解决方案的是下面的 hacky 数字,它加入然后拆分列表:
resource "aws_lambda_function" "lambda_function" {
...
vpc_config {
subnet_ids = ["${split(",", var.vpc_function ? join(",", var.subnet_ids) : join(",", var.empty_array))}"]
security_group_ids = ["${split(",", var.vpc_function ? join(",", aws_security_group.lambda_security_group.*.id) : join(",", var.empty_array))}"]
}
variable "vpc_function" {
default = "false"
}
variable "subnet_ids" {
type = "list"
default …
Run Code Online (Sandbox Code Playgroud) terraform ×5
ansible ×3
talend ×2
amazon-ecs ×1
ansible-2.x ×1
aws-lambda ×1
azure ×1
json ×1
policy ×1
ufw ×1