Skip to content

Instantly share code, notes, and snippets.

@sheldonh
Created October 30, 2013 08:33
Show Gist options
  • Select an option

  • Save sheldonh/7229042 to your computer and use it in GitHub Desktop.

Select an option

Save sheldonh/7229042 to your computer and use it in GitHub Desktop.
Holy crap!
TASK: [Rsync local repo to server] ********************************************
failed: [192.168.1.54] => {"failed": true, "parsed": false}
invalid output was: [sudo via ansible, key=lwtfdjeriloittrxzexhobtnxsxiiclm] password:
From the entirely innocent:
-
name: Deploy rack application
hosts: rack-servers
tags: deploy
sudo: yes
sudo_user: rack
vars:
release: "{{ hostvars['localhost']['timestamp'] }}"
release_path: /srv/rack/releases/{{release}}
current_path: /srv/rack/current
rsync_user: "{% if ansible_ssh_user is defined %}{{ ansible_ssh_user }}{% else %}root{% endif %}"
rsync_host: "{% if ansible_ssh_host is defined %}{{ ansible_ssh_host }}{% else %}{{inventory_hostname}}{% endif %}"
rsync_port: "{% if ansible_ssh_port is defined %}:{{ ansible_ssh_port }}{% else %}{% endif %}"
tasks:
...
-
name: Rsync local repo to server
local_action: command rsync -a --delete {{rsync}}/ --rsync-path="/usr/bin/sudo /usr/bin/rsync" {rsync_user}}@{{rsync_host}}{{rsync_port}}:{{release_path}}/
when: rsync is defined
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment