| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- ---
- - name: Ensure /data_prod is mounted from serverc iSCSI target
- hosts: initiators
- become: true
- tasks:
- - name: the iSCSI initiator software is installed
- yum:
- name: #FIXME: install the required package
- state: present
- - name: the IQN is set for the initiator
- copy:
- #FIXME: set the initiator IQN to iqn.2014-06.com.example:servera
- dest: #FIXME#
- content: "#FIXME#=iqn.2014-06.com.example:{{ ansible_facts['hostname'] }}\n"
- mode: '644'
- owner: root
- group: root
- notify: restart iscsid
- # Forces the handler to run so that the iscsid service is restarted
- # and is aware of the new initiator IQN
- - meta: flush_handlers
- - name: the iSCSI target is discovered and available
- open_iscsi:
- #FIXME: discover and log into the target.
- # Target IQN: iqn.2014-06.com.example:rack1
- # Portal: 172.25.250.12 (port 3260)
- portal: #FIXME#
- port: #FIXME#
- target: #FIXME#
- discover: yes
- login: yes
- register: target
- - name: display the discovered devices
- debug:
- msg: The new device is {{ target['devicenodes'][0] }}
- - name: the new device is formatted and mounted under /data_prod
- include_role:
- name: rhel-system-roles.storage
- vars:
- #FIXME: mount target['devicenodes'][0] into /data_prod
- # If the device is not yet formatted in ext4, format it.
- # Use the proper mount option for an iSCSI disk.
- storage_volumes:
- - name: devdata
- state: present
- type: disk
- disks:
- - "{{ target['devicenodes'][0] }}"
- mount_point: #FIXME#
- fs_type: #FIXME#
- mount_options: #FIXME#
- handlers:
- - name: restart iscsid
- service:
- name: iscsid
- state: restarted
|