Does anyone know if iris merge can be called from Ansible. I have tried a couple of ways, but it doesn't seem to actually run the command on the target even though Ansible outputs it was successful.
Ansible Play:
- name: Install Iris
hosts: "{{ host_group }}"
serial: 1
remote_user: cotelmer
gather_facts: yes
vars:
- instance_type: "{{ inst_type }}"
roles:
- disable_new_bus_rule_editor
Ansible task:
- name: Run iris merge to disable application
ansible.builtin.shell: |
set timout 15
spawn bash -c "iris merge {{ item }}{{ hostvars[inventory_hostname].env }}{{ hostvars[inventory_hostname].failover_member_id }} /WORK/{{ item }}/deploy/cpf_merge_files/all_disable_application.mergefile /{{ item }}/{{ item }}{{ hostvars[inventory_hostname].env }}{{ hostvars[inventory_hostname].failover_member_id }}/iris.cpf"
expect "Username: "
send "hsadmin\n"
expect "Password: "
send "{{ pwd }}"
expect eof
args:
executable: /usr/bin/expect
with_items:
- "{{ instance_type }}"
register: iris_merge_output # Capture the output from the module
changed_when: iris_merge_output != 0 # <- Uses the return code to define when the task has changed.
- name: printing iris_output
ansible.builtin.debug:
var: iris_merge_output
Output of task:
changed: [lp-itfuat04] => (item=CLIN) => {
"ansible_loop_var": "item",
"changed": true,
"cmd": "set timout 15\nspawn bash -c \nsend \"iris merge CLINUAT04 /WORK/CLIN/deploy/cpf_merge_files/all_disable_application.mergefile /CLIN/CLINUAT04/iris.cpf\"\nexpect \"Username: \"\nsend \"hsadmin\\n\"\nexpect \"Password: \"\nsend \" \"\nexpect eof\n",
"delta": "0:00:00.009829",
"end": "2025-03-19 11:39:45.088939",
"invocation": {
"module_args": {
"_raw_params": "set timout 15\nspawn bash -c \nsend \"iris merge CLINUAT04 /WORK/CLIN/deploy/cpf_merge_files/all_disable_application.mergefile /CLIN/CLINUAT04/iris.cpf\"\nexpect \"Username: \"\nsend \"hsadmin\\n\"\nexpect \"Password: \"\nsend \"Adm4uat14\"\nexpect eof\n",
"_uses_shell": true,
"argv": null,
"chdir": null,
"creates": null,
"executable": "/usr/bin/expect",
"removes": null,
"stdin": null,
"stdin_add_newline": true,
"strip_empty_ends": true,
"warn": true
}
},
"item": "CLIN",
"rc": 0,
"start": "2025-03-19 11:39:45.079110",
"stderr": "send: spawn id exp5 not open\n while executing\n\"send \"hsadmin\\n\"\"",
"stderr_lines": [
"send: spawn id exp5 not open",
" while executing",
"\"send \"hsadmin\\n\"\""
],
"stdout": "spawn bash -c\r\niris merge CLINUAT04 /WORK/CLIN/deploy/cpf_merge_files/all_disable_application.mergefile /CLIN/CLINUAT04/iris.cpfbash: -c: option requires an argument",
"stdout_lines": [
"spawn bash -c",
"iris merge CLINUAT04 /WORK/CLIN/deploy/cpf_merge_files/all_disable_application.mergefile /CLIN/CLINUAT04/iris.cpfbash: -c: option requires an argument"
]
}
Content of all_disable_application.mergefile:
[Actions]
ModifyApplication:Name=/ui/interop/rule-editor,Enabled=0