---

- name: "mediawiki directory"
  file:
    path: "{{mediawiki_directory}}"
    owner: "apache"
    group: "apache"
    state: directory

- name: "uncompress mediawiki archive"
  unarchive:
    src: "{{mediawiki_archive_url}}"
    dest: "{{mediawiki_directory}}"
    owner: "apache"
    group: "apache"
    remote_src: yes
    # remove mediawiki-29.0/ from path
    extra_opts: --transform=s/^mediawiki-[0-9\.]*\///

- name: "mediawiki configuration"
  become: yes
  become_user: "apache"
  args:
    chdir: "{{mediawiki_maintenance_directory}}"
  command:
    php install.php --scriptpath /{{mediawiki_name}}
       --dbname mediawiki --lang fr
       --dbuser {{mediawiki_db_user}}
       --dbpass {{mediawiki_db_password}}
       --pass {{mediawiki_admin_password}}
       --dbserver {{mediawiki_db_host}}
       {{mediawiki_title}} {{mediawiki_admin_user}}
  env:
    LC_ALL: C
