.travis.yml 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. ---
  2. language: python
  3. python: "2.7"
  4. before_install:
  5. # Make sure everything's up to date.
  6. - sudo apt-get update -qq
  7. - sudo apt-get install -qq python-apt python-pycurl git python-pip
  8. install:
  9. - sudo pip install ansible
  10. - sudo mkdir -p /spec
  11. - >
  12. [ ! -d /spec/ansible-spec ]
  13. && sudo git clone https://github.com/ahelal/ansible-spec /spec/ansible-spec && echo "ansible-spec Installing"
  14. || echo "ansible-spec allready installed"
  15. script:
  16. - cd test
  17. - ansible --version
  18. ## Group
  19. # 1st: check syntax
  20. - ansible-playbook -i local.ini application/group.yml --syntax-check
  21. # 2nd: Make sure we run the entire playbook
  22. - ansible-playbook -i local.ini application/group.yml --sudo -vvvv
  23. # 3rd: Make sure our playbook is idempotent
  24. - >
  25. ansible-playbook -i local.ini application/group.yml --sudo -vvvv | tee ansible_output
  26. | grep -q 'changed=0.*failed=0'
  27. && (echo 'Idempotence test: pass' && exit 0)
  28. || (echo 'Idempotence test: fail' && exit 1)
  29. # 4th: run test make sure module spit it right data
  30. - ansible-playbook -i local.ini application/group_spec.yml --sudo -vvvv -C
  31. ## Simple
  32. # 1st: check syntax
  33. - ansible-playbook -i local.ini application/simple.yml --syntax-check
  34. # 2nd: Make sure we run the entire playbook
  35. - ansible-playbook -i local.ini application/simple.yml --sudo -vvvv
  36. # 3rd: Make sure our playbook is idempotent
  37. - >
  38. ansible-playbook -i local.ini application/simple.yml --sudo -vvvv | tee ansible_output
  39. | grep -q 'changed=0.*failed=0'
  40. && (echo 'Idempotence test: pass' && exit 0)
  41. || (echo 'Idempotence test: fail' && exit 1)
  42. # 4th: run test make sure module spit it right data
  43. - ansible-playbook -i local.ini application/simple_spec.yml --sudo -vvvv -C
  44. ## Advanced
  45. # 1st: check syntax
  46. - ansible-playbook -i local.ini application/advanced.yml --syntax-check
  47. # 2nd: Make sure we run the entire playbook
  48. - ansible-playbook -i local.ini application/advanced.yml --sudo -vvvv
  49. # 3rd: Make sure our playbook is idempotent
  50. - >
  51. ansible-playbook -i local.ini application/advanced.yml --sudo -vvvv | tee ansible_output
  52. | grep -q 'changed=0.*failed=0'
  53. && (echo 'Idempotence test: pass' && exit 0)
  54. || (echo 'Idempotence test: fail' && exit 1)
  55. # 4th: run test make sure module spit it right data
  56. - ansible-playbook -i local.ini application/advanced_spec.yml --sudo -vvvv -C --diff
  57. ## Source file yaml and json
  58. # 1st: check syntax
  59. - ansible-playbook -i local.ini application/source_files.yml --syntax-check
  60. # 2nd: Make sure we run the entire playbook
  61. - ansible-playbook -i local.ini application/source_files.yml --sudo -vvvv
  62. # 3rd: Make sure our playbook is idempotent
  63. - >
  64. ansible-playbook -i local.ini application/source_files.yml --sudo -vvvv | tee ansible_output
  65. | grep -q 'changed=0.*failed=0'
  66. && (echo 'Idempotence test: pass' && exit 0)
  67. || (echo 'Idempotence test: fail' && exit 1)
  68. # 4th: run test make sure module spit it right data
  69. - ansible-playbook -i local.ini application/source_files_specs.yml --sudo -vvvv -C --diff
  70. ## Source databag
  71. # 1st: check syntax
  72. - ansible-playbook -i local.ini application/source_databag.yml --syntax-check
  73. # 2nd: Make sure we run the entire playbook
  74. - ansible-playbook -i local.ini application/source_databag.yml --sudo -vvvv
  75. # 3rd: Make sure our playbook is idempotent
  76. - >
  77. ansible-playbook -i local.ini application/source_databag.yml --sudo -vvvv | tee ansible_output
  78. | grep -q 'changed=0.*failed=0'
  79. && (echo 'Idempotence test: pass' && exit 0)
  80. || (echo 'Idempotence test: fail' && exit 1)
  81. # 4th: run test make sure module spit it right data
  82. - ansible-playbook -i local.ini application/source_databag_spec.yml --sudo -vvvv -C --diff
  83. ## Mutli Source
  84. # 1st: check syntax
  85. - ansible-playbook -i local.ini application/multi_source_files.yml --syntax-check
  86. # 2nd: Make sure we run the entire playbook
  87. - ansible-playbook -i local.ini application/multi_source_files.yml --sudo -vvvv
  88. # 3rd: Make sure our playbook is idempotent
  89. - >
  90. ansible-playbook -i local.ini application/multi_source_files.yml --sudo -vvvv | tee ansible_output
  91. | grep -q 'changed=0.*failed=0'
  92. && (echo 'Idempotence test: pass' && exit 0)
  93. || (echo 'Idempotence test: fail' && exit 1)
  94. # 4th:
  95. - ansible-playbook -i local.ini application/multi_source_specs.yml --sudo -vvvv -C --diff
  96. ## Team management
  97. # 1st: check syntax
  98. - ansible-playbook -i local.ini application/team.yml --syntax-check
  99. # 2nd: Make sure we run the entire playbook
  100. - ansible-playbook -i local.ini application/team.yml --sudo -vvvv
  101. # 3rd: Make sure our playbook is idempotent
  102. - >
  103. ansible-playbook -i local.ini application/team.yml --sudo -vvvv | tee ansible_output
  104. | grep -q 'changed=0.*failed=0'
  105. && (echo 'Idempotence test: pass' && exit 0)
  106. || (echo 'Idempotence test: fail' && exit 1)
  107. # 4th:
  108. - ansible-playbook -i local.ini application/team_spec.yml --sudo -vvvv -C --diff
  109. after_failure:
  110. - echo "Failure"
  111. - sudo cat ansible_output
  112. - sudo netstat -atnlp
  113. - sudo cat /home/nexus/sonatype-work/nexus/logs/nexus.log
  114. - sudo cat /home/nexus/sonatype-work/nexus/logs/request.log
  115. - ansible -i 127.0.0.1, -m setup all -c local
  116. after_success:
  117. - echo "Success"