リモート サーバーにある iso から Dell iDRAC9 サーバーで Ansible を使用して起動するにはどうすればよいですか?

リモート サーバーにある iso から Dell iDRAC9 サーバーで Ansible を使用して起動するにはどうすればよいですか?

私がやろうとしているのは、Ansible と Redfish を使用して CentOS をインストールするというプレイブックです。モジュールは使用せず、複数の Dell iDRAC9 サーバーに CentOS をインストールするのですが、1 つの問題が発生しています。

2) ISO がマウントされた後、サーバーは自動的に ISO ブート メニューに入りません。ISO をプライマリ ブート デバイスとして設定するタスクによってこれを実現しようとしています。

誰かこれを修正するのを手伝ってくれませんか?

コードは次のとおりです:

- hosts: Linux_OS_machine
  connection: local
  name: ULP image install
  gather_facts: false
  vars:
    ansible_python_interpreter: /usr/bin/env python
    datatype: SetBiosAttributes
    image: "{{ iso_version }}-{{ inventory_hostname }}.iso"

  tasks:
    - name: Check system power state
      uri:
        url: https://{{ idrac }}/redfish/v1/Systems/System.Embedded.1
        user: "{{ idrac_user }}"
        password: "{{ idrac_pass }}"
        method: GET
        validate_certs: false
        force_basic_auth: yes
        return_content: yes
      register: system_status

    - name: Power on system if off
      when: system_status.json.PowerState == "Off"
      uri:
        url: https://{{ idrac }}/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset/
        user: "{{ idrac_user }}"
        password: "{{ idrac_pass }}"
        method: POST
        body:
          ResetType: PushPowerButton  # Set ResetType to PushPowerButton for system poweron
        validate_certs: false
        force_basic_auth: yes
        status_code: 204
        body_format: json
      register: poweron_status

    - name: Check if virtual media is mounted
      uri:
        url: https://{{ idrac }}/redfish/v1/Managers/iDRAC.Embedded.1/VirtualMedia/CD
        user: "{{ idrac_user }}"
        password: "{{ idrac_pass }}"
        method: GET
        validate_certs: false
        force_basic_auth: yes
        return_content: yes
      register: vm_status

    - name: Unmount virtual media if mounted
      uri:
        url: https://{{ idrac }}/redfish/v1/Managers/iDRAC.Embedded.1/VirtualMedia/CD/Actions/VirtualMedia.EjectMedia
        method: POST
        user: "{{ idrac_user }}"
        password: "{{ idrac_pass }}"
        validate_certs: false
        force_basic_auth: yes
        status_code: 204
        body_format: json
      vars:
        image: "{{ iso_version }}-{{ inventory_hostname }}.iso"
      when:
        - vm_status.json.ConnectedVia == "VirtualMedia"
        - vm_status.json.Status != "NotConnected"
        - vm_status.json.Image != image

    - name: Mount virtual media if not already mounted
      uri:
        url: https://{{ idrac }}/redfish/v1/Managers/iDRAC.Embedded.1/VirtualMedia/CD/Actions/VirtualMedia.InsertMedia
        method: POST
        headers:
          Authorization: Basic {{ (idrac_user + ':' + idrac_pass) | b64encode }}
        user: "{{ idrac_user }}"
        password: "{{ idrac_pass }}"
        validate_certs: false
        force_basic_auth: yes
        status_code: [200, 204]
        body_format: json
        body:
          Image: ""
      vars:
        image: "{{ iso_version }}-{{ inventory_hostname }}.iso"
      register: mount_media
      when:
        - vm_status.json.ConnectedVia == "NotConnected"

    - name: Set ISO as primary boot device
      uri:
        url: https://{{ idrac }}/redfish/v1/Systems/System.Embedded.1
        method: PATCH
        headers:
          Authorization: Basic {{ (idrac_user + ':' + idrac_pass) | b64encode }}
          Content-Type: application/json
        user: "{{ idrac_user }}"
        password: "{{ idrac_pass }}"
        validate_certs: false
        force_basic_auth: yes
        status_code: [200, 204]
        body_format: json
        body:
          Boot:
            BootSourceOverrideTarget: Cd
            BootSourceOverrideEnabled: Once
            BootSourceOverrideSupported: ["None", "Cd", "Floppy", "Hdd", "Usb", "Pxe", "BiosSetup", "Utilities", "Diags", "SDCard", "UefiShell"]
            BootSourceOverrideMode: Legacy
            [email protected]: "#ComputerSystem.BootSource"


    - name: Reboot the system
      uri:
        url: https://{{ idrac }}/redfish/v1/Systems/System.Embedded.1/Actions/ComputerSystem.Reset/
        user: "{{ idrac_user }}"
        password: "{{ idrac_pass }}"
        method: POST
        body:
          ResetType: ForceRestart
        validate_certs: false
        force_basic_auth: yes
        status_code: 204
        body_format: json


    - name: Display message during ULP image installation
      debug:
        msg: "ULP image installation in progress. Please wait."



    - name: Wait for system to boot up
      wait_for:
        port: 22
        host: "{{ inventory_hostname }}"
        delay: 30
        timeout: 14400
        
    - name: Unmount ISO from server
      uri:
        url: https://{{ idrac }}/redfish/v1/Managers/iDRAC.Embedded.1/VirtualMedia/CD/Actions/VirtualMedia.EjectMedia
        method: POST
        user: "{{ idrac_user }}"
        password: "{{ idrac_pass }}"
        validate_certs: false
        force_basic_auth: yes
        status_code: 204
        body_format: json
      when: inventory_hostname in groups['Linux_OS_machine'] and "linux" in ansible_facts['os_family']

答え1

dellemc.openmanage コレクションを使用して、iDRAC9 への OS 展開を実現できました。Ansible Galaxy コマンドを使用してコレクションを追加し、プレイブックから dellemc.openmanage.idrac_os_deployment ロールをインポートします。 https://github.com/dell/dellemc-openmanage-ansible-modules/blob/collections/playbooks/idrac/idrac_os_deployment.yml

まだわからない場合は、プロジェクトをGitlabに入れて、何をすべきかのアイデアをお伝えします。お知らせください。

関連情報