<commit_before>---

- name: Ensure download folder exists
  file: dest={{ ansible_env.HOME }}/downloads/ state=directory

- name: Download the opencart installer
  unarchive:
    src="{{ opencart_url }}"
    dest={{ ansible_env.HOME }}/downloads/
    copy=no
    creates={{ ansible_env.HOME }}/downloads/{{ opencart_dir }}

- name: Ensure public_html folder exists
  file: dest={{ ansible_env.HOME }}/public_html/ state=directory mode=0750

- name: stat 'winkel' folder
  stat: path={{ ansible_env.HOME }}/public_html/winkel/
  register: stat_winkel

- name: Move shop to public_html
  command: mv {{ ansible_env.HOME }}/downloads/{{ opencart_dir }}/upload {{ ansible_env.HOME }}/public_html/winkel
  when: not stat_winkel.stat.exists

- name: Ensure the apache user is part of the app user group
  user: name=www-data append=yes groups={{ item }}
  with_items: "{{ users }}"
  remote_user: root

- name: Set group-write permissions on the required folders
  file:
    path={{ ansible_env.HOME }}/public_html/winkel/{{ item }}/
    state=directory
    mode: 0770
    recurse=yes
  with_items:
    - image

- name: Create database user for the shop
  mysql_user:
    name="{{ shop_db.user }}"
    password="{{ shop_db.password }}"
    host=localhost
    state=present
  remote_user: root

- name: Create database for the shop
  mysql_db: name="{{ shop_db.name }}" state=present
  remote_user: root

- name: Grant db user privileges
  mysql_user: name="{{ shop_db.user }}" priv="{{ shop_db.name }}.*:ALL"
  remote_user: root

- name: Move admin location
  command: mv {{ ansible_env.HOME }}/public_html/winkel/admin {{ ansible_env.HOME }}/public_html/winkel/{{ shop_admin_location }}<commit_msg>Setting up flow for OpenCart installation<commit_after>---

- name: Ensure download folder exists
  file: dest={{ ansible_env.HOME }}/downloads/ state=directory

- name: Download the opencart installer
  unarchive:
    src="{{ opencart_url }}"
    dest={{ ansible_env.HOME }}/downloads/
    copy=no
    creates={{ ansible_env.HOME }}/downloads/{{ opencart_dir }}

- name: Ensure public_html folder exists
  file: dest={{ ansible_env.HOME }}/public_html/ state=directory mode=0750

- name: stat 'winkel' folder
  stat: path={{ ansible_env.HOME }}/public_html/winkel/
  register: stat_winkel

- name: Move shop to public_html
  command: mv {{ ansible_env.HOME }}/downloads/{{ opencart_dir }}/upload {{ ansible_env.HOME }}/public_html/winkel
  when: not stat_winkel.stat.exists

- name: Ensure the apache user is part of the app user group
  user: name=www-data append=yes groups={{ item }}
  with_items: "{{ users }}"
  remote_user: root

- name: Set group-write permissions on the required folders
  file:
    path={{ ansible_env.HOME }}/public_html/winkel/{{ item }}
    state=directory
    mode=0770
    recurse=yes
  with_items:
    - image

- name: Create database user for the shop
  mysql_user:
    name="{{ shop_db.user }}"
    password="{{ shop_db.password }}"
    host=localhost
    state=present
  remote_user: root

- name: Create database for the shop
  mysql_db: name="{{ shop_db.name }}" state=present
  remote_user: root

- name: Grant db user privileges
  mysql_user: name="{{ shop_db.user }}" priv="{{ shop_db.name }}.*:ALL"
  remote_user: root

- name: Ensure the config files are touched
  file: dest={{ ansible_env.HOME }}/public_html/winkel/{{ item.dest }} state={{ item.state }}
  with_items:
    - {dest: config.php, state: file}
    - {dest: config-dist.php, state: absent}
    - {dest: admin/config.php, state: file}
    - {dest: admin/config-dist.php, state: absent}

- name: Run the CLI installer
  command:
    php cli_install.php install --db_host localhost \
                                 --db_user {{ shop_db.user }} \
                                 --db_password {{ shop_db.password }} \
                                 --db_name {{ shop_db.name }} \
                                 --username admin \
                                 --password <PASSWORD> \
                                 --email <EMAIL> \
                                 --agree_tnc yes \
                                 --http_server https://modelbrouwers.nl/winkel
  args:
    chdir: "{{ ansible_env.HOME }}/public_html/winkel/install"
    # creates: "{{ ansible_env.HOME }}/public_html/winkel/config.php"


# - name: Move admin location
#   command: mv {{ ansible_env.HOME }}/public_html/winkel/admin {{ ansible_env.HOME }}/public_html/winkel/{{ shop_admin_location }}
{'fraction_non_alphanumeric': 0.13094972067039107, 'fraction_numerical': 0.003575418994413408, 'mean_word_length': 2.8921739130434783, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 1, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 20, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5602442', 'n_tokens_mistral': 1458, 'n_tokens_neox': 1452, 'n_words': 381}