-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
adds rsync playbooks, with working sync for remote to vagrant hosts
- Loading branch information
1 parent
d9d2067
commit 5de3050
Showing
4 changed files
with
86 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
.vagrant | ||
*.retry | ||
.rsync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
--- | ||
|
||
- name: rsync with local vagrant machines | ||
hosts: primary | ||
remote_user: "{{ my_remote_user }}" | ||
become: no | ||
become_method: sudo | ||
become_user: root | ||
|
||
tasks: | ||
|
||
- name: sync local folder to vagrant box folder | ||
synchronize: | ||
src: /Users/patrick/Documents/syncthis | ||
dest: /home/vagrant | ||
|
||
## This task fails - the error message complains of a missing | ||
## public key file, although it is clearly present locally - | ||
## but probably not on the 'secondary' machine. Why is it | ||
## looking for a .vagrant folder on the 'secondary' machine? | ||
## I suspect this is a problem with the fact that both vagrant | ||
## machines are on 127.0.0.1 (albeit different ports) and | ||
## AgentForwarding is getting confused, and failing. | ||
# - name: sync vbox1 folder to vbox2 folder | ||
# synchronize: | ||
# src: /home/vagrant/syncthis | ||
# dest: /home/vagrant | ||
# delegate_to: secondary | ||
|
||
- name: rsync vagrant box to remote box | ||
hosts: ansible-pocs-1 | ||
remote_user: "{{ my_remote_user }}" | ||
become: no | ||
become_method: sudo | ||
become_user: root | ||
|
||
tasks: | ||
|
||
## rsync in this task will need to be run on the vagrant box | ||
## (because the remote box will not be able to connect to the | ||
## vagrant box, as it is on our private network). Thus, the | ||
## delegate_to setting should be the vagrant box, the mode | ||
## should be 'pull' and the play host should be the remote box. | ||
## THIS TASK FAILS for the same reasons as the previous play. | ||
# - name: sync vagrant box to remote box | ||
# synchronize: | ||
# src: /home/admin/syncthis | ||
# dest: /home/vagrant | ||
# mode: pull | ||
# delegate_to: primary |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
|
||
- name: two step rsync - step 1 | ||
hosts: ansible-pocs-1 | ||
remote_user: "{{ my_remote_user }}" | ||
become: no | ||
become_method: sudo | ||
become_user: root | ||
|
||
tasks: | ||
|
||
- name: sync remote box to local dir | ||
synchronize: | ||
src: /home/admin/syncthis | ||
dest: ./.rsync | ||
mode: pull | ||
become: yes | ||
|
||
- name: two step rsync - step 2 | ||
hosts: primary | ||
remote_user: "{{ my_remote_user }}" | ||
become: no | ||
become_method: sudo | ||
become_user: root | ||
|
||
tasks: | ||
|
||
- name: sync local dir to vagrant box | ||
synchronize: | ||
src: ./.rsync/syncthis | ||
dest: /home/vagrant | ||
mode: push |