I have a project to install ckan with ansible. 

I need my ansible install a smillar file development.ini.

My installatiion don“t have problems, but don't create this file to test 
the ckan in the browser.

This is my orchestrator from ansible:

---
# Ansible install/setup ckan

- hosts: localhost
  become: true

  vars:
    my_package_url: 
http://packaging.ckan.org/python-ckan_2.6-trusty_amd64.deb
    site_url: http://10.0.70.182:5000 
    tmpdir: '.'

# Note: site_url should come from environment! Change to your own CKAN site 
url before.
    
  tasks:

        - name: "FIX: Ubuntu 14.04 LTS doesn't come with certain modules, 
required by ansible"
          raw: sudo apt-get -y install aptitude
        
        - name: Update OS
          apt:
            upgrade: full

        - name: Setup users
          user: name=admin state=present

        - name: Setup basic packages
          apt: name={{ item }} state=installed
          with_items:
            - nginx
            - apache2
            - libapache2-mod-wsgi
            - libpq5
            - wget
            - git
            - acl
            - python-psycopg2
            - python-pip
            - python-dev
            - postgresql
            - pgadmin3
            - libpq-dev
            - python-virtualenv
            - python-pastescript
         

        - name: Download my_package
          get_url: url="{{ my_package_url }}" dest="{{ tmpdir 
}}/python-ckan_2.6-trusty_amd64.deb"
#          when: vagrant_check_deb.rc == 1

        - name: Install my_package
          apt: deb="{{ tmpdir }}/python-ckan_2.6-trusty_amd64.deb"
          become: true
#          when: vagrant_check_deb.rc == 1


#################################################################
# PostgreSQL
#################################################################

        - name: PostgreSQL User
          postgresql_user:
            name: ckan_default
            password: pass
            role_attr_flags: CREATEDB,NOSUPERUSER
          become: yes
          become_user: postgres
          tags:
            - configuration

        - name: PostgreSQL database
          postgresql_db:
            name: ckan_default
          become: yes
          become_user: postgres

        - name: Apache solr
          apt: name={{ item }} state=installed
          with_items:
            - solr-jetty
            - libjetty-extra
            - libjetty-extra-java
            - libtomcat7-java

        - name: Jetty configuration
          lineinfile:
            dest: /etc/default/jetty
            state: present
            regexp: "{{ item.re }}"
            line: "{{ item.line }}"
          with_items:
            - { re: 'NO_START', line: 'NO_START=0' }
            - { re: 'JETTY_HOST', line: 'JETTY_HOST=127.0.0.1' }
            - { re: 'JETTY_PORT', line: 'JETTY_PORT=8983' }
          
        - name: Start jetty
          service:
            name: jetty
            enabled: yes

        - name: Backup solar config
          become: true
          command: 'mv /etc/solr/conf/schema.xml 
/etc/solr/conf/schema.xml.bak'

        - name: Setup xml schema
          file:
            src: /usr/lib/ckan/default/src/ckan/ckan/config/solr/schema.xml
            dest: /etc/solr/conf/schema.xml
            state: link

        - name: Restart jetty
          service:
            name: jetty
            state: restarted

#################################################################
# Database setup
#################################################################

        - name: CKAN configuration
          ini_file:
            dest: /etc/ckan/default/production.ini
            section: 'app:main'
            option: "{{ item.id }}"
            value: "{{item.value }}"
          with_items:
            - { id: 'ckan.site_id', value: 'default' }
            - { id: 'ckan.site_url', value: '{{ site_url }}' }

#################################################################
# Plugins
#################################################################


        - name: CKAN plugin for spatial_query
          lineinfile:
            dest: /etc/ckan/default/production.ini
            state: present
            regexp: '^(ckan\.plugins)((?!.*\Wresource_proxy\W).*)$'
            line: '\1\2 resource_proxy'
            backrefs: yes
          tags:
            - config

- include: datastore.yml
- include: pdfview.yml
- include: spatial.yml
- include: geoview.yml
- include: harvest.yml

#################################################################
# Init databases and restart servers
#################################################################

- hosts: localhost
  tasks:   
    - name: CKAN initialize database
      become: true
      command: 'ckan'

    - name: Install CKAN API
      pip:
        name: ckanapi
        virtualenv: /usr/lib/ckan/default
      become: true

    - name: Restart apache
      service:
        name: apache2
        state: restarted

    - name: Restart nginx
      service:
        name: nginx
        state: restarted



-- 
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/2020d4c5-d916-4317-959e-74d700f5b49d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to