-
-
Save gowatana/4ae08344aa0ae5828e5d1ad1555e027c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Delete NAT Rule / vApp / VDC Network | |
hosts: localhost | |
gather_facts: false | |
vars_files: | |
- vars/login.yml | |
- vars/vdc-vapp.yml | |
- vars/vm-nat.yml | |
environment: | |
env_host: "{{ var_host }}" | |
env_org: "{{ var_org }}" | |
env_user: "{{ var_user_short_name }}" | |
env_password: "{{ var_password }}" | |
env_api_version: "{{ var_api_version }}" | |
env_verify_ssl_certs: "{{ var_verify_ssl_certs }}" | |
tasks: | |
- name: Get Token | |
ansible.builtin.uri: | |
url: "https://{{ var_host }}/cloudapi/1.0.0/sessions" | |
user: "{{ var_user }}" | |
password: "{{ var_password }}" | |
method: POST | |
force_basic_auth: true | |
headers: | |
Accept: "application/json;version={{ var_api_version }}" | |
status_code: 200 | |
validate_certs: "{{ var_verify_ssl_certs }}" | |
register: token | |
- name: Delete DNAT Rules | |
include_tasks: tasks/delete_dnat.yml | |
vars: | |
var_nat_rule_name: "{{ item.var_nat_rule_name }}" | |
dnat_ip: "{{ item.dnat_ip }}" | |
with_items: | |
- "{{ vapp_vm_configs }}" | |
- name: Delete vApp | |
vcd_vapp: | |
vapp_name: "{{ vapp_name }}" | |
vdc: "{{ vdc_name }}" | |
state: "absent" | |
force: true | |
- name: Delete VDC Network | |
vcd_vdc_network: | |
network_name: "{{ vdc_nw_name }}" | |
vdc_name: "{{ vdc_name }}" | |
routed: true | |
state: "absent" | |
force: true |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
下記の投稿むけ。
VMware Cloud Director 10.4 を Ansible で操作してみる。Part-06 複数の DNAT VM を作成するPlaybook 例
https://vm.gowatana.jp/entry/2023/03/25/043925