I am trying to run this script:
/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
When I run it without Ansible I get this:
This script will enable the PostgreSQL APT repository on apt.postgresql.org on
your system. The distribution codename used will be focal-pgdg.
Press Enter to continue, or Ctrl-C to abort.
I tried this and some other variations on this.
- name: 2) Run the PostgreSQL repository setup script
become: yes
expect:
command: /usr/share/postgresql-common/pgdg/apt.postgresql.org.sh
responses:
Question:
- This script will enable the PostgreSQL APT repository on apt.postgresql.org on
- your system. The distribution codename used will be focal-pgdg.
-
- Press Enter to continue, or Ctrl-C to abort.: echo -e '\n\n'
timeout: 30
Output:
fatal: [eos-test2]: FAILED! => {
"ansible_facts": {
"discovered_interpreter_python": "/usr/bin/python3"
},
"changed": true,
"cmd": "/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh",
"delta": "0:00:30.137319",
"end": "2022-10-06 14:09:16.421921",
"invocation": {
"module_args": {
"chdir": null,
"command": "/usr/share/postgresql-common/pgdg/apt.postgresql.org.sh",
"creates": null,
"echo": false,
"removes": null,
"responses": {
"Question": [
"This script will enable the PostgreSQL APT repository on apt.postgresql.org on",
"your system. The distribution codename used will be focal-pgdg.",
null,
{
"Press Enter to continue, or Ctrl-C to abort.": "echo -e '\\n\\n'"
}
]
},
"timeout": 30
}
},
"msg": "command exceeded timeout",
"rc": null,
"start": "2022-10-06 14:08:46.284602",
"stdout": "This script will enable the PostgreSQL APT repository on apt.postgresql.org on\r\nyour system. The distribution codename used will be focal-pgdg.\r\n\r\nPress Enter to continue, or Ctrl-C to abort.",
"stdout_lines": [
"This script will enable the PostgreSQL APT repository on apt.postgresql.org on",
"your system. The distribution codename used will be focal-pgdg.",
"",
"Press Enter to continue, or Ctrl-C to abort."
]
}
The script itself has
if [ -z "${YES:-}" ]; then
echo -n "Press Enter to continue, or Ctrl-C to abort."
read enter
echo
fi
I was thinking of modifying the original script.
Any suggestions?
Thank you in advance.