Trying to get the expect module to configure a Jira set-up - the module seems to work until the question is repeated - essentially the last two entires.
See the script questions below (With redacted data)
----------------------
JIRA Configurator v1.1
----------------------
--- Main Menu ---
[H] Configure JIRA Home
[D] Database Selection
[W] Web Server (incl. HTTP/HTTPs configuration)
[A] Advanced Settings
[S] Save and Exit
[X] Exit without Saving
Main Menu> D
--- Database Selection ---
Database Type : H2
Instance : (unused)
Connect As : sa / (no password)
* [H] H2 (not for production use)
[M] MySQL 8.0
[N] MySQL 5.7
[O] Oracle
[P] PostgreSQL
[A] Aurora PostgreSQL 9.6 (DC Only)
[S] SQL Server (MS-SQL)
[X] Return to Main Menu
Database Selection [H]> M
MySQL 8.0 Database Configuration.
Hostname (jira.company.com)>
Port (3306)>
Database (jiradb)>
Username (jirauser)>
Password ()>
Test Connection ([Y]/N)? > y
Attempting to connect to jira.company.com:3306/jiradb
Connection successful!
--- Database Selection ---
Database Type : MySQL 8.0
Instance : jira.company.com:3306/jiradb
Connect As : jirauser / *****
[H] H2 (not for production use)
* [M] MySQL 8.0
[N] MySQL 5.7
[O] Oracle
[P] PostgreSQL
[A] Aurora PostgreSQL 9.6 (DC Only)
[S] SQL Server (MS-SQL)
[X] Return to Main Menu
Database Selection [M]> X
--- Main Menu ---
[H] Configure JIRA Home
[D] Database Selection
[W] Web Server (incl. HTTP/HTTPs configuration)
[A] Advanced Settings
[S] Save and Exit
[X] Exit without Saving
Main Menu> S
Question Order with answers below: Main Menu: - D Database Selection [H]: - M Hostname: - jira.company.com Port: - 3306 Database: - jiradb Username: - jirauser Password: - Test Connection ([Y]/N)?: - Y Database Selection [M]: - X Main Menu>: - S The last two questions are where it fails - I have also tried to put the second response under the top questions and it fails as well. If you note - I tried to use some different notation to separate the questions and it did not recognize the differences.
Ansible code:
- name: Set-up DBCONFIG.XML
ansible.builtin.expect:
command: /opt/atlassian/jira/latest/bin/config.sh
responses:
Main Menu:
- D
Database Selection:
- M
Hostname:
- jira.company.com
Port:
- 3306
Database:
- jiradb
Username:
- jirauser
Password:
- <PW>
Test Connection ([Y]/N)?:
- Y
Return to Main Menu:
- X
Save and Exit:
- S
Error received by ansible:
The full traceback is:
File "/tmp/ansible_ansible.builtin.expect_payload_4tipe507/ansible_ansible.builtin.expect_payload.zip/ansible/modules/expect.py", line 130, in wrapped
fatal: [dc2-tl8-jira]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"chdir": null,
"command": "/opt/atlassian/jira/latest/bin/config.sh",
"creates": null,
"echo": false,
"removes": null,
"responses": {
"Database": [
"jiradb"
],
"Database Selection": [
"M"
],
"Hostname": [
"jira.company.com"
],
"Main Menu": [
"D"
],
"Password": [
"<PW>"
],
"Port": [
3306
],
"Return to Main Menu": [
"X"
],
"Save and Exit": [
"S"
],
"Test Connection ([Y]/N)?": [
"Y"
],
"Username": [
"jirauser"
]
},
"timeout": 30
}
},
"msg": "No remaining responses for 'Main Menu', output was 'b'\\r\\n [X] Exit without Saving\\r\\n\\r\\nMain Menu''"
}
How do you address and get the module to answer similar questions or the same question later in the sequence? As this seems to go through until it returns to previous questions and the module doesn't pull the next set of question/answers for the question? Just for clarity - I placed the other responses in the code as defined below and received the following error:
Example of adding the other responses and the error received:
- name: Set-up DBCONFIG.XML
ansible.builtin.expect:
command: /opt/atlassian/jira/latest/bin/config.sh
responses:
Main Menu:
- D
- S
Database Selection:
- M
- X
Hostname:
- jira.company.com
Port:
- 3306
Database:
- jiradb
Username:
- jirauser
Password:
- <PW>
Test Connection ([Y]/N)?:
- Y
error:
The full traceback is:
File "/tmp/ansible_ansible.builtin.expect_payload_rzouxmbc/ansible_ansible.builtin.expect_payload.zip/ansible/modules/expect.py", line 130, in wrapped
fatal: [dc2-tl8-jira]: FAILED! => {
"changed": false,
"invocation": {
"module_args": {
"chdir": null,
"command": "/opt/atlassian/jira/latest/bin/config.sh",
"creates": null,
"echo": false,
"removes": null,
"responses": {
"Database": [
"jiradb"
],
"Database Selection": [
"M",
"X"
],
"Hostname": [
"jira.company.com"
],
"Main Menu": [
"D",
"S"
],
"Password": [
"<PW>"
],
"Port": [
3306
],
"Test Connection ([Y]/N)?": [
"Y"
],
"Username": [
"jira-test"
]
},
"timeout": 30
}
},
"msg": "No remaining responses for 'Main Menu', output was 'b' Type : H2\\r\\n Instance : (unused)\\r\\n Connect As : sa / (no password)\\r\\n\\r\\n* [H] H2 (not for production use)\\r\\n [M] MySQL 8.0\\r\\n [N] MySQL 5.7\\r\\n [O] Oracle\\r\\n [P] PostgreSQL\\r\\n [A] Aurora PostgreSQL 9.6 (DC Only)\\r\\n [S] SQL Server (MS-SQL)\\r\\n\\r\\n [X] Return to Main Menu''"
}