2023-11-22 13:45:05
728x90
728x90

이미 생성된 VM에 Network Adapter 추가 / 삭제 작업 필요시 프로젝트 VM들 생성하기에서는 하나의 Network Adapter만 사용하도록 설정되어 있음 → 외부 네트워크와 프로젝트 전용 내부 네트워크를 사용을 위한 Network Adpater 추가

 

# vi changenet.yml

---
- hosts: localhost
  vars:
    ansible_python_interpreter: /bin/python3
    gather_facts: no
    vcenter_hostname: "172.16.10.104"
    vcenter_username: "administrator@team4.local"
    vcenter_password: "VMware1!"
    project_id: "khb-00"
    public_net:  "External"
    private_net: "{{ project_id + '-Openshift' }}"

  tasks:
  - name: 7. Modify Bastion VM Network
    community.vmware.vmware_guest_network:
      hostname: "{{ vcenter_hostname }}"
      username: "{{ vcenter_username }}"
      password: "{{ vcenter_password }}"
      validate_certs: 'false'
      name: "{{ project_id + '-Bastion'}}"
      network_name: '{{ item.network }}'
      label: '{{ item.label }}'
      state: present
    loop:
    - { network: "{{ public_net }}", label: "Network adapter 1" }
    - { network: "{{ private_net }}", label: "Network adapter 2" }
    delegate_to: localhost
    
# ansible-playbook changenet.yml

728x90