Skip to content

Instantly share code, notes, and snippets.

@mrchrisadams
Last active January 26, 2016 17:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mrchrisadams/a617c62e6d2898298dd9 to your computer and use it in GitHub Desktop.
Save mrchrisadams/a617c62e6d2898298dd9 to your computer and use it in GitHub Desktop.
Getting pointers on updating a deploy role for ansible
- name: add deploy key for deploy user, if there is one
copy: >
src={{ deploy_user_ssh_priv_key_path }}
dest=/home/{{ deploy_user_name }}/.ssh/deploy
mode=600
owner={{ deploy_user_name}}
group={{ deploy_user_name }}
sudo: yes
when: deploy_user_ssh_priv_key_path
- name: check that a deploy_key exists
stat: >
path=deploy_user_ssh_priv_key_path
run_once: true
delegate_to: localhost
register: deploy_key_exists
- name: add deploy key for deploy user, if there is one
copy:
src: {{ deploy_user_ssh_priv_key_path }}
dest: /home/{{ deploy_user_name }}/.ssh/deploy
mode: 600
owner: {{ deploy_user_name}}
group: {{ deploy_user_name }}
sudo: yes
when: deploy_key.exists
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment