Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ---------------------------------- Task ------------------------------------------------------
- #### Playbook ####
- - name: "Zomato-prod infra callup"
- hosts: localhost
- become: true
- vars:
- pip_modules:
- - boto3
- - botocore
- access_key: "AKIA5YKGNPEXBFYEA35D"
- secret_key: "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"
- region: "ap-south-1"
- tasks:
- - name: "Ansible galaxy install amazon.aws"
- community.general.ansible_galaxy_install:
- type: collection
- name: amazon.aws
- - name: "Installing pip3"
- yum:
- name: python3-pip
- state: present
- - name: "Installing pip3 modules"
- pip:
- name: "{{ pip_modules }}"
- - name: "Fetching the aws webserver details"
- amazon.aws.ec2_instance_info:
- access_key: "{{ access_key }}"
- secret_key: "{{ secret_key }}"
- region: "{{ region }}"
- filters:
- "tag:Name": "webserver"
- "tag:project": "zomato"
- "tag:env": "prod"
- register: zomato_prod
- - name: "Creating a dynamic inventory"
- add_host:
- hostname: "{{ item.private_ip_address }}"
- group: Zomato-servers
- 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"
- with_items:
- - "{{ zomato_prod.instances }}"
- - name: "Provisioning a php website"
- hosts: Zomato-servers
- become: true
- serial: 1
- vars:
- packages:
- - httpd
- - php-fpm
- - git
- httpd_port: 80
- httpd_site: blog.chrisich.fun
- httpd_owner: apache
- httpd_group: apache
- repo_url: https://github.com/Chris-luiz-16/aws-elb-site.git
- tasks:
- - name: "Installing required packages for the website"
- yum:
- name: "{{ packages }}"
- state: present
- notify:
- - httpd-restart
- - php-restart
- - name: "Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf"
- template:
- src: ./httpd.conf.tmpl
- dest: /etc/httpd/conf/httpd.conf
- notify:
- - httpd-restart
- - name: "Copying the virtaulhost of {{ httpd_site }} to /etc/httpd/conf.d/{{ httpd_site }}"
- template:
- src: ./virtual.conf.tmpl
- dest: "/etc/httpd/conf.d/{{ httpd_site }}.conf"
- notify:
- - httpd-restart
- - name: "Cloning the website to the remote server"
- git:
- repo: "{{ repo_url }}"
- dest: /var/website/
- register: git_status
- - name: "Copying the website to the documentroot /var/www/html/{{ httpd_site }}/"
- when: git_status.changed == true
- copy:
- src: /var/website/
- dest: "/var/www/html/{{ httpd_site }}/"
- owner: "{{ httpd_owner }}"
- group: "{{ httpd_group }}"
- remote_src: true
- notify:
- - php-restart
- handlers:
- - name: "httpd-restart"
- service:
- name: httpd
- state: restarted
- enabled: true
- - name: "php-restart"
- service:
- name: php-fpm
- state: restarted
- enabled: true
- ### Output with 3 instances ####
- [ec2-user@ip-172-31-33-5 ~]$ ansible-playbook main.yml
- PLAY [Zomato-prod infra callup] ****************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [localhost]
- TASK [Ansible galaxy install amazon.aws] *******************************************************************************************************************
- ok: [localhost]
- TASK [Installing pip3] *************************************************************************************************************************************
- ok: [localhost]
- TASK [Installing pip3 modules] *****************************************************************************************************************************
- ok: [localhost]
- TASK [Fetching the aws webserver details] ******************************************************************************************************************
- 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-048d0b903a13a240d', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-06-29T10:13:20+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-34-72.ap-south-1.compute.internal', 'private_ip_address': '172.31.34.72', 'product_codes': [], 'public_dns_name': 'ec2-3-109-182-86.ap-south-1.compute.amazonaws.com', 'public_ip_address': '3.109.182.86', '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-06-29T10:13:21+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0cba453f93b01eda4'}}], 'client_token': 'af663f83-61b0-45c2-8d24-ada7cddc7217', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-3-109-182-86.ap-south-1.compute.amazonaws.com', 'public_ip': '3.109.182.86'}, 'attachment': {'attach_time': '2023-06-29T10:13:20+00:00', 'attachment_id': 'eni-attach-071adac5840b1611f', '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:8e:e9:10:15:b6', 'network_interface_id': 'eni-04f0b702cadf6d793', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-34-72.ap-south-1.compute.internal', 'private_ip_address': '172.31.34.72', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-3-109-182-86.ap-south-1.compute.amazonaws.com', 'public_ip': '3.109.182.86'}, 'primary': True, 'private_dns_name': 'ip-172-31-34-72.ap-south-1.compute.internal', 'private_ip_address': '172.31.34.72'}], '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': {'project': 'zomato', 'env': 'prod', 'Name': '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-06-29T10:13:20+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': True, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- changed: [localhost] => (item={'ami_launch_index': 2, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-04aa63e4635f6fdd4', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-06-29T10:13:20+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-33-47.ap-south-1.compute.internal', 'private_ip_address': '172.31.33.47', 'product_codes': [], 'public_dns_name': 'ec2-13-235-133-7.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.235.133.7', '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-06-29T10:13:21+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-01bf0d48d69c0aff7'}}], 'client_token': 'af663f83-61b0-45c2-8d24-ada7cddc7217', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-235-133-7.ap-south-1.compute.amazonaws.com', 'public_ip': '13.235.133.7'}, 'attachment': {'attach_time': '2023-06-29T10:13:20+00:00', 'attachment_id': 'eni-attach-09099bb600caf83b1', '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:44:ab:b0:f4:d2', 'network_interface_id': 'eni-0590c9ce2d85da5dd', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-33-47.ap-south-1.compute.internal', 'private_ip_address': '172.31.33.47', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-235-133-7.ap-south-1.compute.amazonaws.com', 'public_ip': '13.235.133.7'}, 'primary': True, 'private_dns_name': 'ip-172-31-33-47.ap-south-1.compute.internal', 'private_ip_address': '172.31.33.47'}], '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': 'webserver', 'project': 'zomato', 'env': 'prod'}, '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-06-29T10:13:20+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': True, '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-0f25a32f4452ff0d7', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-06-29T10:13:20+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-36-119.ap-south-1.compute.internal', 'private_ip_address': '172.31.36.119', 'product_codes': [], 'public_dns_name': 'ec2-13-233-65-35.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.233.65.35', '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-06-29T10:13:21+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0eb6cce4eb8f613f0'}}], 'client_token': 'af663f83-61b0-45c2-8d24-ada7cddc7217', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-233-65-35.ap-south-1.compute.amazonaws.com', 'public_ip': '13.233.65.35'}, 'attachment': {'attach_time': '2023-06-29T10:13:20+00:00', 'attachment_id': 'eni-attach-000f9bd49129136c5', '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:88:94:03:fc:12', 'network_interface_id': 'eni-028753b2c9dae66f2', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-36-119.ap-south-1.compute.internal', 'private_ip_address': '172.31.36.119', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-233-65-35.ap-south-1.compute.amazonaws.com', 'public_ip': '13.233.65.35'}, 'primary': True, 'private_dns_name': 'ip-172-31-36-119.ap-south-1.compute.internal', 'private_ip_address': '172.31.36.119'}], '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': {'project': 'zomato', 'env': 'prod', 'Name': '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-06-29T10:13:20+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': True, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- PLAY [Provisioning a php website] **************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [172.31.34.72]
- TASK [Installing required packages for the website] ********************************************************************************************************
- ok: [172.31.34.72]
- TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
- ok: [172.31.34.72]
- TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
- ok: [172.31.34.72]
- TASK [Cloning the website to the remote server] ************************************************************************************************************
- ok: [172.31.34.72]
- TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
- skipping: [172.31.34.72]
- PLAY [Provisioning a php website] **************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [172.31.33.47]
- TASK [Installing required packages for the website] ********************************************************************************************************
- ok: [172.31.33.47]
- TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
- ok: [172.31.33.47]
- TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
- ok: [172.31.33.47]
- TASK [Cloning the website to the remote server] ************************************************************************************************************
- ok: [172.31.33.47]
- TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
- skipping: [172.31.33.47]
- PLAY [Provisioning a php website] **************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [172.31.36.119]
- TASK [Installing required packages for the website] ********************************************************************************************************
- ok: [172.31.36.119]
- TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
- ok: [172.31.36.119]
- TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
- ok: [172.31.36.119]
- TASK [Cloning the website to the remote server] ************************************************************************************************************
- ok: [172.31.36.119]
- TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
- skipping: [172.31.36.119]
- PLAY RECAP *************************************************************************************************************************************************
- 172.31.33.47 : ok=5 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
- 172.31.34.72 : ok=5 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
- 172.31.36.119 : ok=5 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
- localhost : ok=6 changed=1 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- #### Output after adding one more webserver ####
- [ec2-user@ip-172-31-33-5 ~]$ ansible-playbook main.yml
- PLAY [Zomato-prod infra callup] ****************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [localhost]
- TASK [Ansible galaxy install amazon.aws] *******************************************************************************************************************
- ok: [localhost]
- TASK [Installing pip3] *************************************************************************************************************************************
- ok: [localhost]
- TASK [Installing pip3 modules] *****************************************************************************************************************************
- ok: [localhost]
- TASK [Fetching the aws webserver details] ******************************************************************************************************************
- 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-048d0b903a13a240d', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-06-29T10:13:20+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-34-72.ap-south-1.compute.internal', 'private_ip_address': '172.31.34.72', 'product_codes': [], 'public_dns_name': 'ec2-3-109-182-86.ap-south-1.compute.amazonaws.com', 'public_ip_address': '3.109.182.86', '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-06-29T10:13:21+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0cba453f93b01eda4'}}], 'client_token': 'af663f83-61b0-45c2-8d24-ada7cddc7217', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-3-109-182-86.ap-south-1.compute.amazonaws.com', 'public_ip': '3.109.182.86'}, 'attachment': {'attach_time': '2023-06-29T10:13:20+00:00', 'attachment_id': 'eni-attach-071adac5840b1611f', '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:8e:e9:10:15:b6', 'network_interface_id': 'eni-04f0b702cadf6d793', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-34-72.ap-south-1.compute.internal', 'private_ip_address': '172.31.34.72', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-3-109-182-86.ap-south-1.compute.amazonaws.com', 'public_ip': '3.109.182.86'}, 'primary': True, 'private_dns_name': 'ip-172-31-34-72.ap-south-1.compute.internal', 'private_ip_address': '172.31.34.72'}], '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': {'project': 'zomato', 'env': 'prod', 'Name': '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-06-29T10:13:20+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': True, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- changed: [localhost] => (item={'ami_launch_index': 2, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-04aa63e4635f6fdd4', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-06-29T10:13:20+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-33-47.ap-south-1.compute.internal', 'private_ip_address': '172.31.33.47', 'product_codes': [], 'public_dns_name': 'ec2-13-235-133-7.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.235.133.7', '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-06-29T10:13:21+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-01bf0d48d69c0aff7'}}], 'client_token': 'af663f83-61b0-45c2-8d24-ada7cddc7217', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-235-133-7.ap-south-1.compute.amazonaws.com', 'public_ip': '13.235.133.7'}, 'attachment': {'attach_time': '2023-06-29T10:13:20+00:00', 'attachment_id': 'eni-attach-09099bb600caf83b1', '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:44:ab:b0:f4:d2', 'network_interface_id': 'eni-0590c9ce2d85da5dd', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-33-47.ap-south-1.compute.internal', 'private_ip_address': '172.31.33.47', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-235-133-7.ap-south-1.compute.amazonaws.com', 'public_ip': '13.235.133.7'}, 'primary': True, 'private_dns_name': 'ip-172-31-33-47.ap-south-1.compute.internal', 'private_ip_address': '172.31.33.47'}], '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': 'webserver', 'project': 'zomato', 'env': 'prod'}, '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-06-29T10:13:20+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': True, '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-0f25a32f4452ff0d7', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-06-29T10:13:20+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-36-119.ap-south-1.compute.internal', 'private_ip_address': '172.31.36.119', 'product_codes': [], 'public_dns_name': 'ec2-13-233-65-35.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.233.65.35', '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-06-29T10:13:21+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0eb6cce4eb8f613f0'}}], 'client_token': 'af663f83-61b0-45c2-8d24-ada7cddc7217', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-233-65-35.ap-south-1.compute.amazonaws.com', 'public_ip': '13.233.65.35'}, 'attachment': {'attach_time': '2023-06-29T10:13:20+00:00', 'attachment_id': 'eni-attach-000f9bd49129136c5', '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:88:94:03:fc:12', 'network_interface_id': 'eni-028753b2c9dae66f2', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-36-119.ap-south-1.compute.internal', 'private_ip_address': '172.31.36.119', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-233-65-35.ap-south-1.compute.amazonaws.com', 'public_ip': '13.233.65.35'}, 'primary': True, 'private_dns_name': 'ip-172-31-36-119.ap-south-1.compute.internal', 'private_ip_address': '172.31.36.119'}], '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': {'project': 'zomato', 'env': 'prod', 'Name': '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-06-29T10:13:20+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': True, '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-02d3b7e3cc30254bc', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-06-29T13:24:52+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-40-128.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.128', 'product_codes': [], 'public_dns_name': 'ec2-13-232-145-127.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.232.145.127', '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-06-29T13:24:52+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-05187d52276c907d2'}}], 'client_token': '2f5a82a0-9e33-4456-b5cf-88323b03b860', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-232-145-127.ap-south-1.compute.amazonaws.com', 'public_ip': '13.232.145.127'}, 'attachment': {'attach_time': '2023-06-29T13:24:52+00:00', 'attachment_id': 'eni-attach-0d2613849d331dcbd', '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:0f:ea:8c:d1:80', 'network_interface_id': 'eni-0bd1bc96416023624', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-40-128.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.128', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-232-145-127.ap-south-1.compute.amazonaws.com', 'public_ip': '13.232.145.127'}, 'primary': True, 'private_dns_name': 'ip-172-31-40-128.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.128'}], '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': 'webserver', 'project': 'zomato', 'env': 'prod'}, '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-06-29T13:24:52+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': True, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- PLAY [Provisioning a php website] **************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [172.31.34.72]
- TASK [Installing required packages for the website] ********************************************************************************************************
- ok: [172.31.34.72]
- TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
- ok: [172.31.34.72]
- TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
- ok: [172.31.34.72]
- TASK [Cloning the website to the remote server] ************************************************************************************************************
- ok: [172.31.34.72]
- TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
- skipping: [172.31.34.72]
- PLAY [Provisioning a php website] **************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [172.31.33.47]
- TASK [Installing required packages for the website] ********************************************************************************************************
- ok: [172.31.33.47]
- TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
- ok: [172.31.33.47]
- TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
- ok: [172.31.33.47]
- TASK [Cloning the website to the remote server] ************************************************************************************************************
- ok: [172.31.33.47]
- TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
- skipping: [172.31.33.47]
- PLAY [Provisioning a php website] **************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [172.31.36.119]
- TASK [Installing required packages for the website] ********************************************************************************************************
- ok: [172.31.36.119]
- TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
- ok: [172.31.36.119]
- TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
- ok: [172.31.36.119]
- TASK [Cloning the website to the remote server] ************************************************************************************************************
- ok: [172.31.36.119]
- TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
- skipping: [172.31.36.119]
- PLAY [Provisioning a php website] **************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [172.31.40.128]
- TASK [Installing required packages for the website] ********************************************************************************************************
- changed: [172.31.40.128]
- TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
- changed: [172.31.40.128]
- TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
- changed: [172.31.40.128]
- TASK [Cloning the website to the remote server] ************************************************************************************************************
- changed: [172.31.40.128]
- TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
- changed: [172.31.40.128]
- RUNNING HANDLER [httpd-restart] ****************************************************************************************************************************
- changed: [172.31.40.128]
- RUNNING HANDLER [php-restart] ******************************************************************************************************************************
- changed: [172.31.40.128]
- PLAY RECAP *************************************************************************************************************************************************
- 172.31.33.47 : ok=5 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
- 172.31.34.72 : ok=5 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
- 172.31.36.119 : ok=5 changed=0 unreachable=0 failed=0 skipped=1 rescued=0 ignored=0
- 172.31.40.128 : ok=8 changed=7 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
- #### Changing the version of php website ####
- [ec2-user@ip-172-31-33-5 ~]$ ansible-playbook main.yml
- PLAY [Zomato-prod infra callup] ****************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [localhost]
- TASK [Ansible galaxy install amazon.aws] *******************************************************************************************************************
- ok: [localhost]
- TASK [Installing pip3] *************************************************************************************************************************************
- ok: [localhost]
- TASK [Installing pip3 modules] *****************************************************************************************************************************
- ok: [localhost]
- TASK [Fetching the aws webserver details] ******************************************************************************************************************
- 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-048d0b903a13a240d', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-06-29T10:13:20+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-34-72.ap-south-1.compute.internal', 'private_ip_address': '172.31.34.72', 'product_codes': [], 'public_dns_name': 'ec2-3-109-182-86.ap-south-1.compute.amazonaws.com', 'public_ip_address': '3.109.182.86', '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-06-29T10:13:21+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0cba453f93b01eda4'}}], 'client_token': 'af663f83-61b0-45c2-8d24-ada7cddc7217', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-3-109-182-86.ap-south-1.compute.amazonaws.com', 'public_ip': '3.109.182.86'}, 'attachment': {'attach_time': '2023-06-29T10:13:20+00:00', 'attachment_id': 'eni-attach-071adac5840b1611f', '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:8e:e9:10:15:b6', 'network_interface_id': 'eni-04f0b702cadf6d793', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-34-72.ap-south-1.compute.internal', 'private_ip_address': '172.31.34.72', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-3-109-182-86.ap-south-1.compute.amazonaws.com', 'public_ip': '3.109.182.86'}, 'primary': True, 'private_dns_name': 'ip-172-31-34-72.ap-south-1.compute.internal', 'private_ip_address': '172.31.34.72'}], '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': {'project': 'zomato', 'env': 'prod', 'Name': '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-06-29T10:13:20+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': True, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- changed: [localhost] => (item={'ami_launch_index': 2, 'image_id': 'ami-0b9ecf71fe947bbdd', 'instance_id': 'i-04aa63e4635f6fdd4', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-06-29T10:13:20+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-33-47.ap-south-1.compute.internal', 'private_ip_address': '172.31.33.47', 'product_codes': [], 'public_dns_name': 'ec2-13-235-133-7.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.235.133.7', '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-06-29T10:13:21+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-01bf0d48d69c0aff7'}}], 'client_token': 'af663f83-61b0-45c2-8d24-ada7cddc7217', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-235-133-7.ap-south-1.compute.amazonaws.com', 'public_ip': '13.235.133.7'}, 'attachment': {'attach_time': '2023-06-29T10:13:20+00:00', 'attachment_id': 'eni-attach-09099bb600caf83b1', '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:44:ab:b0:f4:d2', 'network_interface_id': 'eni-0590c9ce2d85da5dd', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-33-47.ap-south-1.compute.internal', 'private_ip_address': '172.31.33.47', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-235-133-7.ap-south-1.compute.amazonaws.com', 'public_ip': '13.235.133.7'}, 'primary': True, 'private_dns_name': 'ip-172-31-33-47.ap-south-1.compute.internal', 'private_ip_address': '172.31.33.47'}], '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': 'webserver', 'project': 'zomato', 'env': 'prod'}, '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-06-29T10:13:20+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': True, '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-0f25a32f4452ff0d7', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-06-29T10:13:20+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-36-119.ap-south-1.compute.internal', 'private_ip_address': '172.31.36.119', 'product_codes': [], 'public_dns_name': 'ec2-13-233-65-35.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.233.65.35', '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-06-29T10:13:21+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-0eb6cce4eb8f613f0'}}], 'client_token': 'af663f83-61b0-45c2-8d24-ada7cddc7217', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-233-65-35.ap-south-1.compute.amazonaws.com', 'public_ip': '13.233.65.35'}, 'attachment': {'attach_time': '2023-06-29T10:13:20+00:00', 'attachment_id': 'eni-attach-000f9bd49129136c5', '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:88:94:03:fc:12', 'network_interface_id': 'eni-028753b2c9dae66f2', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-36-119.ap-south-1.compute.internal', 'private_ip_address': '172.31.36.119', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-233-65-35.ap-south-1.compute.amazonaws.com', 'public_ip': '13.233.65.35'}, 'primary': True, 'private_dns_name': 'ip-172-31-36-119.ap-south-1.compute.internal', 'private_ip_address': '172.31.36.119'}], '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': {'project': 'zomato', 'env': 'prod', 'Name': '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-06-29T10:13:20+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': True, '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-02d3b7e3cc30254bc', 'instance_type': 't2.micro', 'key_name': 'mumbai-new', 'launch_time': '2023-06-29T13:24:52+00:00', 'monitoring': {'state': 'disabled'}, 'placement': {'availability_zone': 'ap-south-1a', 'group_name': '', 'tenancy': 'default'}, 'private_dns_name': 'ip-172-31-40-128.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.128', 'product_codes': [], 'public_dns_name': 'ec2-13-232-145-127.ap-south-1.compute.amazonaws.com', 'public_ip_address': '13.232.145.127', '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-06-29T13:24:52+00:00', 'delete_on_termination': True, 'status': 'attached', 'volume_id': 'vol-05187d52276c907d2'}}], 'client_token': '2f5a82a0-9e33-4456-b5cf-88323b03b860', 'ebs_optimized': False, 'ena_support': True, 'hypervisor': 'xen', 'network_interfaces': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-232-145-127.ap-south-1.compute.amazonaws.com', 'public_ip': '13.232.145.127'}, 'attachment': {'attach_time': '2023-06-29T13:24:52+00:00', 'attachment_id': 'eni-attach-0d2613849d331dcbd', '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:0f:ea:8c:d1:80', 'network_interface_id': 'eni-0bd1bc96416023624', 'owner_id': '945577359662', 'private_dns_name': 'ip-172-31-40-128.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.128', 'private_ip_addresses': [{'association': {'ip_owner_id': 'amazon', 'public_dns_name': 'ec2-13-232-145-127.ap-south-1.compute.amazonaws.com', 'public_ip': '13.232.145.127'}, 'primary': True, 'private_dns_name': 'ip-172-31-40-128.ap-south-1.compute.internal', 'private_ip_address': '172.31.40.128'}], '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': 'webserver', 'project': 'zomato', 'env': 'prod'}, '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-06-29T13:24:52+00:00', 'private_dns_name_options': {'hostname_type': 'ip-name', 'enable_resource_name_dns_a_record': True, 'enable_resource_name_dns_aaaa_record': False}, 'maintenance_options': {'auto_recovery': 'default'}, 'current_instance_boot_mode': 'legacy-bios'})
- PLAY [Provisioning a php website] **************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [172.31.34.72]
- TASK [Installing required packages for the website] ********************************************************************************************************
- ok: [172.31.34.72]
- TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
- ok: [172.31.34.72]
- TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
- ok: [172.31.34.72]
- TASK [Cloning the website to the remote server] ************************************************************************************************************
- changed: [172.31.34.72]
- TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
- changed: [172.31.34.72]
- RUNNING HANDLER [php-restart] ******************************************************************************************************************************
- changed: [172.31.34.72]
- PLAY [Provisioning a php website] **************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [172.31.33.47]
- TASK [Installing required packages for the website] ********************************************************************************************************
- ok: [172.31.33.47]
- TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
- ok: [172.31.33.47]
- TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
- ok: [172.31.33.47]
- TASK [Cloning the website to the remote server] ************************************************************************************************************
- changed: [172.31.33.47]
- TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
- changed: [172.31.33.47]
- RUNNING HANDLER [php-restart] ******************************************************************************************************************************
- changed: [172.31.33.47]
- PLAY [Provisioning a php website] **************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- .
- ok: [172.31.36.119]
- TASK [Installing required packages for the website] ********************************************************************************************************
- ok: [172.31.36.119]
- TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
- ok: [172.31.36.119]
- TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
- ok: [172.31.36.119]
- TASK [Cloning the website to the remote server] ************************************************************************************************************
- changed: [172.31.36.119]
- TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
- changed: [172.31.36.119]
- RUNNING HANDLER [php-restart] ******************************************************************************************************************************
- changed: [172.31.36.119]
- PLAY [Provisioning a php website] **************************************************************************************************************************
- TASK [Gathering Facts] *************************************************************************************************************************************
- ok: [172.31.40.128]
- TASK [Installing required packages for the website] ********************************************************************************************************
- ok: [172.31.40.128]
- TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
- ok: [172.31.40.128]
- TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
- ok: [172.31.40.128]
- TASK [Cloning the website to the remote server] ************************************************************************************************************
- changed: [172.31.40.128]
- TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
- changed: [172.31.40.128]
- RUNNING HANDLER [php-restart] ******************************************************************************************************************************
- changed: [172.31.40.128]
- PLAY RECAP *************************************************************************************************************************************************
- 172.31.33.47 : ok=7 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- 172.31.34.72 : ok=7 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- 172.31.36.119 : ok=7 changed=3 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
- 172.31.40.128 : ok=7 changed=3 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
Advertisement
Add Comment
Please, Sign In to add comment