I was setting up a little script that Anisble would call to create the "encrypted" login-path as seen here:
https://dev.mysql.com/doc/mysql-utilities/1.5/en/mysql-utils-intro-connspec-mylogin.cnf.html
I finally discovered there is a little program called "autoexpect" on my CentOS Linux system that will write it for me.
By entering in:
autoexpect <command>
...it goes through the questions the prompt is asking me and auto generates the script for me.
Thanks to this site:
https://likegeeks.com/expect-command/
Here is what it generated for me:
#!/bin/expect -f
set timeout -1
spawn mysql_config_editor set --login-path=/root/mypath --host=localhost --user=root --password
match_max 100000
expect -exact "Enter password: "
send -- "SuperSecurePassword\r"
expect -exact "\r
WARNING : '/root/mypath' path already exists and will be overwritten. \r
Continue? (Press y|Y for Yes, any other key for No) : "
send -- "y\r"
expect eof
This little script actually works for both creating the file the first time and replacing it. The first time you run it, the system won't actually generate the WARNING about being overwritten but since the script is expecting, it will exit with a complaint but it still finishes that part of the script as desired.