4

I'm trying to get WordPress downloaded and installed via Ansible and I can't seem to figure out what I'm doing wrong here. First I download via the get_url module then I attempt to use the unarchive module to move the source to my synced folder.

roles/wordpress/default

wp_debug: true
wp_version: 4.2.1
auto_up_disable: false
core_update_level: false

roles/wordpress/tasks/main.yml

- name: Download WordPress
  get_url: url=http://wordpress.org/wordpress-{{ wp_version }}.tar.gz dest=/var/www/wordpress-{{ wp_version }}.tar.gz

- name: Extract archive
  unarchive: src=/var/www/wordpress-{{wp_version}}.tar.gz dest={{site.www_root}}

Error Message enter image description here

Then when I ssh into the vagrant box... enter image description here

Specs: Ubuntu 14.04, Ansible 1.9.1, Vagrant 1.7.2, OSX Yosemite

Notes: site.www_root is set to /var/www/wordpress

12

It seems like copy parameter for unarchive module is what tripped you up. http://docs.ansible.com/unarchive_module.html states:

  • -If copy=yes (default), local path to archive file to copy to the target server; can be absolute or relative.

  • -If copy=no, path on the target server to existing archive file to unpack.

In essence get_url downloaded your file to your remote server, but unarchive tried to extract it from your local machine.

Your 2nd task should be updated as such:

- name: Extract archive
  unarchive: src=/var/www/wordpress-{{wp_version}}.tar.gz
             dest={{site.www_root}}
             copy=no
  • 6
    copy=no has since been deprecated in favor of remote_src=yes for this operation – Willem van Ketwich Dec 9 '16 at 4:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.