Roy
2015-07-13 14:58:13 UTC
Hi,
I was trying to write simple task in ansible to create HDFS user hone
directory if it's not exist. So following is the task I wrote
- name: create user home dir in HDFS
shell: shell: "hadoop fs -test -d /user/{{ item.name }} || (hadoop fs
-mkdir /user/{{ item.name }} && hadoop fs -chown {{ item.name }} /user/{{
item.name }})"
when: "'hdfsuser' in {{ item.groups }} and '{{ inventory_hostname }}' in
['hadoop-client01.dev.abc.com']"
with_items: ssh_users
remote_user: hdfs
tags:
- hadoop
But I want to make it more simplified by breaking the shell command into
two.
so is it possible to have conditional dependent two commands in one single
task.
or is there better way to do this ?
Thanks
I was trying to write simple task in ansible to create HDFS user hone
directory if it's not exist. So following is the task I wrote
- name: create user home dir in HDFS
shell: shell: "hadoop fs -test -d /user/{{ item.name }} || (hadoop fs
-mkdir /user/{{ item.name }} && hadoop fs -chown {{ item.name }} /user/{{
item.name }})"
when: "'hdfsuser' in {{ item.groups }} and '{{ inventory_hostname }}' in
['hadoop-client01.dev.abc.com']"
with_items: ssh_users
remote_user: hdfs
tags:
- hadoop
But I want to make it more simplified by breaking the shell command into
two.
so is it possible to have conditional dependent two commands in one single
task.
or is there better way to do this ?
Thanks
--
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/30983bf0-d5a5-44c1-a292-5d9af3dabdc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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 ansible-project+***@googlegroups.com.
To post to this group, send email to ansible-***@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/30983bf0-d5a5-44c1-a292-5d9af3dabdc6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.