Re: [ansible-project] Re: copy restricted files from server A to B

2020-05-20 Thread Laci
Thank you guys!
It worked, this is the playbook for anyone having the same issues. 
At the end I added a test to remove files from buffer

*serverA% ls -l*

*-rw---.  1 root   6 May 20 16:11 ezaz.txt*

- hosts: serverA
  gather_facts: no
  tasks:
  - name: fetch test file
fetch: src=/tmp/ezaz.txt dest=/tmp/buffer/ flat=yes fail_on_missing=yes

- hosts: serverB
  gather_facts: no
  tasks:
  - name: copy from dckr to dckr3
copy: src=/tmp/buffer/ezaz.txt dest=/tmp/final_ezaz.txt remote_src=no 
owner=root group=root mode=0400 backup=yes force=yes

- hosts: ansible
  gather_facts: no
  tasks:
   - name: Delete certificates from /tmp
 file: path=/tmp/buffer/ezaz.txt state=absent

*serverB% ls -l*
*-r. 1 root root  6 May 20 16:30 final_ezaz.txt*

On Tuesday, May 19, 2020 at 4:50:10 PM UTC-4, Jean-Yves LENHOF wrote:
>
> Use copy (to copy on the second server), fetch (to get the file on the 
> controller), and stat (to get rights) modules
>
> Regards,
>
> JYL
>
>
> Le 19/05/2020 à 22:38, Laci a écrit :
>
> Another detail is that serverA can't talk to serverB or vice versa, only 
> the Ansible server can talk to both of them
>
> On Tuesday, May 19, 2020 at 2:29:49 PM UTC-4, Laci wrote: 
>>
>> I have some files with 0400/-r permissions on server A that I 
>> need to copy to server B and preserve permissions. 
>>
>> For example:
>> serverA:/etc/ssl_cert.key -> serverB:/etc/ssl_cert.key
>>
>> How would you do it?
>>
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible...@googlegroups.com .
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/ef9d3a60-a5c2-4f13-97dc-0e4d41c8582a%40googlegroups.com
>  
> 
> .
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/e3ebb453-58dd-4d7d-8df9-486068f4473e%40googlegroups.com.


Re: [ansible-project] Re: copy restricted files from server A to B

2020-05-19 Thread Jean-Yves LENHOF
Use copy (to copy on the second server), fetch (to get the file on the 
controller), and stat (to get rights) modules


Regards,

JYL


Le 19/05/2020 à 22:38, Laci a écrit :
Another detail is that serverA can't talk to serverB or vice versa, 
only the Ansible server can talk to both of them


On Tuesday, May 19, 2020 at 2:29:49 PM UTC-4, Laci wrote:

I have some files with 0400/-r permissions on server A
that I need to copy to server B and preserve permissions.

For example:
serverA:/etc/ssl_cert.key -> serverB:/etc/ssl_cert.key

How would you do it?

--
You received this message because you are subscribed to the Google 
Groups "Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send 
an email to ansible-project+unsubscr...@googlegroups.com 
.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ef9d3a60-a5c2-4f13-97dc-0e4d41c8582a%40googlegroups.com 
.


--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/eda34672-2eab-bf70-554f-758c4273d729%40lenhof.eu.org.


Re: [ansible-project] Re: copy restricted files from server A to B

2020-05-19 Thread Dick Visser
Have a look at the various examples on the synchronize module page:
https://docs.ansible.com/ansible/latest/modules/synchronize_module.html.
You can use a combination of delegate_to and push/pull mode.

On Tue, 19 May 2020 at 22:38, Laci  wrote:
>
> Another detail is that serverA can't talk to serverB or vice versa, only the 
> Ansible server can talk to both of them
>
> On Tuesday, May 19, 2020 at 2:29:49 PM UTC-4, Laci wrote:
>>
>> I have some files with 0400/-r permissions on server A that I need 
>> to copy to server B and preserve permissions.
>>
>> For example:
>> serverA:/etc/ssl_cert.key -> serverB:/etc/ssl_cert.key
>>
>> How would you do it?
>
> --
> You received this message because you are subscribed to the Google Groups 
> "Ansible Project" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to ansible-project+unsubscr...@googlegroups.com.
> To view this discussion on the web visit 
> https://groups.google.com/d/msgid/ansible-project/ef9d3a60-a5c2-4f13-97dc-0e4d41c8582a%40googlegroups.com.



-- 
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAL8fbwPF2i8zkswJOVTnth%3DrnFkRe-p4vcxOkwj3c-87%2BhCd%3Dg%40mail.gmail.com.


[ansible-project] Re: copy restricted files from server A to B

2020-05-19 Thread Laci
Another detail is that serverA can't talk to serverB or vice versa, only 
the Ansible server can talk to both of them

On Tuesday, May 19, 2020 at 2:29:49 PM UTC-4, Laci wrote:
>
> I have some files with 0400/-r permissions on server A that I need 
> to copy to server B and preserve permissions.
>
> For example:
> serverA:/etc/ssl_cert.key -> serverB:/etc/ssl_cert.key
>
> How would you do it?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ef9d3a60-a5c2-4f13-97dc-0e4d41c8582a%40googlegroups.com.