0

은 공공 및 민간 서브넷의 한 쌍, NAT & 경로와 VPC를 배포 다음 site.yml는 Ansible와 Cloudformation 실행, 작업

--- 
- name: Deployment Playbook 
    hosts: localhost 
    connection: local 
    gather_facts: no 
    environment: 
    AWS_DEFAULT_REGION: "{{ lookup('env', 'AWS_DEFAULT_REGION') | default('us-east-1', true) }}" 
    tasks: 
    - import_tasks: tasks/network/vpc.yml 

그것은 tasks/network/vpc.yml을 실행을 고려하시기 바랍니다 건너 뜁니다. 아래 정의 :

--- 

# VPC 
- name: This deploys a VPC with a pair of public and private subnets spread across two Availability Zones. It deploys an Internet gateway, with a default route on the public subnets. It deploys a pair of NAT gateways (one in each zone), and default routes for them in the private subnets. 
    cloudformation: 
    stack_name: prod-vpc 
    state: present 
    region: us-east-1 
    disable_rollback: true 
    template: templates/infrastructure/network/vpc.yml 
    template_parameters: 
     EnvironmentName: "{{ environment_name }}" 
     VpcCIDR:   10.40.0.0/16 
     PublicSubnet1CIDR: 10.40.8.0/21 
     PublicSubnet2CIDR: 10.40.16.0/21 
     PrivateSubnet1CIDR: 10.40.24.0/21 
     PrivateSubnet2CIDR: 10.40.32.0/21 
    tags: 
     Environment: "{{ env }}" 
     Name: prod-vpc 
     Stack: "{{ stack_name }}" 
    when: vpc_stack is defined 
    register: prod_vpc_stack 

주어진 작업은 구름 형성 템플릿을 실행해야하지만, 나는 그것을 실행하지 않는 경우 :

$ ansible --version 
    ansible 2.4.2.0 
     config file = None 
     configured module search path = [u'/Users/gaurish/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules'] 
     ansible python module location = /usr/local/Cellar/ansible/2.4.2.0_1/libexec/lib/python2.7/site-packages/ansible 
     executable location = /usr/local/bin/ansible 
     python version = 2.7.14 (default, Dec 10 2017, 14:22:32) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.38)] 

$ ansible-playbook site.yml 

PLAY [Deployment Playbook] ********************************************************************************************************************** 

TASK [This deploys a VPC with a pair of public and private subnets spread across two Availability Zones. It deploys an Internet gateway, with a default route on the public subnets. It deploys a pair of NAT gateways (one in each zone), and default routes for them in the private subnets.] *** 
skipping: [localhost] 

PLAY RECAP ************************************************************************************************************************************** 
localhost     : ok=0 changed=0 unreachable=0 failed=0 

내가 어떤 이유로 볼 수 있듯이

는, ansible가 작업을 건너 뛰는 . 나는 그 이유를 이해하지 못한다. 아는 사람 있나요?

답변

1

작업이 when: vpc_stack is defined이어야하지만 vpc_stack은 질문에 게시 한 코드의 아무 곳에도 정의되어 있지 않으므로 작업을 건너 뜁니다.