Skip to content

Commit

Permalink
Merge pull request #49 from abikouo/play_doc_v1
Browse files Browse the repository at this point in the history
Document collection playbooks
  • Loading branch information
gravesm authored Aug 28, 2023
2 parents 28637e1 + 8cf02ac commit 3f18c7e
Show file tree
Hide file tree
Showing 7 changed files with 203 additions and 3 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,10 @@ Name | Description
### Playbooks
Name | Description
--- | ---
cloud.azure_ops.webapp|A playbook to create a webapp on Azure.
[cloud.azure_ops.webapp](https://github.com/redhat-cop/cloud.azure_ops/blob/main/playbooks/WEBAPP.md)|A playbook to deploy a web application on azure using virtual machines.
[cloud.azure_ops.webapp_container](https://github.com/redhat-cop/cloud.azure_ops/blob/main/playbooks/WEBAPP_CONTAINER.md)|A playbook to deploy a web application on azure using containers.
[cloud.azure_ops.vmss_migrate](https://github.com/redhat-cop/cloud.azure_ops/blob/main/playbooks/VMSS_MIGRATE.md)|A playbook to migrate virtual machines of a web application from one azure region to another region.
[cloud.azure_ops.validate_deployment](https://github.com/redhat-cop/cloud.azure_ops/blob/main/playbooks/VALIDATE_DEPLOYMENT.md)|A playbook to validate successful deployment of web application URL.
<!--end collection content-->

## Installation and Usage
Expand Down
8 changes: 8 additions & 0 deletions playbooks/VALIDATE_DEPLOYMENT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## cloud.azure_ops.validate_deployment playbook

A playbook to validate successful deployment of a web application.

Variables
--------------

* **azure_app_url**: (Required) URL of the Web application.
54 changes: 54 additions & 0 deletions playbooks/VMSS_MIGRATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
## cloud.azure_ops.vmss_migrate playbook

A playbook to migrate virtual machines of a web application from one Azure region to another region.

Variables
--------------

###### Common
--------------

* **source_resource_group**: The origin resource group. Should not be equal to **destination_resource_group**. Default: `src_rg`
* **source_region**: The origin Azure region. Default: `eastus`
* **destination_resource_group**: The destination resource group. Should not be equal to **source_resource_group**. Default: `dst_rg`
* **destination_region**: The destination Azure region. Default: `canadacentral`


--------------
###### Networking
--------------

* **azure_vnet_address_prefixes_cidr**: The virtual network CIDR address prefixes. Default: `['10.1.0.0/16']`
* **azure_subnet_address_prefixes_cidr**: The subnet CIDR address prefixes. Default: `10.1.0.0/24`

--------------
###### Virtual machines
--------------
* **azure_vm_name**: Virtual machine scaleset name prefix, the name of the scaleset will be `{{ azure_vm_name }}ss`. Default: `webapp-vm-`
* **azure_vm_user**: Virtual machine user. Default: `ansible`
* **azure_vm_user_password**: Virtual machine user password. Default: `4fB5In3ueO7,`

--------------
###### PostgreSQL
--------------
* **azure_postgresql_name**: The name of the PostgreSQL server. Default: `{{ azure_resource_group | replace('_', '-') }}-dbserver`
* **azure_postgresql_admin_username**: The database server admin user. Default: `ansible`
* **azure_postgresql_admin_password**: The database server admin user password. Default: `4fB5In3ueO7,`
* **azure_postgresql_database_instances**: The list of database instances. Default: `[{'name': 'pyapp', 'charset': 'UTF8'}]`
* **azure_postgresql_firewall_rules**: The database firewall rules. Default: `[{'name': 'allow_all', 'start_ip_address': '0.0.0.0', 'end_ip_address': '255.255.255.255'}]`

--------------
###### Web application
--------------

* **py_application**: Object used to provide details for the web application. Contains the following:
- * **env**: The python flask application environment. Default: `development`
- * **admin_user**: The web application admin user. Default: `admin`
- * **admin_password**: The web application admin user password: Default: `admin`
- * **docker_image**: The name of the Docker image to build. Default: `pywebapp`
- * **docker_dir**: Path on virtual machine where Docker files will be downloaded. Default: `/app/pyapp`
- * **container_name**: The name of the container to start on the VM. Default: `myapp-container`

* **application_force_init**: Whether to force application initialization, this will delete existing data from the databse. Default: `false`
* **application_src**: Remote repository application source code. Default: `https://github.com/abikouo/webapp_pyflask_demo.git`
* **playbook_number_forks**: number of parallel fork to use to deploy application into VM. Default: `15`
65 changes: 65 additions & 0 deletions playbooks/WEBAPP.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
## cloud.azure_ops.webapp playbook

A playbook to deploy a web application on Azure using virtual machines.

Variables
--------------

###### Common
--------------

* **azure_resource_group**: (Required) Resource group on/from which the web application resources will reside.
* **azure_region**: An Azure location for the resources. Default: `eastus`
* **azure_tags**: Dictionary of string:string pairs to assign as metadata to the resources.
Default: `{'application': 'python-demo-webapp-for-ansible-cloud-team'}`

--------------
###### Networking
--------------

* **azure_virtual_network**: The name of the virtual network for VMs. Default: `{{ azure_resource_group }}-vnet`
* **azure_vnet_address_prefixes_cidr**: The virtual network CIDR address prefixes. Default: `['10.1.0.0/16']`
* **azure_subnet**: The name of the subnet inside the virtual network. Default: `{{ azure_resource_group }}-subnet`
* **azure_subnet_address_prefixes_cidr**: The subnet CIDR address prefixes. Default: `10.1.0.0/24`
* **azure_security_group**: The network security group name. Default: `{{ azure_resource_group }}-nsg`
* **azure_load_balancer**: Object used to provide details for a load balancer. Contains the following:
- **name**: Name of the load balancer. Default: `{{ azure_resource_group }}-lb`
- **public_ip_name**: Name of load balancer's public ip. Default: `{{ azure_resource_group }}-lb-public-ip`
- **backend_address_pool**: Name of backend address pools where network interfaces can be attached. Default: `{{ azure_resource_group }}-vm-pool`
- **domain_name**: Load balancer domain name.

--------------
###### Virtual machines
--------------
* **azure_vm_name**: Virtual machine scaleset name prefix, the name of the scaleset will be `{{ azure_vm_name }}ss`. Default: `webapp-vm-`
* **azure_vm_user**: Virtual machine user. Default: `ansible`
* **azure_vm_user_password**: Virtual machine user password. Default: `4fB5In3ueO7,`
* **azure_vm_image**: The image used to build the VM. See [azure.azcollection.azure_rm_virtualmachine](https://github.com/ansible-collections/azure/blob/5df571fbbb4cd83ad98b143157ae947f1d15b2d9/plugins/modules/azure_rm_virtualmachine.py#L136-L141). Default: `{'offer': 'RHEL', 'publisher': 'RedHat', 'sku': '7-LVM', 'version': 'latest'}`
* **azure_vm_size**: The Azure VM size. Default: `Standard_A2`
* **azure_bastion_vm_size**: The Azure VM size for the bastion VM. Default: `Standard_A1_v2`
* **azure_number_vm**: The number of VM on the virtual machine scaleset. Default: `3`

--------------
###### PostgreSQL
--------------
* **azure_postgresql_name**: The name of the PostgreSQL server. Default: `{{ azure_resource_group | replace('_', '-') }}-dbserver`
* **azure_postgresql_admin_username**: The database server admin user. Default: `ansible`
* **azure_postgresql_admin_password**: The database server admin user password. Default: `4fB5In3ueO7,`
* **azure_postgresql_database_instances**: The list of database instances. Default: `[{'name': 'pyapp', 'charset': 'UTF8'}]`
* **azure_postgresql_firewall_rules**: The database firewall rules. Default: `[{'name': 'allow_all', 'start_ip_address': '0.0.0.0', 'end_ip_address': '255.255.255.255'}]`

--------------
###### Web application
--------------

* **py_application**: Object used to provide details for the web application. Contains the following:
- * **env**: The python flask application environment. Default: `development`
- * **admin_user**: The web application admin user. Default: `admin`
- * **admin_password**: The web application admin user password: Default: `admin`
- * **docker_image**: The name of the Docker image to build. Default: `pywebapp`
- * **docker_dir**: Path on virtual machine where Docker files will be downloaded. Default: `/app/pyapp`
- * **container_name**: The name of the container to start on the VM. Default: `myapp-container`

* **application_force_init**: Whether to force application initialization, this will delete existing data from the database. Default: `false`
* **application_src**: Remote repository application source code. Default: `https://github.com/abikouo/webapp_pyflask_demo.git`
* **playbook_number_forks**: number of parallel fork to use to deploy application into VM. Default: `15`
70 changes: 70 additions & 0 deletions playbooks/WEBAPP_CONTAINER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
## cloud.azure_ops.webapp_container playbook

A playbook to deploy a web application on Azure using containers.

Variables
--------------

###### Common
--------------

* **azure_resource_group**: (Required) Resource group on/from which the web application resources will reside.
* **azure_region**: An Azure location for the resources. Default: `eastus`
* **migrate_app**: Flag for migrating from VM / creating from scratch. Default: `false`

--------------
###### Networking
--------------

* **azure_virtual_network**: The name of the virtual network for VMs. Default: `{{ azure_resource_group }}-vnet`
* **azure_vnet_address_prefixes_cidr**: The virtual network CIDR address prefixes. Default: `['10.1.0.0/16']`
* **azure_subnet**: The name of the subnet inside the virtual network. Default: `{{ azure_resource_group }}-subnet`
* **azure_subnet_address_prefixes_cidr**: The subnet CIDR address prefixes. Default: `10.1.0.0/24`
* **azure_security_group**: The network security group name. Default: `{{ azure_resource_group }}-nsg`
* **azure_load_balancer**: Object used to provide details for a load balancer. Contains the following:
- **name**: Name of the load balancer. Default: `{{ azure_resource_group }}-lb`
- **public_ip_name**: Name of load balancer's public ip. Default: `{{ azure_resource_group }}-lb-public-ip`
- **backend_address_pool**: Name of backend address pools where network interfaces can be attached. Default: `{{ azure_resource_group }}-vm-pool`

--------------
###### Container
--------------
* **azure_app_force_update**: Whether to force update of existing instance when creating container instance. Default: `false`
* **azure_vm_os**: Container instance OS type. Default: `Linux`

--------------
###### PostgreSQL
--------------
* **azure_postgresql_name**: The name of the PostgreSQL server. Default: `{{ azure_resource_group | regex_replace('[^a-zA-Z0-9]', '-') }}-dbserver`
* **azure_postgresql_admin_username**: The database server admin user. Default: `ansible`
* **azure_postgresql_admin_password**: The database server admin user password. Default: `4fB5In3ueO7,`
* **azure_postgresql_database_instances**: The list of database instances. Default: `[{'name': 'pyapp', 'charset': 'UTF8'}]`

--------------
###### Web application
--------------

* **azure_app_image**: Application Docker image. Default: `quay.io/jtorcass/pywebapp`
* **azure_app_container_name**: Application container name: Default: `{{ azure_resource_group | regex_replace('[^a-zA-Z0-9]', '-') }}-container`
* **azure_app_mem**: Application memory. Default: `1`
* **azure_app_ports**: Application ports: Default: `[5000]`
* **azure_app_env_vars**: Application environment variables.
Default:
```yaml
- name: FLASK_APP
value: /app/pyapp
- name: FLASK_ENV
value: development
- name: DATABASE_HOST
value: "{{ azure_postgresql_name }}"
- name: DATABASE_INSTANCE
value: "{{ azure_postgresql_database_instances[0].name }}"
- name: DATABASE_USER
value: "{{ azure_postgresql_admin_username }}"
- name: DATABASE_PASSWORD
value: "{{ azure_postgresql_admin_password }}"
- name: ADMIN_USER
value: admin
- name: ADMIN_PASSWORD
value: admin
```
2 changes: 1 addition & 1 deletion playbooks/webapp.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Bootstrap a web app application using azure collection
- name: Bootstrap a web app application using Azure collection
hosts: localhost
gather_facts: false

Expand Down
2 changes: 1 addition & 1 deletion playbooks/webapp_container.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
- name: Deploy existing python app to container instance on azure
- name: Deploy existing python app to container instance on Azure
hosts: localhost
gather_facts: false

Expand Down

0 comments on commit 3f18c7e

Please sign in to comment.