🚧 Add playbook to show state of destination cloud
This commit is contained in:
parent
9a7c57e824
commit
9758e5ce09
2 changed files with 80 additions and 5 deletions
75
show-dst-cloud.yml
Normal file
75
show-dst-cloud.yml
Normal file
|
|
@ -0,0 +1,75 @@
|
|||
---
|
||||
- name: Get info
|
||||
hosts: migrator
|
||||
tasks:
|
||||
- name: Get project details
|
||||
openstack.cloud.project_info:
|
||||
cloud: dst_admin
|
||||
name: "test-project"
|
||||
register: dst_project
|
||||
- name: Display dst project
|
||||
ansible.builtin.debug:
|
||||
msg: "id: {{ dst_project.openstack_projects[0].id }} name: {{ dst_project.openstack_projects[0].name }}"
|
||||
|
||||
- name: Gather information about all available flavors
|
||||
openstack.cloud.compute_flavor_info:
|
||||
cloud: dst_admin
|
||||
register: dst_flavors_info
|
||||
- name: Display dst flavor names
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ dst_flavors_info | community.general.json_query('openstack_flavors[*].name') }}"
|
||||
|
||||
# images
|
||||
- name: Gather information about all available images
|
||||
openstack.cloud.image_info:
|
||||
cloud: dst_admin
|
||||
register: dst_images
|
||||
- name: Display dst image names
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ dst_images | community.general.json_query(query) }}"
|
||||
vars:
|
||||
query: >-
|
||||
image[].{Name:name, min_ram:minRam, min_disk:minDisk}
|
||||
#"openstack_images[*].[name, minRam, minDisk] | join(', ', @)"
|
||||
# networks
|
||||
- name: Gather information about all available networks
|
||||
openstack.cloud.networks_info:
|
||||
cloud: dst_admin
|
||||
register: dst_networks
|
||||
- name: Display dst network names
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ dst_networks | community.general.json_query(query) }}"
|
||||
vars:
|
||||
query: >-
|
||||
openstack_networks[].{Name:name, provider_phyiscal_network:"provider:physical_network"}
|
||||
# msg: "{{ dst_flavors_info | community.general.json_query('openstack_flavors[*].name') }}"
|
||||
# "provider:physical_network"
|
||||
# subnets
|
||||
- name: Gather information about all available subnets
|
||||
openstack.cloud.subnets_info:
|
||||
cloud: dst_admin
|
||||
register: dst_subnets
|
||||
- name: Display dst subnet names
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ dst_subnets | community.general.json_query(query) }}"
|
||||
vars:
|
||||
query: >-
|
||||
openstack_subnets[].{Name:name, CIDR:cidr, pool:allocation_pools}
|
||||
# security groups
|
||||
- name: Gather information about all security groups
|
||||
openstack.cloud.security_group_info:
|
||||
cloud: dst_admin
|
||||
project_id: "{{ dst_project['openstack_projects'][0]['id'] }}"
|
||||
name: "test-sg"
|
||||
register: dst_sgs
|
||||
- name: Display dst sg names
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ dst_sgs['security_groups'][0]['name'] }}"
|
||||
# msg: "{{ dst_flavors_info | community.general.json_query('openstack_flavors[*].name') }}"
|
||||
- name: Disaply dst sg rules
|
||||
ansible.builtin.debug:
|
||||
msg: "{{ dst_sgs | community.general.json_query(query) }}"
|
||||
vars:
|
||||
query: >-
|
||||
security_groups[0].security_group_rules[?direction== 'ingress'].{Type: ethertype, Protocol: protocol, PortRangeMin: port_range_min, PortRangeMax: port_range_max}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue