Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Password generation #10

Open
cimbalo opened this issue Aug 15, 2016 · 3 comments
Open

Password generation #10

cimbalo opened this issue Aug 15, 2016 · 3 comments
Assignees

Comments

@cimbalo
Copy link
Contributor

cimbalo commented Aug 15, 2016

Instead of using library/gen_passwd.py we can generate a password using lookup

- name: read password
  set_fact:
    password: "{{ lookup('password') }}"

Then save it to a remote file using shell and echo redirection and after read the file with shell and cat command (or we can find better option than using shell module).

@edoput
Copy link
Member

edoput commented Aug 16, 2016

A little more context lookup. It generate a random password and save it to a file on the remote local

- name:  assign password
  set_fact:
    password: "{{ lookup('password', '/path/to/local/file') }}"

the use the password variable in our playbook. If the file does not exist it creates a password and fill the file, otherwise it reads the password from the file.

Edit: the file is local not remote

@edoput
Copy link
Member

edoput commented Aug 17, 2016

Right now we are generating a password every time we connect, this is because we can change it without restriction. I would like to keep it this way because storing password in a local file means another level of syncronisation (between us, the humans) . I can't execute the same playbook A on machine vm_A unless you share the password file.

@cimbalo
Copy link
Contributor Author

cimbalo commented Aug 17, 2016

I wrote a sample idempot task to read or generate a password on the remote.

Note:
Require the password file path (variable password_path) and set the variable password as result.
Still use library/gen_passwd.py because lookup password fail if no path is supplied.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants