Ho scritto un playbook che installa e configura Google Authenticator per utente.
Voglio l'ultimo passaggio del playbook al cat
file di configurazione google_authenticator.
Utilizzando il modulo "debug" sono in grado di visualizzare i dati sullo schermo ma solo come messaggio di debug:
TASK: [debug var=details.stdout_lines] ****************************************
ok: [localhost] => {
"details.stdout_lines": [
"ZKMFTE2ADYA2OYCH",
"\"RATE_LIMIT 3 30",
"\" DISALLOW_REUSE",
"\" TOTP_AUTH",
"12920994",
"88224784",
"69464205",
"38144121",
"45634120"
]
}
Ho letto online che posso fare qualcosa del genere:
- name: Print to screen google authenticator details
command: /bin/cat {{ google_authenticator_secret_file_location }}
register: details
tags: google_2fa_user
- debug: msg="{{ details.stdout_lines }}"
Ma ricevo un errore quando lo eseguo:
TASK: [Print to screen google authenticator details] **************************
changed: [localhost]
TASK: [debug msg="{{details.stdout_lines}}"] **********************************
fatal: [localhost] => Traceback (most recent call last):
File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 532, in _executor
exec_rc = self._executor_internal(host, new_stdin)
File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 629, in _executor_internal
return self._executor_internal_inner(host, self.module_name, self.module_args, inject, port, complex_args=complex_args)
File "/usr/lib/python2.7/dist-packages/ansible/runner/__init__.py", line 815, in _executor_internal_inner
result = handler.run(conn, tmp, module_name, module_args, inject, complex_args)
File "/usr/lib/python2.7/dist-packages/ansible/runner/action_plugins/debug.py", line 41, in run
kv = utils.parse_kv(module_args)
File "/usr/lib/python2.7/dist-packages/ansible/utils/__init__.py", line 526, in parse_kv
vargs = [x.decode('utf-8') for x in shlex.split(args, posix=True)]
File "/usr/lib/python2.7/shlex.py", line 279, in split
return list(lex)
File "/usr/lib/python2.7/shlex.py", line 269, in next
token = self.get_token()
File "/usr/lib/python2.7/shlex.py", line 96, in get_token
raw = self.read_token()
File "/usr/lib/python2.7/shlex.py", line 172, in read_token
raise ValueError, "No closing quotation"
ValueError: No closing quotation
FATAL: all hosts have already failed -- aborting
PLAY RECAP ********************************************************************
L'errore dice: "Nessuna quotazione di chiusura" sebbene sia quotata. Ho anche provato:
- debug: msg= "{{ details.stdout_lines }}"
Qualche idea di quale potrebbe essere il problema?