Run a task - as root - similar to
- name: Create the pip cache directory with the right permissions
file: dest={{ ckan_libdir }}/.cache owner={{ ckan_shell_user }} group={{
ckan_shell_user }} state=directorybefore using pip inside the ckan virtualenv Best, Andrea > On 26 Mar 2018, at 18:49, Antonio Padez de Castro > <[email protected]> wrote: > > Hi, > > I'm trying to replicate an installation of CKAN through Ansible in a Ubuntu > 14.04 virtual machine. > > But i have this error: > --- > # 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://www.mousetech.com/ckan > 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 db init' > > > - 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 > > But i have this error: > > TASK [Install Spatial requirements] > ******************************************** > fatal: [localhost]: FAILED! => {"changed": false, "cmd": > "/usr/lib/ckan/default/ bin/pip2 install -r > /usr/lib/ckan/default/src/ckanext-spatial/pip-requirements.t xt", "msg": > "\n:stderr: The directory or its parent directory is not owned by the > current user and the cache has been disabled. Please check the permissions > and owner of that directory. If executing pip with sudo, you may want sudo's > -H flag.\nThe directory' or its parent directory is not owned by the current > user and caching wheels has been disa bled. check the permissions and > owner of that directory. If executing pip with s udo, you may want sudo's > -H flag.\nCould not open requirements file: [Errno 2] N o such file or > directory: '/usr/lib/ckan/default/src/ckanext-spatial/pip-require > ments.txt'\nYou are using pip version 9.0.1, however version 9.0.3 is > available. \nYou should consider upgrading via the 'pip install --upgrade > pip' command.\n"} > > > I'm used sudo's-H flag, but the error presists. > > > -- > 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] > <mailto:[email protected]>. > To post to this group, send email to [email protected] > <mailto:[email protected]>. > To view this discussion on the web visit > https://groups.google.com/d/msgid/ansible-project/c6923671-bada-491c-af4e-fea6032437e1%40googlegroups.com > > <https://groups.google.com/d/msgid/ansible-project/c6923671-bada-491c-af4e-fea6032437e1%40googlegroups.com?utm_medium=email&utm_source=footer>. > For more options, visit https://groups.google.com/d/optout > <https://groups.google.com/d/optout>. -- Andrea Dell'Amico http://adellam.sevenseas.org/ -- 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/D3907266-E2E1-4C1F-B1E9-F3C60416C7EA%40gmail.com. For more options, visit https://groups.google.com/d/optout.
signature.asc
Description: Message signed with OpenPGP
