/test/integration/roles/test_fetch/tasks/main.yml

https://github.com/ajanthanm/ansible · YAML · 42 lines · 13 code · 10 blank · 19 comment · 0 complexity · 83a48dacf3559b406dd4326431d58a14 MD5 · raw file

  1. # test code for the pip module
  2. # (c) 2014, Michael DeHaan <michael.dehaan@gmail.com>
  3. # This file is part of Ansible
  4. #
  5. # Ansible is free software: you can redistribute it and/or modify
  6. # it under the terms of the GNU General Public License as published by
  7. # the Free Software Foundation, either version 3 of the License, or
  8. # (at your option) any later version.
  9. #
  10. # Ansible is distributed in the hope that it will be useful,
  11. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. # GNU General Public License for more details.
  14. #
  15. # You should have received a copy of the GNU General Public License
  16. # along with Ansible. If not, see <http://www.gnu.org/licenses/>.
  17. - name: create a file that we can use to fetch
  18. copy: content="test" dest={{ output_dir }}/orig
  19. - name: fetch the motd
  20. fetch: src={{ output_dir }}/orig dest={{ output_dir }}/fetched
  21. register: fetched
  22. - debug: var=fetched
  23. # TODO: check the sudo and non-sudo forms of fetch because in one form we'll do
  24. # the get method of the connection plugin and in the sudo case we'll use the
  25. # fetch module.
  26. - name: diff what we fetched with the original file
  27. shell: diff {{ output_dir }}/orig {{ output_dir }}/fetched/127.0.0.1{{ output_dir | expanduser }}/orig
  28. register: diff
  29. - name: check the diff to make sure they are the same
  30. assert:
  31. that:
  32. 'diff.stdout == ""'