Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- make_symlink:
- file.symlink:
- - name: {{ deploy_to }}/current
- - target: {{ deploy_to }}/{{ time_date }}
- - force: True
- - user: {{ user_name }}
- - group: {{ group_name }}
- - mode: {{ permissions }}
- - require:
- - git: project_sync
- project_sync:
- git.latest:
- - target: {{ deploy_to }}/{{ time_date }}
- - rev: {{ branche_name }}
- - name: {{ api_link }}
- - onlyif: cd {{ deploy_to }}/current && git remote show {{ api_link }} | grep out |grep {{ branche_name }}
- - require:
- - file: make_dir
- make_dir:
- file.directory:
- - name: {{ deploy_to }}/{{ time_date }}
- - user: {{ user_name }}
- - group: {{ group_name }}
- - mode: {{ permissions }}
- - cwd: {{ deploy_to }}/current
- - makedirs: True
- remove_dir:
- cmd.run:
- - names:
- - rm -r {{ deploy_to }}/{{ time_date }}
- - cwd: {{ deploy_to }}
- - unless: test -f {{ deploy_to }}/current/.git/index
- I trying to impliment the capistrano deploy logic with salt
- so I want to deploy app in "date_time" directory from github
- first I create the new "date_time" directory
- second I check if the current (local git clone) is up to date or not (with onlyif)
- if not I download the code in created directory and make symlink to this directory
- if yes I just delete created directory
- the problem is with onlyif: in project_sync
- if the local is up to date i supose that the project_sync must return error and make_symlink
- do not need to create sym link to new directory, but it creates!
- P.S:in cli this command run well it returns 1 if up to date and 0 if not
- cd {{ deploy_to }}/current && git remote show {{ api_link }} | grep out |grep {{ branche_name }}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement