diff --git a/files/list-ha-groups b/files/list-ha-groups deleted file mode 100755 index a7ff9e2..0000000 --- a/files/list-ha-groups +++ /dev/null @@ -1,18 +0,0 @@ -#!/usr/bin/expect -f - -set force_conservative 0 ;# set to 1 to force conservative mode even if - ;# script wasn't run conservatively originally -if {$force_conservative} { - set send_slow {1 .1} - proc send {ignore arg} { - sleep .1 - exp_send -s -- $arg - } -} - -set timeout -1 -spawn /usr/safenet/lunaclient/bin/lunacm -c hagroup listgroups -match_max 100000 -expect " Enter the password: " -send -- "\r" -expect eof diff --git a/tasks/main.yaml b/tasks/main.yaml index 44c72cd..3035829 100644 --- a/tasks/main.yaml +++ b/tasks/main.yaml @@ -70,23 +70,17 @@ - "'Command Result : No Error' not in result.stdout" - "'The member you specified is already part of an' not in result.stdout" - - name: Copy expect script to check HA status - copy: - src: list-ha-groups.j2 - dest: /usr/safenet/lunaclient/bin/list-ha-groups - owner: root - group: root - mode: 0755 - - name: Check the HA group - shell: | - /usr/safenet/lunaclient/bin/list-ha-groups + expect: + command: /usr/safenet/lunaclient/bin/lunacm -c hagroup listgroups + responses: + password: "\r" register: result failed_when: "'Command Result : No Error' not in result.stdout" - name: Register the HA Slot ID shell: | - set -o pipefail && /usr/safenet/lunaclient/bin/list-ha-groups | grep 'HA Group Slot ID' | awk '{ print $NF }' + set -o pipefail && echo "{{ result.stdout }}" | grep 'HA Group Slot ID' | awk '{ print $NF }' register: ha_slot - debug: