Advertisement
Guest User

salt_deploy

a guest
Feb 12th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.71 KB | None | 0 0
  1. make_symlink:
  2. file.symlink:
  3. - name: {{ deploy_to }}/current
  4. - target: {{ deploy_to }}/{{ time_date }}
  5. - force: True
  6. - user: {{ user_name }}
  7. - group: {{ group_name }}
  8. - mode: {{ permissions }}
  9. - require:
  10. - git: project_sync
  11.  
  12. project_sync:
  13. git.latest:
  14. - target: {{ deploy_to }}/{{ time_date }}
  15. - rev: {{ branche_name }}
  16. - name: {{ api_link }}
  17. - onlyif: cd {{ deploy_to }}/current && git remote show {{ api_link }} | grep out |grep {{ branche_name }}
  18. - require:
  19. - file: make_dir
  20.  
  21. make_dir:
  22. file.directory:
  23. - name: {{ deploy_to }}/{{ time_date }}
  24. - user: {{ user_name }}
  25. - group: {{ group_name }}
  26. - mode: {{ permissions }}
  27. - cwd: {{ deploy_to }}/current
  28. - makedirs: True
  29.  
  30. remove_dir:
  31. cmd.run:
  32. - names:
  33. - rm -r {{ deploy_to }}/{{ time_date }}
  34. - cwd: {{ deploy_to }}
  35. - unless: test -f {{ deploy_to }}/current/.git/index
  36.  
  37.  
  38. I trying to impliment the capistrano deploy logic with salt
  39. so I want to deploy app in "date_time" directory from github
  40. first I create the new "date_time" directory
  41. second I check if the current (local git clone) is up to date or not (with onlyif)
  42. if not I download the code in created directory and make symlink to this directory
  43. if yes I just delete created directory
  44.  
  45. the problem is with onlyif: in project_sync
  46. if the local is up to date i supose that the project_sync must return error and make_symlink
  47. do not need to create sym link to new directory, but it creates!
  48. P.S:in cli this command run well it returns 1 if up to date and 0 if not
  49. cd {{ deploy_to }}/current && git remote show {{ api_link }} | grep out |grep {{ branche_name }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement