Plone.ansible playbook: load a custom Data.fs

I'm looking through the Plone ansible playbook docs and I'm not seeing a way to load a existing Data.fs file at deployment. This would allow me to load an existing site and "pre-populate" it with data from the previous site. Being able to do this with the blob data would be useful as well.

In the meantime I'll see how far I can get with making use of hexagonit.recipe.download

I certainly can unpack the data I want using something like this:
Adding this to roles/plone.plone_server/templates/buildout.cfg.j2 is my current solution.

parts =

...
getit

[getit]
recipe = hexagonit.recipe.download
url = https://url/for/mysite/data/mysite.data.tar.gz
destination = ${buildout:directory}

Just working out how to ensure that it only runs the first time (maybe an additional playbook file similar to the way that firewall.yml is used)

Hi David,

You could customize the ansible.plone_server role to do this, instead of letting buildout handle it. For example, the lines following - name: Copy buildout skeleton show you how to copy an entire directory structure from the local host to the remote host. However, since the role-defined var directory is separate from the buildout root (typically, /var/local/plone-x.y/zeoserver/ versus /usr/local/plone-x.y/zeoserver/), you'll want separate tasks for your Data.fs and blobstorage. Also, since these files could be fairly large, it's probably better to move tarballs across the wire. The copy module can take a very long time if there are lots of files in the folder tree.

Which leads you to the task - name: Load buildout cache from host file. Here's an example:

- name: Load Data.fs file
  when: not db_status.stat.exists
  unarchive:
    creates="{{ plone_instance_var_path }}/filestorage/Data.fs"
    src="Data.fs.tgz"
    dest="{{ plone_instance_var_path }}/filestorage"
    owner=plone_daemon
    group=plone_group

If you put a Data.fs.tgz file in the role's files directory, it will be extracted in {{ plone_instance_var_path }}/filestorage (and the task will be skipped if a Data.fs file exists there already). Or look at - name: Download buildout cache if needed if you want the tarball to be downloaded from another host.

See also:
http://docs.ansible.com/ansible/unarchive_module.html
http://docs.ansible.com/ansible/copy_module.html
http://docs.ansible.com/ansible/get_url_module.html

@fulv,
Thanks for the pointers. This looks like a good direction. It also looks like something that could be added to the standard plone_server role in the future.