Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Finish updating the role_prefix #55

Merged
merged 1 commit into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ Once installed, you can reference the cloud.azure_ops collection content by its
ansible.builtin.include_role:
name: cloud.azure_ops.azure_load_balancer_with_public_ip
vars:
operation: create
azure_resource_group: "{{ resource_group }}"
azure_load_balancer:
name: "{{ resource_group }}-lb"
azure_load_balancer_with_public_ip_operation: create
azure_load_balancer_with_public_ip_azure_resource_group: "{{ resource_group }}"
azure_load_balancer_with_public_ip_load_balancer:
name: "{{ resource_group }}-lb"
```

### See Also
Expand Down
7 changes: 7 additions & 0 deletions changelogs/fragments/20240307-update_prefixes.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
bugfixes:
- Update README.md with proper variable names in example
- Update playbooks/roles/scale_virtual_machine/tasks/main.yml to use correct operation variable
- Fix syntax in roles/azure_manage_networking_stack/README.md
- Use correct variables in roles/azure_manage_networking_stack/tasks/create.yml
- Update roles/azure_manage_security_group/tasks/main.yml to use correct operation variable
- Update roles/azure_virtual_machine_with_public_ip/tasks/main.yml to use correct prefix vars
4 changes: 2 additions & 2 deletions playbooks/roles/scale_virtual_machine/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
msg: Azure region must be defined as scale_virtual_machine_region
when: scale_virtual_machine_region is not defined

- name: Include operation tasks
ansible.builtin.include_tasks: "{{ operation }}.yml"
- name: "Include operation tasks. {{ scale_virtual_machine_operation }}"
ansible.builtin.include_tasks: "{{ scale_virtual_machine_operation }}.yml"
4 changes: 2 additions & 2 deletions roles/azure_manage_networking_stack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Example Playbook
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
azure_manage_networking_stack_subnet_address_prefixes_cidr:
- "172.100.0.0/8"
azure_manage_networking_stack_tags:
tag0: "tag0"
Expand All @@ -59,4 +59,4 @@ See [LICENCE](https://github.com/redhat-cop/cloud.azure_ops/blob/main/LICENSE) t
Author Information
------------------

- Ansible Cloud Content Team
- Ansible Cloud Content Team
22 changes: 11 additions & 11 deletions roles/azure_manage_networking_stack/tasks/create.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Check that resource group exists
azure.azcollection.azure_rm_resourcegroup_info:
name: "{{ azure_resource_group }}"
name: "{{ azure_manage_networking_stack_resource_group }}"
register: result

- name: Create resource group when it does not exists
Expand All @@ -16,16 +16,16 @@

- name: Create azure virtual network
azure.azcollection.azure_rm_virtualnetwork:
location: "{{ azure_region }}"
name: "{{ azure_virtual_network }}"
address_prefixes_cidr: "{{ azure_vnet_address_prefixes_cidr }}"
resource_group: "{{ azure_resource_group }}"
tags: "{{ azure_tags | default(omit) }}"
location: "{{ azure_manage_networking_stack_region }}"
name: "{{ azure_manage_networking_stack_virtual_network }}"
address_prefixes_cidr: "{{ azure_manage_networking_stack_vnet_address_prefixes_cidr }}"
resource_group: "{{ azure_manage_networking_stack_resource_group }}"
tags: "{{ azure_manage_networking_stack_tags | default(omit) }}"

- name: Create azure subnet
azure.azcollection.azure_rm_subnet:
name: "{{ azure_subnet }}"
virtual_network: "{{ azure_virtual_network }}"
address_prefix_cidr: "{{ azure_subnet_address_prefixes_cidr }}"
resource_group: "{{ azure_resource_group }}"
security_group: "{{ azure_security_group | default(omit) }}"
name: "{{ azure_manage_networking_stack_subnet }}"
virtual_network: "{{ azure_manage_networking_stack_virtual_network }}"
address_prefixes_cidr: "{{ azure_manage_networking_stack_subnet_address_prefixes_cidr }}"
resource_group: "{{ azure_manage_networking_stack_resource_group }}"
security_group: "{{ azure_manage_networking_stack_security_group | default(omit) }}"
2 changes: 1 addition & 1 deletion roles/azure_manage_security_group/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
- name: Check operation validation
ansible.builtin.fail:
msg: Please provide operation as 'create' or 'delete'
msg: Please provide azure_manage_security_group_operation as 'create' or 'delete'
when: azure_manage_security_group_operation not in ['create', 'delete']

- name: Check resource group name
Expand Down
16 changes: 8 additions & 8 deletions roles/azure_virtual_machine_with_public_ip/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@

- name: Ensure vm name is defined
ansible.builtin.fail:
msg: "Missing parameter: key 'name' not found in azure_virtual_machine_with_public_ip_operation_vm"
when: azure_virtual_machine_with_public_ip_operation_vm.name is not defined
msg: "Missing parameter: key 'name' not found in azure_virtual_machine_with_public_ip_vm"
when: azure_virtual_machine_with_public_ip_vm.name is not defined

- name: Replace invalid chars in name
ansible.builtin.set_fact:
vm_name: "{{ azure_virtual_machine_with_public_ip_operation_vm.name | regex_replace('[^a-zA-Z0-9]', '-') }}"
vm_name: "{{ azure_virtual_machine_with_public_ip_vm.name | regex_replace('[^a-zA-Z0-9]', '-') }}"

- name: Get resource group info
azure.azcollection.azure_rm_resourcegroup_info:
Expand All @@ -28,28 +28,28 @@
resource_group: "{{ azure_virtual_machine_with_public_ip_resource_group }}"
name: "{{ vm_name }}"
started: false
when: operation == 'power_off'
when: azure_virtual_machine_with_public_ip_operation == 'power_off'

- name: Deallocate VM
azure.azcollection.azure_rm_virtualmachine:
resource_group: "{{ azure_virtual_machine_with_public_ip_resource_group }}"
name: "{{ vm_name }}"
allocated: false
when: operation == 'deallocate'
when: azure_virtual_machine_with_public_ip_operation == 'deallocate'

- name: Power On VM
azure.azcollection.azure_rm_virtualmachine:
resource_group: "{{ azure_virtual_machine_with_public_ip_resource_group }}"
name: "{{ vm_name }}"
when: operation == 'power_on'
when: azure_virtual_machine_with_public_ip_operation == 'power_on'

- name: Restart VM
azure.azcollection.azure_rm_virtualmachine:
resource_group: "{{ azure_virtual_machine_with_public_ip_resource_group }}"
name: "{{ vm_name }}"
restarted: true
when: operation == 'restart'
when: azure_virtual_machine_with_public_ip_operation == 'restart'

- name: Create or delete VM
ansible.builtin.include_tasks: "{{ azure_virtual_machine_with_public_ip_operation }}.yml"
when: operation in ['create', 'delete']
when: azure_virtual_machine_with_public_ip_operation in ['create', 'delete']
Loading