2017-11-08 4 views
1

sshキーを設定せずにanonymousを使用しようとしています。私はユーザー名とパスワードでログインしたい。私はマスターsshpassにインストールしました。sshキーなしでanonymousを使用する方法 - getpwnam()MODULE FAILURE

マイディレクトリレイアウトは次のようになります。

ansible.cfg 
inventory/ 
    hosts 
    group_vars/ 
     all.yaml 
roles 
    whoami/ 
     tasks/ 
      main.yaml 
site.yaml 

ansible.cfg:

[defaults] 
host_key_checking = false 
inventory = inventory 

在庫/ホスト:

[defaults] 
machine 

在庫/ group_vars/all.yaml:

--- 
# file: group_vars/all 
ansible_user: username 
ansible_password: password 

main.yaml:

--- 

- name: whoami 
    shell: whoami 

site.yaml:

--- 
- hosts: machine 
    roles: 
     - whoami 

私はを実行場合:

$ansible machine -i inventory/ -m shell -a "whoami" 

それが正常を実行されます。

machine | SUCCESS | rc=0 >> 
username 

のに対し、私は実行場合:

fatal: [machine]: FAILED! => { 
"changed": false, 
"failed": true, 
"invocation": { 
    "module_name": "setup" 
}, 
"module_stderr": "OpenSSH_7.4p1 Debian-10+deb9u1, OpenSSL 1.0.2l 25 May 2017\r\ndebug1: Reading configuration data /etc/ssh/ssh_config\r\ndebug1: /etc/ssh/ssh_config line 19: Applying options for *\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O_NONBLOCK\r\ndebug2: mux_client_hello_exchange: master version 4\r\ndebug3: mux_client_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux_client_request_session: entering\r\ndebug3: mux_client_request_alive: entering\r\ndebug3: mux_client_request_alive: done pid = 2908\r\ndebug3: mux_client_request_session: session request sent\r\ndebug1: mux_client_request_session: master session id: 2\r\ndebug3: mux_client_read_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to machine closed.\r\n", 
"module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_QAFcSD/ansible_module_setup.py\", line 134, in <module>\r\n main()\r\n File \"/tmp/ansible_QAFcSD/ansible_module_setup.py\", line 126, in main\r\n data = get_all_facts(module)\r\n File \"/tmp/ansible_QAFcSD/ansible_modlib.zip/ansible/module_utils/facts.py\", line 3518, in get_all_facts\r\n File \"/tmp/ansible_QAFcSD/ansible_modlib.zip/ansible/module_utils/facts.py\", line 3457, in ansible_facts\r\n File \"/tmp/ansible_QAFcSD/ansible_modlib.zip/ansible/module_utils/facts.py\", line 171, in __init__\r\n File \"/tmp/ansible_QAFcSD/ansible_modlib.zip/ansible/module_utils/facts.py\", line 513, in get_user_facts\r\nKeyError: 'getpwnam(): name not found: username'\r\n", "msg": "MODULE FAILURE" 
} 
    to retry, use: --limit @/home/username/playbook/my_ansible/site.retry 

PLAY RECAP ********************************************************************* 
machine      : ok=0 changed=0 unreachable=0 failed=1 
+1

現在のバージョンを使用するのはどうですか? '無能なプレイブック'は、 '無能な'が実行しない事実を収集することに失敗する。過去には、[search GitHub](https://github.com/ansible/ansible/issues/17029)という問題がありました。事実収集の部分はすべて以来書き直されてきました。私は古いバージョンに対処する点を見ていない。 – techraf

+0

私はこのバグの影響を受けると思われるバージョン2.2.1.0を実行していました。バージョン2にアップグレードすると2.4.1.0にアップデートされ、スムーズに動作します。ありがとう。 – gaetano

答えて

2

I:

$ansible-playbook -i inventory site.yml -v 

私はこれを取得このバグGitHubの影響を受けるバージョン2.2.1.0を実行していました。バージョン2. 4.1.0にアップグレードしました:

$pip install ansible 

スムーズに動作します。

ありがとうございましたtechraf

関連する問題