chrisluiz16

Day 9

Jun 29th, 2023
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 59.92 KB | None | 0 0
  1. ---------------------------------- Task ------------------------------------------------------
  2.  
  3.  
  4.  
  5. #### Playbook ####
  6.  
  7. - name: "Zomato-prod infra callup"
  8.   hosts: localhost
  9.   become: true
  10.   vars:
  11.     pip_modules:
  12.      - boto3
  13.       - botocore
  14.     access_key: "AKIA5YKGNPEXBFYEA35D"
  15.     secret_key: "te57ElYnG6hrfcYSq8jSmLoTB7j9q45Pz0TKIo1G"
  16.     region: "ap-south-1"
  17.   tasks:
  18.     - name: "Ansible galaxy install amazon.aws"
  19.       community.general.ansible_galaxy_install:
  20.         type: collection
  21.         name: amazon.aws
  22.     - name: "Installing pip3"
  23.       yum:
  24.         name: python3-pip
  25.         state: present
  26.     - name: "Installing pip3 modules"
  27.       pip:
  28.         name: "{{ pip_modules }}"
  29.     - name: "Fetching the aws webserver details"
  30.       amazon.aws.ec2_instance_info:
  31.         access_key: "{{ access_key }}"
  32.         secret_key: "{{ secret_key }}"
  33.         region: "{{ region }}"
  34.         filters:
  35.           "tag:Name": "webserver"
  36.           "tag:project": "zomato"
  37.           "tag:env": "prod"
  38.       register: zomato_prod
  39.     - name: "Creating a dynamic inventory"
  40.       add_host:
  41.         hostname: "{{ item.private_ip_address }}"
  42.         group: Zomato-servers
  43.         ansible_ssh_host: "{{ item.private_ip_address }}"
  44.         ansible_ssh_user: ec2-user
  45.         ansible_ssh_private_key_file: ./aws.pem
  46.         ansible_ssh_common_args: "-o StrictHostKeyChecking=no"
  47.       with_items:
  48.        - "{{ zomato_prod.instances }}"
  49. - name: "Provisioning a php website"
  50.   hosts: Zomato-servers
  51.   become: true
  52.   serial: 1
  53.   vars:
  54.     packages:
  55.      - httpd
  56.       - php-fpm
  57.       - git
  58.     httpd_port: 80
  59.     httpd_site: blog.chrisich.fun
  60.     httpd_owner: apache
  61.     httpd_group: apache
  62.     repo_url: https://github.com/Chris-luiz-16/aws-elb-site.git
  63.   tasks:
  64.     - name: "Installing required packages for the website"
  65.       yum:
  66.         name: "{{ packages }}"
  67.         state: present
  68.       notify:
  69.        - httpd-restart
  70.         - php-restart
  71.     - name: "Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf"
  72.       template:
  73.         src: ./httpd.conf.tmpl
  74.         dest: /etc/httpd/conf/httpd.conf
  75.       notify:
  76.        - httpd-restart
  77.     - name: "Copying the virtaulhost of {{ httpd_site }} to /etc/httpd/conf.d/{{ httpd_site }}"
  78.       template:
  79.         src: ./virtual.conf.tmpl
  80.         dest: "/etc/httpd/conf.d/{{ httpd_site }}.conf"
  81.       notify:
  82.        - httpd-restart
  83.     - name: "Cloning the website to the remote server"
  84.       git:
  85.         repo: "{{ repo_url }}"
  86.         dest: /var/website/
  87.       register: git_status
  88.     - name: "Copying the website to the documentroot /var/www/html/{{ httpd_site }}/"
  89.       when: git_status.changed == true
  90.       copy:
  91.         src: /var/website/
  92.         dest: "/var/www/html/{{ httpd_site }}/"
  93.         owner: "{{ httpd_owner }}"
  94.         group: "{{ httpd_group }}"
  95.         remote_src: true
  96.       notify:
  97.        - php-restart
  98.   handlers:
  99.     - name: "httpd-restart"
  100.       service:
  101.         name: httpd
  102.         state: restarted
  103.         enabled: true
  104.     - name: "php-restart"
  105.       service:
  106.         name: php-fpm
  107.         state: restarted
  108.         enabled: true
  109.  
  110.  
  111.  
  112. ### Output with 3 instances ####
  113.  
  114.  
  115. [ec2-user@ip-172-31-33-5 ~]$ ansible-playbook main.yml
  116.  
  117.  
  118. PLAY [Zomato-prod infra callup] ****************************************************************************************************************************
  119.  
  120. TASK [Gathering Facts] *************************************************************************************************************************************
  121. ok: [localhost]
  122.  
  123. TASK [Ansible galaxy install amazon.aws] *******************************************************************************************************************
  124. ok: [localhost]
  125.  
  126. TASK [Installing pip3] *************************************************************************************************************************************
  127. ok: [localhost]
  128.  
  129. TASK [Installing pip3 modules] *****************************************************************************************************************************
  130. ok: [localhost]
  131.  
  132. TASK [Fetching the aws webserver details] ******************************************************************************************************************
  133. ok: [localhost]
  134.  
  135. TASK [Creating a dynamic inventory] ************************************************************************************************************************
  136. [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
  137. 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'})
  138. 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'})
  139. 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'})
  140.  
  141. PLAY [Provisioning a php website] **************************************************************************************************************************
  142.  
  143. TASK [Gathering Facts] *************************************************************************************************************************************
  144.  
  145. ok: [172.31.34.72]
  146.  
  147. TASK [Installing required packages for the website] ********************************************************************************************************
  148. ok: [172.31.34.72]
  149.  
  150. TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
  151. ok: [172.31.34.72]
  152.  
  153. TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
  154. ok: [172.31.34.72]
  155.  
  156. TASK [Cloning the website to the remote server] ************************************************************************************************************
  157. ok: [172.31.34.72]
  158.  
  159. TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
  160. skipping: [172.31.34.72]
  161.  
  162. PLAY [Provisioning a php website] **************************************************************************************************************************
  163.  
  164. TASK [Gathering Facts] *************************************************************************************************************************************
  165.  
  166. ok: [172.31.33.47]
  167.  
  168. TASK [Installing required packages for the website] ********************************************************************************************************
  169. ok: [172.31.33.47]
  170.  
  171. TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
  172. ok: [172.31.33.47]
  173.  
  174. TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
  175. ok: [172.31.33.47]
  176.  
  177. TASK [Cloning the website to the remote server] ************************************************************************************************************
  178. ok: [172.31.33.47]
  179.  
  180. TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
  181. skipping: [172.31.33.47]
  182.  
  183. PLAY [Provisioning a php website] **************************************************************************************************************************
  184.  
  185. TASK [Gathering Facts] *************************************************************************************************************************************
  186.  
  187. ok: [172.31.36.119]
  188.  
  189. TASK [Installing required packages for the website] ********************************************************************************************************
  190. ok: [172.31.36.119]
  191.  
  192. TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
  193. ok: [172.31.36.119]
  194.  
  195. TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
  196. ok: [172.31.36.119]
  197.  
  198. TASK [Cloning the website to the remote server] ************************************************************************************************************
  199. ok: [172.31.36.119]
  200.  
  201. TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
  202. skipping: [172.31.36.119]
  203.  
  204. PLAY RECAP *************************************************************************************************************************************************
  205. 172.31.33.47               : ok=5    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0
  206. 172.31.34.72               : ok=5    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0
  207. 172.31.36.119              : ok=5    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0
  208. localhost                  : ok=6    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
  209.  
  210.  
  211.  
  212. #### Output after adding one more webserver ####
  213.  
  214. [ec2-user@ip-172-31-33-5 ~]$ ansible-playbook main.yml
  215.  
  216.  
  217. PLAY [Zomato-prod infra callup] ****************************************************************************************************************************
  218. TASK [Gathering Facts] *************************************************************************************************************************************
  219. ok: [localhost]
  220.  
  221. TASK [Ansible galaxy install amazon.aws] *******************************************************************************************************************
  222. ok: [localhost]
  223.  
  224. TASK [Installing pip3] *************************************************************************************************************************************
  225. ok: [localhost]
  226.  
  227. TASK [Installing pip3 modules] *****************************************************************************************************************************
  228. ok: [localhost]
  229.  
  230. TASK [Fetching the aws webserver details] ******************************************************************************************************************
  231. ok: [localhost]
  232.  
  233. TASK [Creating a dynamic inventory] ************************************************************************************************************************
  234. [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
  235. 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'})
  236. 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'})
  237. 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'})
  238. 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'})
  239.  
  240. PLAY [Provisioning a php website] **************************************************************************************************************************
  241.  
  242. TASK [Gathering Facts] *************************************************************************************************************************************
  243.  
  244. ok: [172.31.34.72]
  245.  
  246. TASK [Installing required packages for the website] ********************************************************************************************************
  247. ok: [172.31.34.72]
  248.  
  249. TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
  250. ok: [172.31.34.72]
  251.  
  252. TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
  253. ok: [172.31.34.72]
  254.  
  255. TASK [Cloning the website to the remote server] ************************************************************************************************************
  256. ok: [172.31.34.72]
  257.  
  258. TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
  259. skipping: [172.31.34.72]
  260.  
  261. PLAY [Provisioning a php website] **************************************************************************************************************************
  262.  
  263. TASK [Gathering Facts] *************************************************************************************************************************************
  264.  
  265. ok: [172.31.33.47]
  266.  
  267. TASK [Installing required packages for the website] ********************************************************************************************************
  268. ok: [172.31.33.47]
  269.  
  270. TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
  271. ok: [172.31.33.47]
  272.  
  273. TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
  274. ok: [172.31.33.47]
  275.  
  276. TASK [Cloning the website to the remote server] ************************************************************************************************************
  277. ok: [172.31.33.47]
  278.  
  279. TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
  280. skipping: [172.31.33.47]
  281.  
  282. PLAY [Provisioning a php website] **************************************************************************************************************************
  283.  
  284. TASK [Gathering Facts] *************************************************************************************************************************************
  285.  
  286. ok: [172.31.36.119]
  287.  
  288. TASK [Installing required packages for the website] ********************************************************************************************************
  289. ok: [172.31.36.119]
  290.  
  291. TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
  292. ok: [172.31.36.119]
  293.  
  294. TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
  295. ok: [172.31.36.119]
  296.  
  297. TASK [Cloning the website to the remote server] ************************************************************************************************************
  298. ok: [172.31.36.119]
  299.  
  300. TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
  301. skipping: [172.31.36.119]
  302.  
  303. PLAY [Provisioning a php website] **************************************************************************************************************************
  304.  
  305. TASK [Gathering Facts] *************************************************************************************************************************************
  306.  
  307. ok: [172.31.40.128]
  308.  
  309. TASK [Installing required packages for the website] ********************************************************************************************************
  310. changed: [172.31.40.128]
  311.  
  312. TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
  313. changed: [172.31.40.128]
  314.  
  315. TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
  316. changed: [172.31.40.128]
  317.  
  318. TASK [Cloning the website to the remote server] ************************************************************************************************************
  319. changed: [172.31.40.128]
  320.  
  321. TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
  322. changed: [172.31.40.128]
  323.  
  324. RUNNING HANDLER [httpd-restart] ****************************************************************************************************************************
  325. changed: [172.31.40.128]
  326.  
  327. RUNNING HANDLER [php-restart] ******************************************************************************************************************************
  328. changed: [172.31.40.128]
  329.  
  330. PLAY RECAP *************************************************************************************************************************************************
  331. 172.31.33.47               : ok=5    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0
  332. 172.31.34.72               : ok=5    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0
  333. 172.31.36.119              : ok=5    changed=0    unreachable=0    failed=0    skipped=1    rescued=0    ignored=0
  334. 172.31.40.128              : ok=8    changed=7    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
  335. localhost                  : ok=6    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
  336.  
  337.  
  338.  
  339.  
  340. #### Changing the version of php website ####
  341.  
  342.  
  343. [ec2-user@ip-172-31-33-5 ~]$ ansible-playbook main.yml
  344.  
  345. PLAY [Zomato-prod infra callup] ****************************************************************************************************************************
  346. TASK [Gathering Facts] *************************************************************************************************************************************
  347. ok: [localhost]
  348.  
  349. TASK [Ansible galaxy install amazon.aws] *******************************************************************************************************************
  350. ok: [localhost]
  351.  
  352. TASK [Installing pip3] *************************************************************************************************************************************
  353. ok: [localhost]
  354.  
  355. TASK [Installing pip3 modules] *****************************************************************************************************************************
  356. ok: [localhost]
  357.  
  358. TASK [Fetching the aws webserver details] ******************************************************************************************************************
  359. ok: [localhost]
  360.  
  361. TASK [Creating a dynamic inventory] ************************************************************************************************************************
  362. [WARNING]: Invalid characters were found in group names but not replaced, use -vvvv to see details
  363. 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'})
  364. 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'})
  365. 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'})
  366. 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'})
  367.  
  368. PLAY [Provisioning a php website] **************************************************************************************************************************
  369.  
  370. TASK [Gathering Facts] *************************************************************************************************************************************
  371. ok: [172.31.34.72]
  372.  
  373. TASK [Installing required packages for the website] ********************************************************************************************************
  374. ok: [172.31.34.72]
  375.  
  376. TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
  377. ok: [172.31.34.72]
  378.  
  379. TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
  380. ok: [172.31.34.72]
  381.  
  382. TASK [Cloning the website to the remote server] ************************************************************************************************************
  383. changed: [172.31.34.72]
  384.  
  385. TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
  386. changed: [172.31.34.72]
  387.  
  388. RUNNING HANDLER [php-restart] ******************************************************************************************************************************
  389. changed: [172.31.34.72]
  390.  
  391. PLAY [Provisioning a php website] **************************************************************************************************************************
  392.  
  393. TASK [Gathering Facts] *************************************************************************************************************************************
  394. ok: [172.31.33.47]
  395.  
  396. TASK [Installing required packages for the website] ********************************************************************************************************
  397. ok: [172.31.33.47]
  398.  
  399. TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
  400. ok: [172.31.33.47]
  401.  
  402. TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
  403. ok: [172.31.33.47]
  404.  
  405. TASK [Cloning the website to the remote server] ************************************************************************************************************
  406. changed: [172.31.33.47]
  407.  
  408. TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
  409. changed: [172.31.33.47]
  410.  
  411. RUNNING HANDLER [php-restart] ******************************************************************************************************************************
  412. changed: [172.31.33.47]
  413.  
  414. PLAY [Provisioning a php website] **************************************************************************************************************************
  415.  
  416. TASK [Gathering Facts] *************************************************************************************************************************************
  417. .
  418. ok: [172.31.36.119]
  419.  
  420. TASK [Installing required packages for the website] ********************************************************************************************************
  421. ok: [172.31.36.119]
  422.  
  423. TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
  424. ok: [172.31.36.119]
  425.  
  426. TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
  427. ok: [172.31.36.119]
  428.  
  429. TASK [Cloning the website to the remote server] ************************************************************************************************************
  430. changed: [172.31.36.119]
  431.  
  432. TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
  433. changed: [172.31.36.119]
  434.  
  435. RUNNING HANDLER [php-restart] ******************************************************************************************************************************
  436. changed: [172.31.36.119]
  437.  
  438. PLAY [Provisioning a php website] **************************************************************************************************************************
  439.  
  440. TASK [Gathering Facts] *************************************************************************************************************************************
  441.  
  442. ok: [172.31.40.128]
  443.  
  444. TASK [Installing required packages for the website] ********************************************************************************************************
  445. ok: [172.31.40.128]
  446.  
  447. TASK [Copying the httpd.conf.tmpl to /etc/httpd/conf/httpd.conf] *******************************************************************************************
  448. ok: [172.31.40.128]
  449.  
  450. TASK [Copying the virtaulhost of blog.chrisich.fun to /etc/httpd/conf.d/blog.chrisich.fun] *****************************************************************
  451. ok: [172.31.40.128]
  452.  
  453. TASK [Cloning the website to the remote server] ************************************************************************************************************
  454. changed: [172.31.40.128]
  455.  
  456. TASK [Copying the website to the documentroot /var/www/html/blog.chrisich.fun/] ****************************************************************************
  457. changed: [172.31.40.128]
  458.  
  459. RUNNING HANDLER [php-restart] ******************************************************************************************************************************
  460. changed: [172.31.40.128]
  461.  
  462. PLAY RECAP *************************************************************************************************************************************************
  463. 172.31.33.47               : ok=7    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
  464. 172.31.34.72               : ok=7    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
  465. 172.31.36.119              : ok=7    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
  466. 172.31.40.128              : ok=7    changed=3    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
  467. localhost                  : ok=6    changed=1    unreachable=0    failed=0    skipped=0    rescued=0    ignored=0
  468.  
Advertisement
Add Comment
Please, Sign In to add comment