Skip to content

Commit

Permalink
fixed example playbooks
Browse files Browse the repository at this point in the history
  • Loading branch information
anna-savina committed May 30, 2024
1 parent 58efd10 commit 38ef947
Show file tree
Hide file tree
Showing 8 changed files with 160 additions and 134 deletions.
2 changes: 2 additions & 0 deletions changelogs/fragments/20240530-readme_playbook_example.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
bugfixes:

Check failure on line 1 in changelogs/fragments/20240530-readme_playbook_example.yml

View workflow job for this annotation

GitHub Actions / ansible-lint

syntax-check[specific]

A playbook must be a list of plays, got a <class 'ansible.parsing.yaml.objects.AnsibleMapping'> instead: /home/runner/work/cloud.azure_ops/cloud.azure_ops/changelogs/fragments/20240530-readme_playbook_example.yml
- Update README.md with proper playbook examples
45 changes: 24 additions & 21 deletions roles/azure_load_balancer_with_public_ip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,27 +62,30 @@ Example Playbook
----------------

- hosts: localhost
roles:
- role: cloud.azure_ops.azure_load_balancer_with_public_ip
azure_load_balancer_with_public_ip_operation: "create"
azure_load_balancer_with_public_ip_region: "canadacentral"
azure_load_balancer_with_public_ip_resource_group: "rg"
azure_load_balancer_with_public_ip_load_balancer:
name: "example-lb"
probes:
- name: lb-probe
port: 5000
rules:
- name: lb-rule
probe: lb-probe
backend_address_pool: 'default'
frontend_ip_configuration: 'default'
frontend_port: 5000
backend_port: 5000
sku: 'Standard'
tags:
tag0: 'test0'
tag1: 'test1'
tasks:
- name: Create Load Balancer with Public IP
ansible.builtin.include_role:
name: cloud.azure_ops.azure_load_balancer_with_public_ip
vars:
azure_load_balancer_with_public_ip_operation: create
azure_load_balancer_with_public_ip_region: 'eastus'
azure_load_balancer_with_public_ip_resource_group: 'resource-group'
azure_load_balancer_with_public_ip_load_balancer:
name: 'example-lb'
probes:
- name: lb-probe
port: 5000
rules:
- name: lb-rule
probe: lb-probe
backend_address_pool: 'default'
frontend_ip_configuration: 'default'
frontend_port: 5000
backend_port: 5000
sku: 'Standard'
tags:
tag0: 'test0'
tag1: 'test1'

License
-------
Expand Down
44 changes: 24 additions & 20 deletions roles/azure_manage_network_interface/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,29 +49,33 @@ Example Playbook
----------------

- hosts: localhost
roles:
tasks:
- name: Create a Network Interface with Default Security Group
role: cloud.azure_ops.azure_manage_network_interface
azure_manage_network_interface_operation: 'create'
azure_manage_network_interface_resource_group: 'nic-example'
azure_manage_network_interface_interface:
name: 'nic'
vnet_name: 'vnet'
subnet_name: 'subnet'
ip_configurations:
- name: ipconf1
public_ip_address_name: 'pip'
primary: True
tags:
tag0: 'test0'
tag1: 'test1'
ansible.builtin.include_role:
name: cloud.azure_ops.azure_manage_network_interface
vars:
azure_manage_network_interface_operation: create
azure_manage_network_interface_resource_group: 'resource-group'
azure_manage_network_interface_interface:
name: 'nic'
vnet_name: 'vnet'
subnet_name: 'subnet'
ip_configurations:
- name: ipconf1
primary: true
public_ip_address_name: 'pip'
tags:
tag0: "test0"
tag1: "test1"

- name: Cleanup Network Interface and Default Security Group
role: cloud.azure_ops.azure_manage_network_interface
azure_manage_network_interface_operation: 'delete'
azure_manage_network_interface_resource_group: 'nic-example'
azure_manage_network_interface_interface:
name: 'nic'
ansible.builtin.include_role:
name: cloud.azure_ops.azure_manage_network_interface
vars:
azure_manage_network_interface_operation: delete
azure_manage_network_interface_resource_group: 'resource-group'
azure_manage_network_interface_interface:
name: 'nic'

License
-------
Expand Down
33 changes: 18 additions & 15 deletions roles/azure_manage_networking_stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,24 @@ Example Playbook
----------------

- hosts: localhost
roles:
- role: cloud.azure_ops.azure_manage_networking_stack
azure_manage_networking_stack_operation: "create"
azure_manage_networking_stack_region: "eastus"
azure_manage_networking_stack_resource_group: "testing-resource-group"
azure_manage_networking_stack_virtual_network: "my-vnet"
azure_manage_networking_stack_subnet: "my-subnet-00"
azure_manage_networking_stack_vnet_address_prefixes_cidr:
- "10.1.0.0/16"
- "172.100.0.0/16"
azure_manage_networking_stack_subnet_address_prefixes_cidr:
- "172.100.0.0/8"
azure_manage_networking_stack_tags:
tag0: "tag0"
tag1: "tag1"
tasks:
- name: Create Networking stack
ansible.builtin.include_role:
name: cloud.azure_ops.azure_manage_networking_stack
vars:
azure_manage_networking_stack_operation: create
azure_manage_networking_stack_region: 'eastus'
azure_manage_networking_stack_resource_group: 'resource-group'
azure_manage_networking_stack_virtual_network: 'vnet'
azure_manage_networking_stack_subnet: 'subnet'
azure_manage_networking_stack_vnet_address_prefixes_cidr:
- "10.1.0.0/16"
- "172.100.0.0/16"
azure_manage_networking_stack_subnet_address_prefixes_cidr:
- "172.100.0.0/8"
azure_manage_networking_stack_tags:
tag0: "tag0"
tag1: "tag1"

License
-------
Expand Down
31 changes: 17 additions & 14 deletions roles/azure_manage_postgresql/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,26 +58,29 @@ Example Playbook
----------------

- hosts: localhost
roles:
- role: cloud.azure_ops.azure_manage_postgresql
azure_manage_postgresql_postgresql_name: postgresql-server
azure_manage_postgresql_operation: "create"
azure_manage_postgresql_region: "eastus"
azure_manage_postgresql_resource_group: "postgresql-rg"
azure_manage_postgresql_postgresql_backup_retention_days: 10
azure_manage_postgresql_postgresql_admin_username: ansible
azure_manage_postgresql_postgresql_admin_password: ansible-testing-123
azure_manage_postgresql_postgresql_storage_mb: 5120
azure_manage_postgresql_postgresql_sku:
tasks:
- name: Create PostgreSQL server
ansible.builtin.include_role:
name: cloud.azure_ops.azure_manage_postgresql
vars:
azure_manage_postgresql_postgresql_name: postgresql-server
azure_manage_postgresql_operation: create
azure_manage_postgresql_region: 'eastus'
azure_manage_postgresql_resource_group: 'resource-group'
azure_manage_postgresql_postgresql_backup_retention_days: 10
azure_manage_postgresql_postgresql_admin_username: 'azureuser'
azure_manage_postgresql_postgresql_admin_password: 'Password123!'
azure_manage_postgresql_postgresql_storage_mb: 5120
azure_manage_postgresql_postgresql_sku:
name: B_Gen5_1
tier: Basic
azure_manage_postgresql_resource_group_tags:
azure_manage_postgresql_resource_group_tags:
tag0: "tag0"
tag1: "tag1"
azure_manage_postgresql_postgresql_settings:
azure_manage_postgresql_postgresql_settings:
- name: deadlock_timeout
value: 2000
azure_manage_postgresql_postgresql_firewall_rule:
azure_manage_postgresql_postgresql_firewall_rule:
- name: rule_0
start_ip_address: 172.10.1.0
end_ip_address: 172.10.128.0
Expand Down
21 changes: 12 additions & 9 deletions roles/azure_manage_resource_group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,18 @@ Example Playbook
----------------

- hosts: localhost
roles:
- role: cloud.azure_ops.azure_manage_resource_group
azure_manage_resource_group_operation: "create"
azure_manage_resource_group_region: "eastus"
azure_manage_resource_group_name: "testing-resource-group"
azure_manage_resource_group_tags:
tag0: "tag0"
tag1: "tag1"
azure_manage_resource_group_lock_resource_group: true
tasks:
- name: Create Resource Group
ansible.builtin.include_role:
name: cloud.azure_ops.azure_manage_resource_group
vars:
azure_manage_resource_group_operation: create
azure_manage_resource_group_region: 'eastus'
azure_manage_resource_group_name: 'resource-group'
azure_manage_resource_group_tags:
tag0: "tag0"
tag1: "tag1"
azure_manage_resource_group_lock_resource_group: true

License
-------
Expand Down
68 changes: 36 additions & 32 deletions roles/azure_manage_security_group/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,43 @@ Example Playbook
----------------

- hosts: localhost
roles:
- name: Create a security group with custom rules
role: cloud.azure_ops.azure_manage_security_group
azure_manage_security_group_resource_group: 'my_resource_group'
azure_manage_security_group_region: eastus
azure_manage_security_group_operation: 'create'
azure_manage_security_group_security_group:
name: "{{ azure_resource_group }}-sg"
rules:
- name: 'allow_ssh'
protocol: Tcp
destination_port_range:
- 22
access: Allow
priority: 100
direction: Inbound
- name: 'allow_web_traffic'
protocol: Tcp
destination_port_range:
- 80
- 443
access: Allow
priority: 101
direction: Inbound
tasks:
- name: Create Security Group with custom rules
ansible.builtin.include_role:
name: cloud.azure_ops.azure_manage_security_group
vars:
azure_manage_security_group_resource_group: 'resource-group'
azure_manage_security_group_region: 'eastus'
azure_manage_security_group_operation: create
azure_manage_security_group_security_group:
name: 'security-group'
rules:
- name: 'allow_ssh'
protocol: Tcp
destination_port_range:
- 22
access: Allow
priority: 100
direction: Inbound
- name: 'allow_web_traffic'
protocol: Tcp
destination_port_range:
- 80
- 443
access: Allow
priority: 101
direction: Inbound

- name: Remove rules from security group
role: cloud.azure_ops.azure_manage_security_group
azure_manage_security_group_resource_group: 'my_resource_group'
azure_manage_security_group_security_group:
name: "{{ azure_resource_group }}-sg"
rules_to_remove:
- 'allow_ssh'
- 'allow_web_traffic'
- name: Remove rules from Security Group
ansible.builtin.include_role:
name: cloud.azure_ops.azure_manage_security_group
vars:
azure_manage_security_group_resource_group: 'resource-group'
azure_manage_security_group_security_group:
name: 'security-group'
rules_to_remove:
- 'allow_ssh'
- 'allow_web_traffic'

License
-------
Expand Down
50 changes: 27 additions & 23 deletions roles/azure_virtual_machine_with_public_ip/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,32 +55,36 @@ Example Playbook
----------------

- hosts: localhost
roles:
tasks:
- name: Create a load balanced virtual machine with a default network interface
role: cloud.azure_ops.azure_virtual_machine_with_public_ip
azure_virtual_machine_with_public_ip_operation: 'create'
azure_virtual_machine_with_public_ip_region: eastus
azure_virtual_machine_with_public_ip_resource_group: 'my_resource_group'
azure_virtual_machine_with_public_ip_vm:
name: "example-vm"
admin_username: 'azureuser'
admin_password: 'adminpass'
image:
offer: RHEL
publisher: RedHat
sku: 7-LVM
version: latest
size: Standard_DS1_v2
load_balancer_backend_address_pools:
- name: 'default'
load_balancer: 'existing-lb'
ansible.builtin.include_role:
name: cloud.azure_ops.azure_virtual_machine_with_public_ip
vars:
azure_virtual_machine_with_public_ip_operation: create
azure_virtual_machine_with_public_ip_region: 'eastus'
azure_virtual_machine_with_public_ip_resource_group: 'resource-group'
azure_virtual_machine_with_public_ip_vm:
name: 'example-vm'
admin_username: 'azureuser'
admin_password: 'Password123!'
image:
offer: RHEL
publisher: RedHat
sku: 8-LVM
version: latest
size: Standard_B1ms
load_balancer_backend_address_pools:
- name: 'default'
load_balancer: 'existing-lb'

- name: Delete virtual machine and all autocreated resources
role: cloud.azure_ops.azure_virtual_machine_with_public_ip
azure_virtual_machine_with_public_ip_operation: 'delete'
azure_virtual_machine_with_public_ip_remove_on_absent: 'all_autocreated'
azure_virtual_machine_with_public_ip_vm:
name: "example-vm"
ansible.builtin.include_role:
cloud.azure_ops.azure_virtual_machine_with_public_ip
vars:
azure_virtual_machine_with_public_ip_operation: delete
azure_virtual_machine_with_public_ip_remove_on_absent: 'all_autocreated'
azure_virtual_machine_with_public_ip_vm:
name: 'example-vm'

License
-------
Expand Down

0 comments on commit 38ef947

Please sign in to comment.