如何在Ansible上查看当前任务状态

时间:2018-09-26 08:44:23

标签: ansible

下面是我用于创建rd的有趣的剧本。

- name: provision stack
  hosts: localhost
  connection: local
  gather_facts: false

  # Launch the cloudformation-example.yml template.  Register the output.

  tasks:
  - name: launch ansible cloudformation example
    cloudformation: >
      stack_name="ansible-cloudformation" state=present
      region=us-east-1 disable_rollback=true
      template=files/simple-rds.yml
    args:
      template_parameters:
        vpcid: vpc-0123456
        application: abc
        appSubnetCidr1: 201.0.0.0/20
        appSubnetCidr2: 201.0.0.0/22
        dbCreateNewParamsGroup: true
        dbInstanceType: db.t2.micro
        dbName: testdb
        dbSubnetId1: subnet-87654321
        dbSubnetId2: subnet-12345678
        dbUsername: master_user
        environment: development
        product: ""
        dbPassword: ""
        techContact: ""
    register: stack
  - name: show stack outputs
    debug: msg="My stack outputs are {{stack.stack_outputs}}"

现在,当我运行剧本时,在控制台上会看到以下消息。

PLAY [provision stack] *********************************************************

TASK [create rds for the project] **********************************************
changed: [localhost]

TASK [show rds stack outputs] **************************************************

但是我看不到正在AWS端创建的资源和事件之类的当前状态。任务完成后,仅显示所有堆栈中的成功消息。

在执行任务期间,无论如何我都可以在ansible控制台上获取cloudformation更新。感觉有时候任务被冻结了。感谢您的帮助。

0 个答案:

没有答案