--- - name: Download the CKAN distribution get_url: url='{{ ckan_package_url }}' dest=/srv/{{ ckan_deb_file }} tags: ckan - name: Install the CKAN deb package apt: deb=/srv/{{ ckan_deb_file }} register: ckan_install tags: ckan - name: Configure the CKAN production configuration file ini_file: dest={{ ckan_config_file }} section={{ item.section }} option={{ item.option }} value={{ item.value }} state={{ item.state }} backup=yes with_items: '{{ ckan_production_ini_opts }}' notify: Restart CKAN tags: [ 'ckan', 'ckan_ini' ] - name: Install the solr schema used by CKAN file: src=/usr/lib/ckan/default/src/ckan/ckan/config/solr/schema.xml dest={{ tomcat_m_instances_base_path }}/{{ ckan_solr_port }}/solr/data/solr/collection1/conf/schema.xml state=link force=yes when: not ckan_geonetwork_harvester notify: Solr Restart tags: [ 'ckan', 'solr', 'solr_schema' ] - name: Install the solr schema used by CKAN, modified with the spatial fields copy: src=schema.xml dest={{ tomcat_m_instances_base_path }}/{{ ckan_solr_port }}/solr/data/solr/collection1/conf/schema.xml force=yes when: ckan_geonetwork_harvester notify: Solr Restart tags: [ 'ckan', 'solr', 'solr_schema' ] - name: Create the base directory for the CKAN file storage file: dest={{ ckan_file_storage_dir }} state=directory owner={{ apache_user }} mode=0700 tags: ckan - name: Initialize the CKAN databases shell: ckan db init ; ckan datastore set-permissions | su - postgres -c 'psql --set ON_ERROR_STOP=1' when: ( ckan_install | changed ) tags: ckan - name: Create the pip cache directory with the right permissions file: dest={{ ckan_libdir }}/.cache owner={{ ckan_shell_user }} group={{ ckan_shell_user }} state=directory tags: [ 'ckan', 'ckan_user' ] - name: Assign the CKAN virtenv dir to the ckan user file: dest={{ ckan_virtenv }} recurse=yes owner={{ ckan_shell_user }} group={{ ckan_shell_user }} tags: [ 'ckan', 'ckan_user' ] - name: Create a log directory for the jobs run by the ckan user file: dest=/var/log/ckan state=directory owner={{ ckan_shell_user }} group={{ ckan_shell_user }} tags: [ 'ckan', 'ckan_user' ] - name: Install some plugins dependencies inside the CKAN virtualenv become: True become_user: '{{ ckan_shell_user }}' pip: name={{ item }} virtualenv={{ ckan_virtenv }} with_items: '{{ ckan_pip_dependencies }}' when: ckan_geonetwork_harvester tags: [ 'ckan', 'geonetwork', 'ckan_plugins', 'ckan_pip_deps' ] - name: Download the CKAN ckanext-harvest plugin become: True become_user: '{{ ckan_shell_user }}' pip: name='{{ ckan_ckanext_harvester_url }}' virtualenv={{ ckan_virtenv }} notify: Restart CKAN when: ckan_geonetwork_harvester register: ckanext_harvest_install tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ] - name: Download the CKAN ckanext-harvest requirements become: True become_user: '{{ ckan_shell_user }}' pip: requirements={{ ckan_virtenv }}/src/ckanext-harvest/pip-requirements.txt virtualenv={{ ckan_virtenv }} when: ckan_geonetwork_harvester tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ] - name: Initialize the CKAN ckanext-harvest plugin become: True become_user: '{{ ckan_shell_user }}' shell: . /usr/lib/ckan/default/bin/activate ; paster --plugin=ckanext-harvest harvester initdb --config={{ ckan_config_file }} when: ( ckanext_harvest_install | changed ) tags: [ 'ckan', 'geonetwork', 'ckan_plugins' ] - name: Download the CKAN ckanext-spatial plugin become: True become_user: '{{ ckan_shell_user }}' pip: name='{{ ckan_ckanext_spatial_url }}' virtualenv={{ ckan_virtenv }} notify: Restart CKAN when: ckan_geonetwork_harvester register: ckanext_spatial_install tags: [ 'ckan', 'ckan_spatial', 'ckan_plugins' ] - name: Download the CKAN ckanext-spatial requirements become: True become_user: '{{ ckan_shell_user }}' pip: requirements={{ ckan_virtenv }}/src/ckanext-spatial/pip-requirements.txt virtualenv={{ ckan_virtenv }} when: ckan_geonetwork_harvester tags: [ 'ckan', 'ckan_spatial', 'ckan_plugins' ] - name: Initialize the CKAN ckanext-harvest plugin become: True become_user: '{{ ckan_shell_user }}' shell: . /usr/lib/ckan/default/bin/activate ; paster --plugin=ckanext-spatial spatial initdb --config={{ ckan_config_file }} when: ( ckanext_spatial_install | changed ) tags: [ 'ckan', 'ckan_harvest', 'ckan_plugins' ] - name: Download the CKAN Geonetwork plugin code become: True become_user: '{{ ckan_shell_user }}' git: repo={{ ckan_geonetwork_harvester_url }} dest=/usr/lib/ckan/default/src/ckanext-geonetwork when: ckan_geonetwork_harvester register: install_geonetwork_harvester tags: [ 'ckan', 'ckan_geonetwork', 'ckan_plugins' ] - name: Install the CKAN Geonetwork plugin code become: True become_user: '{{ ckan_shell_user }}' shell: . /usr/lib/ckan/default/bin/activate ; cd /usr/lib/ckan/default/src/ckanext-geonetwork ; python setup.py develop when: ( install_geonetwork_harvester | changed ) notify: Restart CKAN tags: [ 'ckan', 'ckan_geonetwork', 'ckan_plugins' ] - name: Install the script that updates the tracking data template: src=tracker_update.sh.j2 dest={{ ckan_virtenv }}/bin/tracker_update owner={{ ckan_shell_user }} group={{ ckan_shell_user }} mode=0555 when: ckan_geonetwork_harvester tags: [ 'ckan', 'ckan_geonetwork', 'ckan_plugins', 'tracker' ] - name: Install the cron job that runs the tracker update script cron: name="tracker update" minute="0" job="{{ ckan_virtenv }}/bin/tracker_update > /var/log/ckan/tracker_update.log 2>&1" user={{ ckan_shell_user }} when: ckan_geonetwork_harvester tags: [ 'ckan', 'ckan_geonetwork', 'ckan_plugins', 'tracker' ] - name: Download the CKAN PDF viewer plugin become: True become_user: '{{ ckan_shell_user }}' pip: name='{{ ckan_ckanext_pdfview_url }}' virtualenv={{ ckan_virtenv }} when: ckan_pdfview notify: Restart CKAN tags: [ 'ckan', 'ckan_pdfview', 'ckan_plugins' ] - name: Download the CKAN Privatedatasets extension become: True become_user: '{{ ckan_shell_user }}' pip: name='{{ ckan_privatedatasets_url }}' virtualenv={{ ckan_virtenv }} when: ckan_privatedatasets notify: Restart CKAN tags: [ 'ckan', 'ckan_privdatasets', 'ckan_plugins' ] - name: Download the CKAN hierarchy plugin code become: True become_user: '{{ ckan_shell_user }}' pip: name='{{ ckan_hierarchy_url }}' virtualenv={{ ckan_virtenv }} when: ckan_hierarchy notify: Restart CKAN tags: [ 'ckan', 'ckan_hierarchy', 'ckan_plugins' ] - name: Download the CKAN pages plugin code become: True become_user: '{{ ckan_shell_user }}' pip: name='{{ ckan_pages_url }}' virtualenv={{ ckan_virtenv }} when: ckan_pages notify: Restart CKAN tags: [ 'ckan', 'ckan_pages', 'ckan_plugins' ] # - name: Overwrite the base.py ckanext-spatial plugin file to enable authentication against the Geonetwork nodes # copy: src=base.py dest=/usr/lib/ckan/default/src/ckanext-spatial/ckanext/spatial/harvesters/base.py owner={{ ckan_shell_user }} group={{ ckan_shell_user }} mode=0644 backup=yes # notify: Restart CKAN # tags: [ 'ckan', 'ckan_pages', 'ckan_plugins', 'ckan_geo_auth' ] # - name: Overwrite the ckanharvester.py ckanext plugin file to remove the authentication data from URLs # copy: src=ckanharvester.py dest=/usr/lib/ckan/default/src/ckanext-harvest/ckanext/harvest/harvesters/ckanharvester.py owner={{ ckan_shell_user }} group={{ ckan_shell_user }} mode=0644 backup=yes # notify: Restart CKAN # tags: [ 'ckan', 'ckan_pages', 'ckan_plugins', 'ckan_ckanharvester' ] # - name: Overwrite the csw.py ckanext-spatial plugin file to remove the authentication data from URLs # copy: src=csw.py dest=/usr/lib/ckan/default/src/ckanext-spatial/ckanext/spatial/harvesters/csw.py owner={{ ckan_shell_user }} group={{ ckan_shell_user }} mode=0644 backup=yes # notify: Restart CKAN # tags: [ 'ckan', 'ckan_pages', 'ckan_plugins', 'ckan_ckanext_spatial' ] - name: Restart apache service: name=apache state=restarted enabled=yes when: ( ckan_install | changed ) tags: ckan - name: Restart nginx service: name=nginx state=restarted enabled=yes when: ( ckan_install | changed ) tags: ckan