小编yda*_*coR的帖子

Talend:更新subjob中的全局变量

我简化的工作看起来像这样:

tSetGlobalVar --->(onSubJobOK)---> tRunJob --->(onSubJobOK)---> tJava

  • tSetGlobalVar将定义一个全局变量,其初始值可以说: myKey:"firstValue"
  • tRunJob将运行一个子作业,该子作业只包含第二个tSetGlobalVar组件,该组件应该为主作业中定义的全局变量设置一个新值: ((String)globalMap.get("myKey")): "newValue" 也试过这个: "myKey": "newValue"
  • tJava只用于调试,它的代码如下: System.out.println(((String)globalMap.get("myKey")));

实际产量: firstValue

预期产量: newValue

有没有其他方法可以修改子工作中的全局变量的值并获取主作业中的更新值?

talend

5
推荐指数
2
解决办法
2万
查看次数

Talend - 将两行合二为一

样本输入

这是我输入的一个例子。如您所见,地址列有 2 个值,我想将它们分开然后合并为一个值。

带有合并单元格的输入数据

预期产出

这就是输出应该是什么,将值合并到一个单元格中。

预期输出数据

Talend 输出

如果我将数据读入 Talend,它看起来像这样:

在此处输入图片说明

talend

5
推荐指数
1
解决办法
5384
查看次数

Ansible:如何继承变量?

我想在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

5
推荐指数
1
解决办法
3338
查看次数

Ansible ufw module错误:找不到符合'xxxxx'的个人资料

我正在通过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)

整个角色如下所示:

任务/ main.yml

     ---
    - name: Install ufw
      apt: name=ufw state=present
      tags:
        - security

    - name: Allow webservery things
      ufw:
        rule: allow …
Run Code Online (Sandbox Code Playgroud)

ansible ansible-playbook ufw

5
推荐指数
1
解决办法
4235
查看次数

Ansible wait_for 似乎不起作用

我正在通过 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 模块的方法。

如果我尝试注册结果并使用调试模块将其打印出来,我似乎也无法获得任何调试信息。

有人对我做错了什么有什么建议吗?

ansible ansible-2.x

5
推荐指数
1
解决办法
6926
查看次数

创建状态存储桶时,远程后端S3的Terraform初始化失败

我试图为我的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)

amazon-web-services terraform terraform-provider-aws

5
推荐指数
1
解决办法
1169
查看次数

在 Terraform 的 aws_ecs_task_definition 资源中设置 ulimit 堆栈大小

我需要增加 ECS 任务中的堆栈大小。

是否aws_ecs_task_definition支持 ulimit 堆栈大小?如果有的话,语法是什么?

amazon-web-services amazon-ecs terraform terraform-provider-aws

5
推荐指数
1
解决办法
3361
查看次数

How to create route53 zone with predefined NS, or update NS of a registered domain?

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 …

amazon-web-services terraform terraform-provider-aws

5
推荐指数
1
解决办法
2675
查看次数

Terraform:将包含字符串列表的变量传递给 jsonencode 部分

我想设置一个 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)

变量.tf

# Scope of the Allowed Locations policy
variable "scope_allowedlocations" {
  description = "The scope of the allowed locations assignment."
  default     = …
Run Code Online (Sandbox Code Playgroud)

policy json variable-assignment azure terraform

5
推荐指数
1
解决办法
1万
查看次数

Terraform 0.11:aws_lambda_function 中的条件 vpc_config

我正在尝试以vpc_config块为条件部署 Lambda 函数。我试过在里面使用 countvpc_config但不可能在那里使用 count 语句。根据资源的文档,如果您按如下方式传入空列表,则该vpc_config部分将被忽略:

  vpc_config {
    subnet_ids = []
    security_group_ids = []
  }
Run Code Online (Sandbox Code Playgroud)

我可以确认这确实按预期工作(没有尝试配置 VPC)。

因此,我尝试将条件用于subnet_idsand 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)

aws-lambda terraform terraform-provider-aws terraform0.11

5
推荐指数
1
解决办法
800
查看次数