Hi all,

The  section of the playbook that I am experiencing a failure 
(authenication failure) on is as follows:
- name: Enable passwordless connection as hdfs user to namenode host
  authorized_key: user=hdfs key="{{ lookup('file', '~/.ssh/id_rsa.pub') }}"
  when: action == "format_hdfs" and "{{ ansible_hostname }}" in "{{ 
groups['hadoop_namenodes'] }}"
  tags: formathdfs

- name: Format HDFS on namenode
  remote_user: hdfs
  shell: source ~/.profile && {{ install_directory }}/hadoop/bin/hdfs 
namenode -format -force
  args:
     executable: /bin/bash
  when: action == "format_hdfs" and "{{ ansible_hostname }}" in "{{ 
groups['hadoop_namenodes'] }}"
  tags: formathdfs

When I run the playbook as 'root' I get a failure, even though I have set 
the failing task's "remote_user" to the appropriate user, and have (in the 
prior task) done a SSH key exchange for that user...
ansible-playbook -u root -k -i test hadoop-site.yml --tags=formathdfs --
limit=hadoop-test1
[...]
PLAY [hadoop_namenodes] 
******************************************************* 

GATHERING FACTS 
*************************************************************** 
ok: [hadoop-test1]

TASK: [do-hadoop | Enable passwordless connection as hdfs user to namenode 
host] *** 
ok: [hadoop-test1]

TASK: [do-hadoop | Format HDFS on namenode] 
*********************************** 
fatal: [hadoop-test1] => Authentication failure.

FATAL: all hosts have already failed -- aborting

PLAY RECAP 
******************************************************************** 
           to retry, use: --limit @/home/will/hadoop-site.retry

hadoop-test1               : ok=4    changed=0    unreachable=1    failed=0 
  


However, if I run playbook as the user that needs to perform the failing 
step ('hdfs'), it works...
ansible-playbook -u hdfs -i test hadoop-site.yml --tags=formathdfs --limit=
hadoop-test1
[...]
PLAY [hadoop_namenodes] 
******************************************************* 

GATHERING FACTS 
*************************************************************** 
ok: [hadoop-test1]

TASK: [do-hadoop | Enable passwordless connection as hdfs user to namenode 
host] *** 
ok: [hadoop-test1]

TASK: [do-hadoop | Format HDFS on namenode] 
*********************************** 
changed: [hadoop-test1]

PLAY RECAP 
******************************************************************** 
hadoop-test1               : ok=5    changed=1    unreachable=0    failed=0 
  

Can someone explain to me why the first case is failing, and how I could 
get it to work?

Thanks,
Will

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/425da48b-439c-44bb-95e7-38c77eab795a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to