D
D
DenZel2020-02-20 21:43:50
linux
DenZel, 2020-02-20 21:43:50

How to automate interactive unloading of value from terminal using Ansible?

Hello!
The following problematic question was asked:
in the terminal, when creating a hash password, you need to enter the resulting value that is issued in the terminal into a file, then remove extra characters in the file, and use it in the future.
tell me how to do this with ansible. Which module is suitable for this and with what parameters. As I understand it, expect is used for interactive input, but how can I use it to redirect terminal output to a file?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sanes, 2020-02-20
@gen4_gdm

put it in a variable
register:
and in the same place (in the playbook) you can edit it without redirecting it to a file
Like this

tasks: 
    - name: 'Pwgen Username Password'
      command: pwgen 12 1
      register: userpass

Next, we use the variable{{ userpass }}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question