Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------- Task 1 Vars ---------------
- [ec2-user@ip-172-31-6-232 ~]$ cat main.yml
- ---
- - name: "Variables priority checking"
- hosts: localhost
- vars:
- myvars: "This is the var in play level"
- vars_files:
- - vars.yml
- tasks:
- - name: "debugging the vars priority"
- debug:
- var: myvars
- ### Output ####
- [ec2-user@ip-172-31-6-232 ~]$ ansible-playbook main.yml
- PLAY [Variables priority checking] *************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [localhost]
- TASK [debugging the vars priority] *************************************************************************************
- ok: [localhost] => {
- "myvars": "You are seeing the vars_file result"
- }
- PLAY RECAP *************************************************************************************************************
- localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- #### Command line execution ####
- [ec2-user@ip-172-31-6-232 ~]$ ansible-playbook main.yml -e myvars='"You are seeing the command line executed vars"'
- PLAY [Variables priority checking] *************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [localhost]
- TASK [debugging the vars priority] *************************************************************************************
- ok: [localhost] => {
- "myvars": "You are seeing the command line executed vars"
- }
- PLAY RECAP *************************************************************************************************************
- localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- ### Task leve execution ###
- ---
- - name: "Variables priority checking"
- hosts: localhost
- vars:
- myvars: "This is the var in play level"
- vars_files:
- - vars.yml
- tasks:
- - name: "debugging the vars priority"
- vars:
- myvars: "You are seeing the var result in task level"
- debug:
- var: myvars
- ### Output ####
- [ec2-user@ip-172-31-6-232 ~]$ ansible-playbook main.yml'
- PLAY [Variables priority checking] *************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [localhost]
- TASK [debugging the vars priority] *************************************************************************************
- ok: [localhost] => {
- "myvars": "You are seeing the var result in task level"
- }
- PLAY RECAP *************************************************************************************************************
- localhost : ok=2 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- #### Rolling update ####
- ---
- - name: "Creating a dynamic inventory for Zomato-infra"
- hosts: localhost
- become: true
- vars:
- pip_modules:
- - boto3
- - botocore
- vars_files:
- - config.yml
- tasks:
- - name: "Ansible galaxy installl aws collection"
- community.general.ansible_galaxy_install:
- type: collection
- name: amazon.aws
- - name: "Install python3-pip module"
- yum:
- name: python3-pip
- state: present
- - name: "Install pip3 modules for amazon.aws"
- pip:
- name: "{{ pip_modules }}"
- - name: "Collect aws ec2-instance info of zomato-infra"
- amazon.aws.ec2_instance_info:
- access_key: "{{ access_key }}"
- secret_key: "{{ secret_key }}"
- region: ap-south-1
- filters:
- "tag:Name": "Zomato-webserver"
- "tag:aws:autoscaling:groupName": "shopping-asg"
- "tag:Project": "Zomato"
- "tag:Env": "Dev"
- register: zomato_status
- - name: "Creating a dynamic inventory"
- add_host:
- hostname: "{{ item.private_ip_address }}"
- groups: Zomato-infra
- ansible_ssh_host: "{{ item.private_ip_address }}"
- ansible_ssh_user: ec2-user
- ansible_ssh_private_key_file: ./aws.pem
- ansible_ssh_common_args: "-o StrictHostKeyChecking=no"
- ansible_python_interpreter: auto_silent
- with_items:
- - "{{ zomato_status.instances }}"
- - name: "Rolling update"
- hosts: Zomato-infra
- serial: 1
- become: true
- vars:
- packages:
- - httpd
- - php-fpm
- - git
- git_url: https://github.com/Chris-luiz-16/aws-elb-site.git
- git_dest: /var/website/
- docroot: /var/www/html/
- httpd_owner: apache
- tasks:
- - name: "Installing required packages"
- yum:
- name: "{{ packages }}"
- state: present
- - name: "Cloning the git rep to {{ git_dest }}"
- git:
- repo: "{{ git_url }}"
- dest: "{{ git_dest }}"
- register: git_status
- - name: "Draining the clb"
- when: git_status.changed == true
- service:
- name: httpd
- state: stopped
- - name: "Making sure the connection draining time interval is matched"
- when: git_status.changed == true
- wait_for:
- timeout: 30
- - name: "Copying the website to docroot"
- when: git_status.changed == true
- copy:
- src: "{{ git_dest }}"
- dest: "{{ docroot }}"
- remote_src: true
- owner: "{{ httpd_owner }}"
- group: "{{ httpd_owner }}"
- - name: "Attaching it to clb"
- when: git_status.changed == true
- service:
- name: httpd
- state: started
- - name: "Healthy status in-service"
- when: git_status.changed == true
- wait_for:
- timeout: 30
- #### Output with no version update ####
- [ec2-user@ip-172-31-6-232 ~]$ ansible-playbook aws.yml --vault-password-file=passwd.sh
- [WARNING]: No inventory was parsed, only implicit localhost is available
- [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match
- 'all'
- PLAY [Creating a dynamic inventory for Zomato-infra] *******************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [localhost]
- TASK [Ansible galaxy installl aws collection] **************************************************************************
- ok: [localhost]
- TASK [Install python3-pip module] **************************************************************************************
- ok: [localhost]
- TASK [Install pip3 modules for amazon.aws] *****************************************************************************
- ok: [localhost]
- TASK [Collect aws ec2-instance info of zomato-infra] *******************************************************************
- ok: [localhost]
- TASK [Creating a dynamic inventory] ************************************************************************************
- changed: [localhost] => (item={'ami_launch_index': 1, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-008fc4bdb8ba86fb3', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142', 'product_codes': [], 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.127.88.76', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0d60b31054268e467'}}], 'client_token': 'ef762444-9ac3-8fd3-f62d-c81f56de514d', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip': '13.127.88.76'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-066ae20667796d516', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '02:e2:19:35:2f:64', 'network_interface_id': 'eni-0002514e9fdfeb2ef', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip': '13.127.88.76'}, 'primary': True, 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'Name': 'Zomato-webserver', 'Env': 'Dev', 'Project': 'Zomato', 'aws:autoscaling:groupName': 'shopping-asg', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'aws:ec2launchtemplate:version': '1'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- changed: [localhost] => (item={'ami_launch_index': 0, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-0ac06441ba2439468', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50', 'product_codes': [], 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip_address': '35.154.112.147', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-022067d2a2c37d3b1'}}], 'client_token': 'ef762444-9ac3-8fd3-f62d-c81f56de514d', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip': '35.154.112.147'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-0e4b82096408ffd6e', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '02:90:41:bb:ba:8e', 'network_interface_id': 'eni-00a5fe13f3a812d26', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip': '35.154.112.147'}, 'primary': True, 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'aws:ec2launchtemplate:version': '1', 'Name': 'Zomato-webserver', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'aws:autoscaling:groupName': 'shopping-asg', 'Env': 'Dev', 'Project': 'Zomato'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- changed: [localhost] => (item={'ami_launch_index': 0, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-0b4761ec172352872', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1b', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19', 'product_codes': [], 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip_address': '65.0.87.36', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-0c662917265d9d0e9', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0dd243cd99ffbc8ba'}}], 'client_token': '46862444-9ac2-9a4e-f074-06936da27bb3', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip': '65.0.87.36'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-013c3173b26695722', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '0a:ea:d0:e7:b0:54', 'network_interface_id': 'eni-059263a4b61df6a21', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip': '65.0.87.36'}, 'primary': True, 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-0c662917265d9d0e9', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'Env': 'Dev', 'aws:ec2launchtemplate:version': '1', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'Project': 'Zomato', 'aws:autoscaling:groupName': 'shopping-asg', 'Name': 'Zomato-webserver'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.45.142]
- TASK [Installing required packages] ************************************************************************************
- ok: [172.31.45.142]
- TASK [Cloning the git rep to /var/website] *****************************************************************************
- ok: [172.31.45.142]
- TASK [Draining the clb] ************************************************************************************************
- skipping: [172.31.45.142]
- TASK [Making sure the connection draining time interval is matched] ****************************************************
- skipping: [172.31.45.142]
- TASK [Copying the website to docroot] **********************************************************************************
- skipping: [172.31.45.142]
- TASK [Attaching it to clb] *********************************************************************************************
- skipping: [172.31.45.142]
- TASK [Healthy status in-service] ***************************************************************************************
- skipping: [172.31.45.142]
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.40.50]
- TASK [Installing required packages] ************************************************************************************
- ok: [172.31.40.50]
- TASK [Cloning the git rep to /var/website] *****************************************************************************
- ok: [172.31.40.50]
- TASK [Draining the clb] ************************************************************************************************
- skipping: [172.31.40.50]
- TASK [Making sure the connection draining time interval is matched] ****************************************************
- skipping: [172.31.40.50]
- TASK [Copying the website to docroot] **********************************************************************************
- skipping: [172.31.40.50]
- TASK [Attaching it to clb] *********************************************************************************************
- skipping: [172.31.40.50]
- TASK [Healthy status in-service] ***************************************************************************************
- skipping: [172.31.40.50]
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.2.19]
- TASK [Installing required packages] ************************************************************************************
- ok: [172.31.2.19]
- TASK [Cloning the git rep to /var/website] *****************************************************************************
- ok: [172.31.2.19]
- TASK [Draining the clb] ************************************************************************************************
- skipping: [172.31.2.19]
- TASK [Making sure the connection draining time interval is matched] ****************************************************
- skipping: [172.31.2.19]
- TASK [Copying the website to docroot] **********************************************************************************
- skipping: [172.31.2.19]
- TASK [Attaching it to clb] *********************************************************************************************
- skipping: [172.31.2.19]
- TASK [Healthy status in-service] ***************************************************************************************
- skipping: [172.31.2.19]
- PLAY RECAP *************************************************************************************************************
- 172.31.2.19 : ok=3 changed=0 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
- 172.31.40.50 : ok=3 changed=0 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
- 172.31.45.142 : ok=3 changed=0 unreachable=0 failed=0 skipped=5 rescued=0 ignored=0
- localhost : ok=6 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- #### Output after git repo version update ####
- [ec2-user@ip-172-31-6-232 ~]$ ansible-playbook aws.yml --vault-password-file=passwd.sh
- PLAY [Creating a dynamic inventory for Zomato-infra] *******************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [localhost]
- TASK [Ansible galaxy installl aws collection] **************************************************************************
- ok: [localhost]
- TASK [Install python3-pip module] **************************************************************************************
- ok: [localhost]
- TASK [Install pip3 modules for amazon.aws] *****************************************************************************
- ok: [localhost]
- TASK [Collect aws ec2-instance info of zomato-infra] *******************************************************************
- ok: [localhost]
- TASK [Creating a dynamic inventory] ************************************************************************************
- changed: [localhost] => (item={'ami_launch_index': 1, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-008fc4bdb8ba86fb3', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142', 'product_codes': [], 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.127.88.76', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0d60b31054268e467'}}], 'client_token': 'ef762444-9ac3-8fd3-f62d-c81f56de514d', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip': '13.127.88.76'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-066ae20667796d516', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '02:e2:19:35:2f:64', 'network_interface_id': 'eni-0002514e9fdfeb2ef', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip': '13.127.88.76'}, 'primary': True, 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'Name': 'Zomato-webserver', 'Env': 'Dev', 'Project': 'Zomato', 'aws:autoscaling:groupName': 'shopping-asg', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'aws:ec2launchtemplate:version': '1'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- changed: [localhost] => (item={'ami_launch_index': 0, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-0ac06441ba2439468', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50', 'product_codes': [], 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip_address': '35.154.112.147', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-022067d2a2c37d3b1'}}], 'client_token': 'ef762444-9ac3-8fd3-f62d-c81f56de514d', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip': '35.154.112.147'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-0e4b82096408ffd6e', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '02:90:41:bb:ba:8e', 'network_interface_id': 'eni-00a5fe13f3a812d26', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip': '35.154.112.147'}, 'primary': True, 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'aws:ec2launchtemplate:version': '1', 'Name': 'Zomato-webserver', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'aws:autoscaling:groupName': 'shopping-asg', 'Env': 'Dev', 'Project': 'Zomato'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- changed: [localhost] => (item={'ami_launch_index': 0, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-0b4761ec172352872', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1b', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19', 'product_codes': [], 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip_address': '65.0.87.36', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-0c662917265d9d0e9', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0dd243cd99ffbc8ba'}}], 'client_token': '46862444-9ac2-9a4e-f074-06936da27bb3', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip': '65.0.87.36'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-013c3173b26695722', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '0a:ea:d0:e7:b0:54', 'network_interface_id': 'eni-059263a4b61df6a21', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip': '65.0.87.36'}, 'primary': True, 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-0c662917265d9d0e9', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'Env': 'Dev', 'aws:ec2launchtemplate:version': '1', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'Project': 'Zomato', 'aws:autoscaling:groupName': 'shopping-asg', 'Name': 'Zomato-webserver'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.45.142]
- TASK [Installing required packages] ************************************************************************************
- ok: [172.31.45.142]
- TASK [Cloning the git rep to /var/website/] ****************************************************************************
- changed: [172.31.45.142]
- TASK [Draining the clb] ************************************************************************************************
- changed: [172.31.45.142]
- TASK [Making sure the connection draining time interval is matched] ****************************************************
- ok: [172.31.45.142]
- TASK [Copying the website to docroot] **********************************************************************************
- changed: [172.31.45.142]
- TASK [Attaching it to clb] *********************************************************************************************
- changed: [172.31.45.142]
- TASK [Healthy status in-service] ***************************************************************************************
- ok: [172.31.45.142]
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.40.50]
- TASK [Installing required packages] ************************************************************************************
- ok: [172.31.40.50]
- TASK [Cloning the git rep to /var/website/] ****************************************************************************
- changed: [172.31.40.50]
- TASK [Draining the clb] ************************************************************************************************
- changed: [172.31.40.50]
- TASK [Making sure the connection draining time interval is matched] ****************************************************
- ok: [172.31.40.50]
- TASK [Copying the website to docroot] **********************************************************************************
- changed: [172.31.40.50]
- TASK [Attaching it to clb] *********************************************************************************************
- changed: [172.31.40.50]
- TASK [Healthy status in-service] ***************************************************************************************
- ok: [172.31.40.50]
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.2.19]
- TASK [Installing required packages] ************************************************************************************
- ok: [172.31.2.19]
- TASK [Cloning the git rep to /var/website/] ****************************************************************************
- changed: [172.31.2.19]
- TASK [Draining the clb] ************************************************************************************************
- changed: [172.31.2.19]
- TASK [Making sure the connection draining time interval is matched] ****************************************************
- ok: [172.31.2.19]
- TASK [Copying the website to docroot] **********************************************************************************
- changed: [172.31.2.19]
- TASK [Attaching it to clb] *********************************************************************************************
- changed: [172.31.2.19]
- TASK [Healthy status in-service] ***************************************************************************************
- ok: [172.31.2.19]
- PLAY RECAP *************************************************************************************************************
- 172.31.2.19 : ok=8 changed=4 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- 172.31.40.50 : ok=8 changed=4 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- 172.31.45.142 : ok=8 changed=4 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- localhost : ok=6 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- --------------------------------- Task 2 Installing package if not found ---------------
- #### Playbook ####
- - name: "Checking the package docker installed in remote_server"
- hosts: Zomato-infra
- become: true
- tasks:
- - name: "Checking through package_facts"
- package_facts:
- manager: auto
- tags:
- - zomato
- - name: "Checking docker installed on remote servers"
- debug:
- msg: "{{ ansible_facts.packages.httpd }} is installed or not!"
- ignore_errors: true
- register: httpd_status
- tags: zomato
- - name: "Printing the 2nd register"
- debug:
- var: httpd_status
- tags: zomato
- - name: "Install the package if not found in remote server"
- when: httpd_status.failed == true
- shell: yum install httpd -y
- tags: zomato
- #### Output #####
- [ec2-user@ip-172-31-6-232 ~]$ ansible-playbook aws.yml --vault-password-file=passwd.sh -t zomato
- [WARNING]: No inventory was parsed, only implicit localhost is available
- [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match
- 'all'
- PLAY [Creating a dynamic inventory for Zomato-infra] *******************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [localhost]
- TASK [Collect aws ec2-instance info of zomato-infra] *******************************************************************
- ok: [localhost]
- TASK [Creating a dynamic inventory] ************************************************************************************
- [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
- changed: [localhost] => (item={'ami_launch_index': 1, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-008fc4bdb8ba86fb3', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142', 'product_codes': [], 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.127.88.76', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0d60b31054268e467'}}], 'client_token': 'ef762444-9ac3-8fd3-f62d-c81f56de514d', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip': '13.127.88.76'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-066ae20667796d516', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '02:e2:19:35:2f:64', 'network_interface_id': 'eni-0002514e9fdfeb2ef', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip': '13.127.88.76'}, 'primary': True, 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'Name': 'Zomato-webserver', 'Env': 'Dev', 'Project': 'Zomato', 'aws:autoscaling:groupName': 'shopping-asg', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'aws:ec2launchtemplate:version': '1'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- changed: [localhost] => (item={'ami_launch_index': 0, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-0ac06441ba2439468', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50', 'product_codes': [], 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip_address': '35.154.112.147', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-022067d2a2c37d3b1'}}], 'client_token': 'ef762444-9ac3-8fd3-f62d-c81f56de514d', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip': '35.154.112.147'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-0e4b82096408ffd6e', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '02:90:41:bb:ba:8e', 'network_interface_id': 'eni-00a5fe13f3a812d26', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip': '35.154.112.147'}, 'primary': True, 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'aws:ec2launchtemplate:version': '1', 'Name': 'Zomato-webserver', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'aws:autoscaling:groupName': 'shopping-asg', 'Env': 'Dev', 'Project': 'Zomato'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- changed: [localhost] => (item={'ami_launch_index': 0, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-0b4761ec172352872', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1b', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19', 'product_codes': [], 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip_address': '65.0.87.36', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-0c662917265d9d0e9', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0dd243cd99ffbc8ba'}}], 'client_token': '46862444-9ac2-9a4e-f074-06936da27bb3', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip': '65.0.87.36'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-013c3173b26695722', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '0a:ea:d0:e7:b0:54', 'network_interface_id': 'eni-059263a4b61df6a21', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip': '65.0.87.36'}, 'primary': True, 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-0c662917265d9d0e9', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'Env': 'Dev', 'aws:ec2launchtemplate:version': '1', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'Project': 'Zomato', 'aws:autoscaling:groupName': 'shopping-asg', 'Name': 'Zomato-webserver'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.45.142]
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.40.50]
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.2.19]
- PLAY [Checking the package docker installed in remote_server] **********************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.40.50]
- ok: [172.31.2.19]
- ok: [172.31.45.142]
- TASK [Checking through package_facts] **********************************************************************************
- ok: [172.31.45.142]
- ok: [172.31.40.50]
- ok: [172.31.2.19]
- TASK [Checking docker installed on remote servers] *********************************************************************
- ok: [172.31.45.142] => {
- "msg": "[{'name': 'httpd', 'version': '2.4.56', 'release': '1.amzn2023', 'epoch': None, 'arch': 'x86_64', 'source': 'rpm'}] is installed or not!"
- }
- ok: [172.31.40.50] => {
- "msg": "[{'name': 'httpd', 'version': '2.4.56', 'release': '1.amzn2023', 'epoch': None, 'arch': 'x86_64', 'source': 'rpm'}] is installed or not!"
- }
- ok: [172.31.2.19] => {
- "msg": "[{'name': 'httpd', 'version': '2.4.56', 'release': '1.amzn2023', 'epoch': None, 'arch': 'x86_64', 'source': 'rpm'}] is installed or not!"
- }
- TASK [Printing the 2nd register] ***************************************************************************************
- ok: [172.31.45.142] => {
- "httpd_status": {
- "changed": false,
- "failed": false,
- "msg": "[{'name': 'httpd', 'version': '2.4.56', 'release': '1.amzn2023', 'epoch': None, 'arch': 'x86_64', 'source': 'rpm'}] is installed or not!"
- }
- }
- ok: [172.31.40.50] => {
- "httpd_status": {
- "changed": false,
- "failed": false,
- "msg": "[{'name': 'httpd', 'version': '2.4.56', 'release': '1.amzn2023', 'epoch': None, 'arch': 'x86_64', 'source': 'rpm'}] is installed or not!"
- }
- }
- ok: [172.31.2.19] => {
- "httpd_status": {
- "changed": false,
- "failed": false,
- "msg": "[{'name': 'httpd', 'version': '2.4.56', 'release': '1.amzn2023', 'epoch': None, 'arch': 'x86_64', 'source': 'rpm'}] is installed or not!"
- }
- }
- TASK [Install the package if not found in remote server] ***************************************************************
- skipping: [172.31.45.142]
- skipping: [172.31.40.50]
- skipping: [172.31.2.19]
- PLAY RECAP *************************************************************************************************************
- 172.31.2.19 : ok=5 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
- 172.31.40.50 : ok=5 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
- 172.31.45.142 : ok=5 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
- localhost : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- #### Installing package docker ####
- [ec2-user@ip-172-31-6-232 ~]$ ansible-playbook aws.yml --vault-password-file=passwd.sh -t zomato
- PLAY [Creating a dynamic inventory for Zomato-infra] *******************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [localhost]
- TASK [Collect aws ec2-instance info of zomato-infra] *******************************************************************
- ok: [localhost]
- TASK [Creating a dynamic inventory] ************************************************************************************
- [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
- changed: [localhost] => (item={'ami_launch_index': 1, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-008fc4bdb8ba86fb3', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142', 'product_codes': [], 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.127.88.76', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0d60b31054268e467'}}], 'client_token': 'ef762444-9ac3-8fd3-f62d-c81f56de514d', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip': '13.127.88.76'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-066ae20667796d516', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '02:e2:19:35:2f:64', 'network_interface_id': 'eni-0002514e9fdfeb2ef', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-127-88-76.ap-south-1.compute.amazonaws.com', 'public_ip': '13.127.88.76'}, 'primary': True, 'private_dns_name': 'ip-172-31-45-142.ap-south-1.compute.internal', 'private_ip_address': '172.31.45.142'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'Name': 'Zomato-webserver', 'Env': 'Dev', 'Project': 'Zomato', 'aws:autoscaling:groupName': 'shopping-asg', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'aws:ec2launchtemplate:version': '1'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- changed: [localhost] => (item={'ami_launch_index': 0, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-0ac06441ba2439468', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50', 'product_codes': [], 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip_address': '35.154.112.147', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-022067d2a2c37d3b1'}}], 'client_token': 'ef762444-9ac3-8fd3-f62d-c81f56de514d', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip': '35.154.112.147'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-0e4b82096408ffd6e', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '02:90:41:bb:ba:8e', 'network_interface_id': 'eni-00a5fe13f3a812d26', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-35-154-112-147.ap-south-1.compute.amazonaws.com', 'public_ip': '35.154.112.147'}, 'primary': True, 'private_dns_name': 'ip-172-31-40-50.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.50'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-03d5cac27f2ede1f4', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'aws:ec2launchtemplate:version': '1', 'Name': 'Zomato-webserver', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'aws:autoscaling:groupName': 'shopping-asg', 'Env': 'Dev', 'Project': 'Zomato'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- changed: [localhost] => (item={'ami_launch_index': 0, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-0b4761ec172352872', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-07-01T11:11:36+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1b', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19', 'product_codes': [], 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip_address': '65.0.87.36', 'state': {'code': 16, 'name': 'running'}, 'state_transition_reason': '', 'subnet_id': 'subnet-0c662917265d9d0e9', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'architecture': 'x86_64', 'block_device_mappings': [{'device_name': '/dev/xvda', 'ebs': {'attach_time': '2023-07-01T11:11:37+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0dd243cd99ffbc8ba'}}], 'client_token': '46862444-9ac2-9a4e-f074-06936da27bb3', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip': '65.0.87.36'}, 'attachment': {'attach_time': '2023-07-01T11:11:36+00:00', 'attachment_id': 'eni-attach-013c3173b26695722', 'delete_on_termination': True, 'device_index': 0, 'status': 'attached', 'network_card_index': 0}, 'description': '', 'groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'ipv6_addresses': [], 'mac_address': '0a:ea:d0:e7:b0:54', 'network_interface_id': 'eni-059263a4b61df6a21', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-65-0-87-36.ap-south-1.compute.amazonaws.com', 'public_ip': '65.0.87.36'}, 'primary': True, 'private_dns_name': 'ip-172-31-2-19.ap-south-1.compute.internal', 'private_ip_address': '172.31.2.19'}], 'source_dest_check': True, 'status': 'in-use', 'subnet_id': 'subnet-0c662917265d9d0e9', 'vpc_id': 'vpc-06e13c7cdf3e917f5', 'interface_type': 'interface'}], 'root_device_name': '/dev/xvda', 'root_device_type': 'ebs', 'security_groups': [{'group_name': 'Freedom', 'group_id': 'sg-09a5a43f8400c81c4'}], 'source_dest_check': True, 'tags': {'Env': 'Dev', 'aws:ec2launchtemplate:version': '1', 'aws:ec2launchtemplate:id': 'lt-0acf1324f7d389679', 'Project': 'Zomato', 'aws:autoscaling:groupName': 'shopping-asg', 'Name': 'Zomato-webserver'}, 'virtualization_type': 'hvm', 'cpu_options': {'core_count': 1, 'threads_per_core': 1}, 'capacity_reservation_specification': {'capacity_reservation_preference': 'open'}, 'hibernation_options': {'configured': False}, 'metadata_options': {'state': 'applied', 'http_tokens': 'required', 'http_put_response_hop_limit': 2, 'http_endpoint': 'enabled', 'http_protocol_ipv6': 'disabled', 'instance_metadata_tags': 'disabled'}, 'enclave_options': {'enabled': False}, 'boot_mode': 'uefi-preferred', 'platform_details': 'Linux/UNIX', 'usage_operation': 'RunInstances', 'usage_operation_update_time': '2023-07-01T11:11:36+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': False, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.45.142]
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.40.50]
- PLAY [Rolling update] **************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.2.19]
- PLAY [Checking the package docker installed in remote_server] **********************************************************
- TASK [Gathering Facts] *************************************************************************************************
- ok: [172.31.45.142]
- ok: [172.31.2.19]
- ok: [172.31.40.50]
- TASK [Checking through package_facts] **********************************************************************************
- ok: [172.31.45.142]
- ok: [172.31.40.50]
- ok: [172.31.2.19]
- TASK [Checking docker installed on remote servers] *********************************************************************
- fatal: [172.31.45.142]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'docker'. 'dict object' has no attribute 'docker'\n\nThe error appears to be in '/home/ec2-user/aws.yml': line 108, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n - zomato\n - name: \"Checking docker installed on remote servers\"\n ^ here\n"}
- ...ignoring
- fatal: [172.31.40.50]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'docker'. 'dict object' has no attribute 'docker'\n\nThe error appears to be in '/home/ec2-user/aws.yml': line 108, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n - zomato\n - name: \"Checking docker installed on remote servers\"\n ^ here\n"}
- ...ignoring
- fatal: [172.31.2.19]: FAILED! => {"msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'docker'. 'dict object' has no attribute 'docker'\n\nThe error appears to be in '/home/ec2-user/aws.yml': line 108, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n - zomato\n - name: \"Checking docker installed on remote servers\"\n ^ here\n"}
- ...ignoring
- TASK [Printing the 2nd register] ***************************************************************************************
- ok: [172.31.45.142] => {
- "httpd_status": {
- "failed": true,
- "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'docker'. 'dict object' has no attribute 'docker'\n\nThe error appears to be in '/home/ec2-user/aws.yml': line 108, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n - zomato\n - name: \"Checking docker installed on remote servers\"\n ^ here\n"
- }
- }
- ok: [172.31.40.50] => {
- "httpd_status": {
- "failed": true,
- "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'docker'. 'dict object' has no attribute 'docker'\n\nThe error appears to be in '/home/ec2-user/aws.yml': line 108, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n - zomato\n - name: \"Checking docker installed on remote servers\"\n ^ here\n"
- }
- }
- ok: [172.31.2.19] => {
- "httpd_status": {
- "failed": true,
- "msg": "The task includes an option with an undefined variable. The error was: 'dict object' has no attribute 'docker'. 'dict object' has no attribute 'docker'\n\nThe error appears to be in '/home/ec2-user/aws.yml': line 108, column 7, but may\nbe elsewhere in the file depending on the exact syntax problem.\n\nThe offending line appears to be:\n\n - zomato\n - name: \"Checking docker installed on remote servers\"\n ^ here\n"
- }
- }
- TASK [Install the package if not found in remote server] ***************************************************************
- changed: [172.31.40.50]
- changed: [172.31.45.142]
- changed: [172.31.2.19]
- PLAY RECAP *************************************************************************************************************
- 172.31.2.19 : ok=6 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1
- 172.31.40.50 : ok=6 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1
- 172.31.45.142 : ok=6 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=1
- localhost : ok=3 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- [ec2-user@ip-172-31-6-232 ~]$ ssh -i aws.pem 172.31.45.142
- , #_
- ~\_ ####_ Amazon Linux 2023
- ~~ \_#####\
- ~~ \###|
- ~~ \#/ ___ https://aws.amazon.com/linux/amazon-linux-2023
- ~~ V~' '->
- ~~~ /
- ~~._. _/
- _/ _/
- _/m/'
- Last login: Sat Jul 1 14:30:16 2023 from 172.31.6.232
- [ec2-user@ip-172-31-45-142 ~]$
- [ec2-user@ip-172-31-45-142 ~]$ docker version
- Client:
- Version: 20.10.23
- API version: 1.41
- Go version: go1.19.8
- Git commit: 7155243
- Built: Mon May 1 21:07:11 2023
- OS/Arch: linux/amd64
- Context: default
- Experimental: true
- Cannot connect to the Docker daemon at unix:///var/run/docker.sock. Is the docker daemon running?
Advertisement
Add Comment
Please, Sign In to add comment