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

https://github.com/ajanthanm/ansible · YAML · 72 lines · 47 code · 9 blank · 16 comment · 0 complexity · e69dce1687189ff5c7727366c8a9d0e3 MD5 · raw file

  1. # test code for the raw module when using winrm connection
  2. # (c) 2014, Chris Church <chris@ninemoreminutes.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: run getmac
  18. raw: getmac
  19. register: getmac_result
  20. - name: assert that getmac ran
  21. assert:
  22. that:
  23. - "getmac_result.rc == 0"
  24. - "getmac_result.stdout"
  25. - "not getmac_result.stderr"
  26. - "not getmac_result|failed"
  27. - "not getmac_result|changed"
  28. - name: run ipconfig with /all argument
  29. raw: ipconfig /all
  30. register: ipconfig_result
  31. - name: assert that ipconfig ran with /all argument
  32. assert:
  33. that:
  34. - "ipconfig_result.rc == 0"
  35. - "ipconfig_result.stdout"
  36. - "'Physical Address' in ipconfig_result.stdout"
  37. - "not ipconfig_result.stderr"
  38. - "not ipconfig_result|failed"
  39. - "not ipconfig_result|changed"
  40. - name: run ipconfig with invalid argument
  41. raw: ipconfig /badswitch
  42. register: ipconfig_invalid_result
  43. ignore_errors: true
  44. - name: assert that ipconfig with invalid argument failed
  45. assert:
  46. that:
  47. - "ipconfig_invalid_result.rc != 0"
  48. - "ipconfig_invalid_result.stdout" # ipconfig displays errors on stdout.
  49. - "not ipconfig_invalid_result.stderr"
  50. - "ipconfig_invalid_result|failed"
  51. - "not ipconfig_invalid_result|changed"
  52. - name: run an unknown command
  53. raw: uname -a
  54. register: unknown_result
  55. ignore_errors: true
  56. - name: assert that an unknown command failed
  57. assert:
  58. that:
  59. - "unknown_result.rc != 0"
  60. - "not unknown_result.stdout"
  61. - "unknown_result.stderr" # An unknown command displays error on stderr.
  62. - "unknown_result|failed"
  63. - "not unknown_result|changed"