小编Suk*_*uku的帖子

在ansible中创建动态角色

通过几个文件去后,我得出的结论是,我不能使用with_itemsroles.

所以,我创建了一个filter_plugin生成角色列表的列表.

这是我的Play:

---
- name: Boostrap vpc and subnets with route table
  hosts: localhost
  connection: local
  gather_facts: no
  pre_tasks:
    - include_vars: ec2_vars/common/regions.yml
    - include_vars: environment.yml
  roles:
    - {
        role: vpc,
        ec2_region: 'ap-southeast-2'
      }
    - {
        role: vpc,
        ec2_region: "ap-southeast-1",
      }
    - {
        role: vpc,
        ec2_region: "us-west-2",
      }
Run Code Online (Sandbox Code Playgroud)

我想动态生成上述角色,为此我创建了一个filter_plugin生成字典列表并且正常工作的角色.

这是我的插件:

# this is for generating vpc roles

def roles(ec2_regions):
    return [{'role': 'vpc', 'ec2_region': ec2_region} for ec2_region in ec2_regions]


class FilterModule(object): …
Run Code Online (Sandbox Code Playgroud)

yaml ansible ansible-role

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

带“-k”和不带“-k”的卷曲

curl 当我使用without 打开网址时-k,我的请求正在通过,并且我能够看到预期的结果。

$ curl -vvv https://MYHOSTNAME/wex/archive.info -A SUKU$RANDOM
*   Trying 10.38.202.192...
* Connected to MYHOSTNAME (10.38.202.192) port 443 (#0)
* TLS 1.2 connection using TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384
* Server certificate: *.MYCNAME
* Server certificate: ProdIssuedCA1
* Server certificate: InternalRootCA
> GET /wex/archive.info HTTP/1.1
> Host: MYHOSTNAME
> User-Agent: SUKU19816
> Accept: */*
> 
< HTTP/1.1 200 OK
< Server: nginx/1.10.2
< Date: Thu, 26 Jan 2017 01:08:40 GMT
< Content-Type: text/html;charset=ISO-8859-1
< Content-Length: 19
< Connection: keep-alive
< Set-Cookie: …
Run Code Online (Sandbox Code Playgroud)

ssl curl nginx haproxy insecure-connection

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

通过PIPE发送Unix/Linux SIGNAL

我想SIGNAL.5几秒钟之后发送一个进程.

也许这不是一个好主意,但我想为一个不寻常的临时案例做这件事.

我试过跟随,但它不起作用.

(sleep .5;kill -9)| some_process
Run Code Online (Sandbox Code Playgroud)

linux bash signals pipe

0
推荐指数
1
解决办法
1210
查看次数

标签 统计

ansible ×1

ansible-role ×1

bash ×1

curl ×1

haproxy ×1

insecure-connection ×1

linux ×1

nginx ×1

pipe ×1

signals ×1

ssl ×1

yaml ×1