1
Ich habe ein Python-Skript, das einen Hashwert ausgibt. Ich möchte, dass dieser Hash in meine Variable innerhalb des ansible-Skripts geleitet wird.Piping einer Python-Ausgabe in eine Ansible-Variable
Der Python-Befehl sieht aus wie this-
#!/bin/python
import crypt
test= crypt.crypt('test', '[email protected]$')
print test
Mein ansible Textbuch wie folgt aussieht -
hosts: webservers
remote_user: test
become: yes
become_method: sudo
vars:
pass:
tasks:
- name: Run Python Password script
command: /home/test/userPW.py > pass
Dank
Siehe https://serverfault.com/questions/537060/how-to-see-stdout-of-ansible-commands. Siehe auch https://meta.stackoverflow.com/questions/294923/are-ansible-puppet-chef-salt-questions-on-topic – sashoalm