If I understand correctly, you're copying the contents of several
directories to a central location, removing the old path, and then creating
a symlink to the new location? To do that with ansible you'd just need to
call the synchronize module to copy the files (or use command/shell to do
the rsync), and then use the file module to create the symlink.


On Mon, Mar 31, 2014 at 6:56 AM, Maxim Odinintsev <[email protected]>wrote:

> Hello,
>
> I'm trying migrate out my infrastructure under ansible control, but
> stopped on simple things realization with ansible.
>
> I would be very grateful if some one can explain, best way for moving on
> this simple shell script under ansible.
> May be simplest way is running external shell, and not try to push it all
> under ansible logic ?
>
> pushd /
> for i in \
>       /etc/ipsec* \
>       /home \
>       /root \
>       do
>       [[ -r $i ]] || continue
>       [[ -L $i ]] && continue
>       dst_dir=$(readlink -m /protected$(dirname $i))
>       dst_name="${dst_dir}/$(basename $i)"
>       mkdir -p $dst_dir
>       rsync -a $i $dst_dir && rm -rf $i && ln -s $dst_name $i
>       ls -ld $i
> done
> popd
>
> Thank you
>
> --
> 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 [email protected].
> To post to this group, send email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/ansible-project/a29d1d41-ffd3-40e9-8cc4-a4a891e443c6%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/a29d1d41-ffd3-40e9-8cc4-a4a891e443c6%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAFg%2Bn8T_92zNsUvWZzqKTQV_E1mz6iVxg%3D9aSyt%3DW7n6opbG4Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to