palvarez89

Untitled

Jul 14th, 2014
262
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.39 KB | None | 0 0
  1. /usr/lib/trove-setup/ansible/test # cat hosts
  2. localhost ansible_connection=local
  3. /usr/lib/trove-setup/ansible/test # cat test.yml
  4. ---
  5. - hosts: localhost
  6. tasks:
  7. - set_fact: TROVE_ID=example-trove
  8. - shell: |
  9. cat /etc/ssh/ssh_host_*_key.pub | cut -d\ -f1,2 | \
  10. sed -e's/^/'{{ TROVE_ID|regex_replace('(\\W)', '\\\\\\1')|quote }}',localhost /' > \
  11. /root/output
  12. creates=/root/output
  13.  
  14. /usr/lib/trove-setup/ansible/test # ansible-playbook -vi hosts test.yml
  15.  
  16. PLAY [localhost] **************************************************************
  17.  
  18. GATHERING FACTS ***************************************************************
  19. ok: [localhost]
  20.  
  21. TASK: [set_fact TROVE_ID=example-trove] ***************************************
  22. ok: [localhost] => {"ansible_facts": {"TROVE_ID": "example-trove"}}
  23. ERROR: an unexpected type error occured. Error was expected string or buffer
  24.  
  25. ##################################
  26. ##################################
  27.  
  28.  
  29. /usr/lib/trove-setup/ansible/test # cat test2.yml
  30. ---
  31. - hosts: localhost
  32. tasks:
  33. - set_fact: TROVE_ID=example-trove
  34. - shell: |
  35. cat /etc/ssh/ssh_host_*_key.pub | cut -d\ -f1,2 | \
  36. sed -e's/^/'{{ TROVE_ID|quote }}',localhost /' > \
  37. /root/output
  38.  
  39.  
  40. /usr/lib/trove-setup/ansible/test # ansible-playbook -vi hosts test2.yml
  41.  
  42. PLAY [localhost] **************************************************************
  43.  
  44. GATHERING FACTS ***************************************************************
  45. ok: [localhost]
  46.  
  47. TASK: [set_fact TROVE_ID=example-trove] ***************************************
  48. ok: [localhost] => {"ansible_facts": {"TROVE_ID": "example-trove"}}
  49.  
  50. TASK: [shell cat /etc/ssh/ssh_host_*_key.pub | cut -d\ -f1,2 | \
  51. sed -e's/^/'{{TROVE_ID|quote}}',localhost /' > \
  52. /root/output
  53. creates=/root/output
  54. ] ***
  55. changed: [localhost] => {"changed": true, "cmd": "cat /etc/ssh/ssh_host_*_key.pub | cut -d\\ -f1,2 | \\\nsed -e's/^/'example-trove',localhost /' > \\\n/root/output ", "delta": "0:00:00.003124", "end": "2014-07-14 12:10:43.522656", "rc": 0, "start": "2014-07-14 12:10:43.519532", "stderr": "", "stdout": ""}
  56.  
  57. PLAY RECAP ********************************************************************
  58. localhost : ok=3 changed=1 unreachable=0 failed=0
  59.  
  60. /usr/lib/trove-setup/ansible/test # rm /root/output
  61.  
  62. ################################
  63. ################################
  64.  
  65. /usr/lib/trove-setup/ansible/test # ansible-playbook -vi hosts test3.yml
  66.  
  67. PLAY [localhost] **************************************************************
  68.  
  69. GATHERING FACTS ***************************************************************
  70. ok: [localhost]
  71.  
  72. TASK: [set_fact TROVE_ID=example-trove] ***************************************
  73. ok: [localhost] => {"ansible_facts": {"TROVE_ID": "example-trove"}}
  74.  
  75. TASK: [With a name it doesn't crash] ******************************************
  76. changed: [localhost] => {"changed": true, "cmd": "cat /etc/ssh/ssh_host_*_key.pub | cut -d\\ -f1,2 | \\\nsed -e's/^/''example\\-trove'',localhost /' > \\\n/root/output ", "delta": "0:00:00.003102", "end": "2014-07-14 12:10:52.338362", "rc": 0, "start": "2014-07-14 12:10:52.335260", "stderr": "", "stdout": ""}
  77.  
  78. PLAY RECAP ********************************************************************
  79. localhost : ok=3 changed=1 unreachable=0 failed=0
Advertisement
Add Comment
Please, Sign In to add comment