UncleNUC Wiki

Second chance for NUCs

User Tools

Site Tools


lab:ansible_virtualbox_autoboot_linux:deploy_an_application_to_our_fleet_of_vms

This is an old revision of the document!


Deploy an Application to our fleet of VMs

In this step will deploy a placeholder web application to the servers.

Deploy a Demonstration App

Deploy Nginx and PHP

deploy a web page to simulate an app

Create and New Site and Remove Default Site

Test

Open each VM IP address in a web browser and confirm you see the standard phpinfo() page. (i.e., http:<IPADDRESS> The following playbook will confirm a page with HTTP status 200 is returned (but not the contents) <file yaml check_fleet.yml> — - hosts: all become: true tasks: - name: Check web server status on port 80 uri: url: http:inventory_hostname:80/ follow_redirects: no register: web_status - name: Assert 200 HTTP status code assert: that: web_status.status == 200 msg: “Expected HTTP 200 status code, but got web_status.status. Please check web server health.” - name: Print website response (optional) debug: msg: “Website response: web_status.content” when: web_status_conent is defined and web_status.content != '' </file> ===== Reboot the Servers 50% at a Time ===== ===== Shut the Servers Down then Power On Two Ways ===== <file yaml shutdown_fleet.yml> — - hosts: all become: true tasks: - name: Gracefully shut down server community.general.shutdown: </file> <file yaml power_off_fleet.yml> — - hosts: localhost # Run actions on the local machine name: destroy_fleet.yml connection: local gather_facts: false vars_files: - variables.yml - servers.yml tasks: - name: Shut down VM command: “global.vboxmanage_path controlvm item.name acpipowerbutton” ignore_errors: true when: item.Deploy loop: “server_list” </file> ===== Replace Rebuilt Servers ===== rebuild specified server from scratch complete with Apache and simulated application ====== Next Step ====== Continue to Tear Down the Lab Or back to Deploy a Fleet of VMs ====== Optional ======

lab/ansible_virtualbox_autoboot_linux/deploy_an_application_to_our_fleet_of_vms.1706672345.txt.gz · Last modified: 2024/01/31 03:39 by user