다음과 같이 3 가지 작업이 있습니다.각 작업의 종료 상태를 얻는 방법
--- - name: Instance provisioning local_action: module: ec2 region: "{{ vpc_region }}" key_name: "{{ ec2_keypair }}" instance_type: "{{ instance_type }}" image: "{{ ec2_image}}" zone: "{{ public_az }}" volumes: - device_name: "{{ device }}" volume_type: "{{ instance_volumetype }}" volume_size: "{{ volume }}" delete_on_termination: "{{ state }}" instance_tags: Name: "{{ instance_name }}_{{ release_name }}_APACHE" environment: "{{ env_type }}" vpc_subnet_id: "{{ public_id }}" assign_public_ip: "{{ public_ip_assign }}" group_id: "{{ sg_apache }},{{ sg_internal }}" wait: "{{ wait_type }}" register: ec2 - name: adding group to inventory file lineinfile: dest: "/etc/ansible/hosts" regexp: "^\\[{{ release_name }}\\]" line: "[{{ release_name }}]" state: present - name: adding apache ip to hosts lineinfile: dest: "/etc/ansible/hosts" line: "{{ item.private_ip }} name=apache dns={{ item.public_dns_name }} with_items: ec2.instances
이제는 성공 여부에 관계없이 각 작업의 종료 상태를 확인하고 싶습니다.
작업 중 하나라도 실패하면 다른 작업을 실행해서는 안됩니다.
ansible 각본
모두 안녕을하자, 그래서 pls는 나의 더 잘 이해하기위한 샘플 예제를 공유 할 수 있습니다. – kumar