Skip to main content
Glama
site.yml4.99 kB
--- # Main Ansible playbook for AWS LAMP Stack deployment # This playbook orchestrates the entire deployment process - name: Verify Ansible version hosts: localhost gather_facts: false tasks: - name: Check Ansible version assert: that: "ansible_version.full is version_compare('2.9', '>=')" msg: "This playbook requires Ansible 2.9 or later" run_once: true tags: always - name: Configure common settings for all servers hosts: all become: true gather_facts: true tags: common roles: - role: common tags: common - name: Configure EFS client on web servers hosts: web_servers become: true gather_facts: true tags: efs roles: - role: efs_client tags: efs when: efs_enabled | bool - name: Configure database client on web servers hosts: web_servers become: true gather_facts: true tags: db roles: - role: db_client tags: db - name: Configure web servers with Apache and PHP hosts: web_servers become: true gather_facts: true tags: web roles: - role: web tags: web - name: Deploy application to web servers hosts: web_servers become: true gather_facts: true tags: app roles: - role: app tags: app - name: Configure CloudWatch monitoring hosts: all become: true gather_facts: true tags: monitoring tasks: - name: Include CloudWatch monitoring tasks include_role: name: monitoring when: cloudwatch_enabled | bool and not is_localstack | default(false) | bool tags: monitoring - name: Verify deployment hosts: web_servers become: true gather_facts: true tags: verify tasks: - name: Check Apache service service: name: "{{ 'httpd' if ansible_os_family == 'RedHat' else 'apache2' }}" state: started enabled: true register: apache_status failed_when: not apache_status.status.ActiveState == "active" tags: verify - name: Check PHP-FPM service service: name: "php-fpm" state: started enabled: true register: php_fpm_status failed_when: not php_fpm_status.status.ActiveState == "active" when: php_fpm_enabled | default(true) | bool tags: verify - name: Verify Apache configuration command: "{{ 'httpd' if ansible_os_family == 'RedHat' else 'apache2' }} -t" register: apache_config_check changed_when: false failed_when: apache_config_check.rc != 0 tags: verify - name: Verify PHP configuration command: php -v register: php_version_check changed_when: false failed_when: php_version_check.rc != 0 tags: verify - name: Check EFS mount command: df -h {{ efs_mount_point }} register: efs_mount_check changed_when: false failed_when: efs_mount_check.rc != 0 when: efs_enabled | bool tags: verify - name: Test database connection command: php -r "try { new PDO('mysql:host={{ db_host }};dbname={{ db_name }}', '{{ db_user }}', '{{ db_password }}'); echo 'Connection successful'; } catch (PDOException $e) { echo 'Connection failed: ' . $e->getMessage(); exit(1); }" register: db_connection_check changed_when: false failed_when: db_connection_check.rc != 0 tags: verify - name: Verify web application uri: url: "http://localhost/health.php" return_content: true register: health_check failed_when: health_check.status != 200 or 'status' not in health_check.json or health_check.json.status != 'healthy' tags: verify - name: Display verification results debug: msg: "All verification checks passed successfully" tags: verify - name: Summarize deployment hosts: localhost gather_facts: false tags: summary tasks: - name: Gather web server facts set_fact: web_servers_count: "{{ groups['web_servers'] | default([]) | length }}" tags: summary - name: Display deployment summary debug: msg: - "LAMP Stack Deployment Summary" - "------------------------" - "Environment: {{ environment | default('production') }}" - "Region: {{ aws_region | default('us-east-1') }}" - "Web Servers: {{ web_servers_count }}" - "Database: {{ 'RDS' if not is_localstack | default(false) else 'LocalStack' }}" - "EFS: {{ 'Enabled' if efs_enabled | default(true) else 'Disabled' }}" - "CloudWatch: {{ 'Enabled' if cloudwatch_enabled | default(true) and not is_localstack | default(false) else 'Disabled' }}" - "WAF: {{ 'Enabled' if waf_enabled | default(true) and not is_localstack | default(false) else 'Disabled' }}" - "Route53: {{ 'Enabled' if route53_enabled | default(true) and not is_localstack | default(false) else 'Disabled' }}" - "------------------------" - "Deployment completed successfully!" tags: summary

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tarnover/mcp-sysoperator'

If you have feedback or need assistance with the MCP directory API, please join our Discord server