0

In ansible, I try to automate setting up a database in mysql. But I block in the first step, I try to run run this command line

$ mysql_config_editor set login-path=test --host=localhost --user=username --password

And, what I want to do is something that looks like that

$ mysql_config_editor set login-path=test --host=localhost --user=username --password={{password}}

but that does not work. I tried a lot of things including

Ansible - Control commands when need users input when executing

and

Pass password to mysql_config_editor using variable in shell

but they do not work, do you have an idea ? It will be very helpful for me

tlo
  • 1,571
  • 1
  • 25
  • 38
victorfau
  • 45
  • 1
  • 4
  • 18
  • did u try what the 2nd thread suggested? `echo '{{password}}' | unbuffer -p mysql_config_editor set --login-path=testtttttt --host=localhost --user=username --password` ? – ilias-sp Jan 29 '19 at 16:34
  • I try this with that task ```- name: long shell script shell: | " echo {{password}}" | unbuffer -p mysql_config_editor set --login-path=testtttttt --host=localhost --user=username --password args: executable: /bin/bash tags: test ``` and it return this error : ```unbuffer: not found\n/bin/sh: 1 ``` – victorfau Jan 29 '19 at 16:54
  • its because ur linux distro doesnt have it. in my fedora unbuffer is part of the expect rpm, please install unbuffer and it will work for you. – ilias-sp Jan 29 '19 at 17:02
  • I still have the same error, but I find an other to do the same thing with jenkins. Thank you for your help. :) – victorfau Jan 29 '19 at 17:13
  • the error you have is `unbuffer: not found`, and clearly you are missing this binary, not sure how to obtain it in your setup, in fedora its in `expect` rpm. anyway, glad you managed things! – ilias-sp Jan 29 '19 at 17:26

0 Answers0