Use ansible expect task instead of expect command
Change-Id: Iba56ceb85278563d00a0cb3f019a9097c06a2066
This commit is contained in:
parent
7e610873a9
commit
ad607397a4
|
@ -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
|
|
|
@ -70,23 +70,17 @@
|
||||||
- "'Command Result : No Error' not in result.stdout"
|
- "'Command Result : No Error' not in result.stdout"
|
||||||
- "'The member you specified is already part of an' 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
|
- name: Check the HA group
|
||||||
shell: |
|
expect:
|
||||||
/usr/safenet/lunaclient/bin/list-ha-groups
|
command: /usr/safenet/lunaclient/bin/lunacm -c hagroup listgroups
|
||||||
|
responses:
|
||||||
|
password: "\r"
|
||||||
register: result
|
register: result
|
||||||
failed_when: "'Command Result : No Error' not in result.stdout"
|
failed_when: "'Command Result : No Error' not in result.stdout"
|
||||||
|
|
||||||
- name: Register the HA Slot ID
|
- name: Register the HA Slot ID
|
||||||
shell: |
|
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
|
register: ha_slot
|
||||||
|
|
||||||
- debug:
|
- debug:
|
||||||
|
|
Loading…
Reference in New Issue