ricsanfre.iscsi_target

Rola Ansible: iSCSI Target

Ta rola konfiguruje oparty na Linux-LIO cel iSCSI na hoście z systemem Linux za pomocą targetcli.

Dodatkowo rola zawiera własne moduły Python do interakcji z poleceniem targetcli, które mogą być używane osobno do bardziej zaawansowanych zadań. Moduły implementują sprawdzanie, tworzenie i usuwanie.

UWAGA: Dokumentacja dotycząca LIO i Target jest dostępna tutaj.

Wymagania

Ta rola nie tworzy żadnych dysków, partycji ani LV. Oczekuje się, że są one już obecne na maszynie lub utworzone przez inną rolę. Na przykład: ricsanfre.storage

Zmienne Roli

Aby skonfigurować cel iSCSI, używana jest poniższa zagnieżdżona zmienna, która definiuje, jak powinna wyglądać konfiguracja.

iscsi_targets:
  - name: "iqn.2021-07.com.ricsanfre:target_server"
    disks:
      - name: lun_node1
        path: /dev/vg_iscsi/vg_iscsi_lv_node1
        type: block
        lunid: 0
      - name: lun_node2
        path: /dev/vg_iscsi/vg_iscsi_lv_node2
        type: block
        lunid: 1
      - name: lun_node3
        path: /dev/vg_iscsi/vg_iscsi_lv_node3
        type: block
        lunid: 2
      - name: lun_node4
        path: /dev/vg_iscsi/vg_iscsi_lv_node4
        type: block
        lunid: 3
    initiators:
      - name: iqn.2021-07.com.ricsanfre:node1
        authentication:
          userid: node1
          password: passwd1
          userid_mutual: sharedkey
          password_mutual: sharedsecret
        mapped_luns:
          - mapped_lunid: 0
            lunid: 0
          - mapped_lunid: 1
            lunid: 2
      - name: iqn.2021-07.com.ricsanfre:node2
        authentication:
          userid: node2
          password: passwd2
        mapped_luns:
          - mapped_lunid: 0
            lunid: 1
          - mapped_lunid: 1
            lunid: 3
            write_protect: 1
    portals:
      - ip: 192.168.1.45
        port: 5555
      - ip: 192.168.2.10

Zależności

Brak.

Przykład Playbooka

Ten przykład używa roli ricsanfre.storage do tworzenia logicznych wolumenów potrzebnych do skonfigurowania celu iSCSI.

- hosts: all
  become: true
  gather_facts: true
  vars:
    storage_partitions:
      - name: /dev/vdb
        number: 1
        flags:
          - lvm
        part_end: 1GB
    storage_volumegroups:
      - name: vg_iscsi
        devices:
          - /dev/vdb1
    storage_volumes:
      - name: vg_iscsi_lv_node1
        vg: vg_iscsi
        size: 100
      - name: vg_iscsi_lv_node2
        vg: vg_iscsi
        size: 100
      - name: vg_iscsi_lv_node3
        vg: vg_iscsi
        size: 100
      - name: vg_iscsi_lv_node4
        vg: vg_iscsi
        size: 100
    iscsi_targets:
      - name: "iqn.2021-07.com.ricsanfre:{{ ansible_facts['nodename'] }}"
        disks:
          - name: lun_node1
            path: /dev/vg_iscsi/vg_iscsi_lv_node1
            type: block
            lunid: 0
          - name: lun_node2
            path: /dev/vg_iscsi/vg_iscsi_lv_node2
            type: block
            lunid: 1
          - name: lun_node3
            path: /dev/vg_iscsi/vg_iscsi_lv_node3
            type: block
            lunid: 2
          - name: lun_node4
            path: /dev/vg_iscsi/vg_iscsi_lv_node4
            type: block
            lunid: 3
        initiators:
          - name: iqn.2021-07.com.ricsanfre:node1
            authentication:
              userid: node1
              password: passwd1
            mapped_luns:
              - mapped_lunid: 0
                lunid: 0
              - mapped_lunid: 1
                lunid: 2
          - name: iqn.2021-07.com.ricsanfre:node2
            authentication:
              userid: node2
              password: passwd2
            mapped_luns:
              - mapped_lunid: 0
                lunid: 1
              - mapped_lunid: 1
                lunid: 3
                write_protect: 1
        portals:
          - ip: "{{ ansible_default_ipv4.address | default(ansible_all_ipv4_addresses[0]) }}"

  roles:
    - ricsanfre.storage
    - ricsanfre.iscsi_target

Licencja

MIT/BSD

Informacje o autorze

Stworzono przez Ricardo Sancheza (ricsanfre) na podstawie rozwoju targetcli od Ondreja Famery ondrej-xa2iel8u@famera.cz

O projekcie

Configure iSCSI Target role

Zainstaluj
ansible-galaxy install ricsanfre.iscsi_target
Licencja
mit
Pobrania
8k
Właściciel
Telecom engineer.