# Tasks to run if cloning repos to edx-platform.

- name: clone all course repos
  git: dest={{ GITRELOAD_REPODIR }}/{{ item.name }} repo={{ item.url }} version={{ item.commit }}
  become_user: "{{ common_web_user }}"
  with_items: "{{ GITRELOAD_REPOS }}"

- name: do import of courses
  shell: "SERVICE_VARIANT=lms {{ edxapp_venv_bin }}/python manage.py lms --settings={{ edxapp_settings }} git_add_course {{ item.url }} {{ GITRELOAD_REPODIR }}/{{ item.name }}"
  args:
    executable: "/bin/bash"
    chdir: "{{ edxapp_code_dir }}"
  become_user: "{{ common_web_user }}"
  with_items: "{{ GITRELOAD_REPOS }}"

- name: change ownership on repos for access by edxapp and www-data
  file:
    path: "{{ GITRELOAD_REPODIR }}"
    state: directory
    owner: "{{ common_web_user }}"
    owner: "{{ common_web_group }}"
    recurse: yes

- name: change group on repos if using devstack
  file:
    path: "{{ GITRELOAD_REPODIR }}"
    state: directory
    group: "{{ edxapp_user }}"
    recurse: yes
  when: devstack

- name: change mode on repos with using devstack
  command: "chmod -R o=rwX,g=srwX,o=rX {{ GITRELOAD_REPODIR }}"
  when: devstack

# Tasks to run if cloning repos to edx-platform.

- name: clone all course repos
  git: dest={{ GITRELOAD_REPODIR }}/{{ item.name }} repo={{ item.url }} version={{ item.commit }}
  become_user: "{{ common_web_user }}"
  with_items: "{{ GITRELOAD_REPOS }}"

- name: do import of courses
  shell: "SERVICE_VARIANT=lms {{ edxapp_venv_bin }}/python manage.py lms --settings={{ edxapp_settings }} git_add_course {{ item.url }} {{ GITRELOAD_REPODIR }}/{{ item.name }}"
  args:
    executable: "/bin/bash"
    chdir: "{{ edxapp_code_dir }}"
  become_user: "{{ common_web_user }}"
  with_items: "{{ GITRELOAD_REPOS }}"

- name: change ownership on repos for access by edxapp and www-data
  file:
    path: "{{ GITRELOAD_REPODIR }}"
    state: directory
    owner: "{{ common_web_user }}"
    group: "{{ common_web_group }}"
    recurse: yes

- name: change group on repos if using devstack
  file:
    path: "{{ GITRELOAD_REPODIR }}"
    state: directory
    group: "{{ edxapp_user }}"
    recurse: yes
  when: devstack

- name: change mode on repos with using devstack
  command: "chmod -R o=rwX,g=srwX,o=rX {{ GITRELOAD_REPODIR }}"
  when: devstack

Fix duplicate dict key (owner) warning
Fix duplicate dict key (owner) warning
