<commit_before>- name: Check if the Wordpress App is already created
  stat: path={{ root_dir }}
  register: wordpress_installed

- name: Download latest Wordpress version
  command: "wp core download --path={{ root_dir }} --locale={{ wordpress_locale }}"
  sudo: no
  when: wordpress_installed.stat.exists == false and wordpress_version == false
- name: Download specific Wordpress version
  sudo: no
  command: wp core download --version="{{  wordpress_version }}" --path={{ root_dir }} --locale="{{ wordpress_locale }}"
  when: wordpress_installed.stat.exists == false and wordpress_version != false

- name: Create the database
  mysql_db: name="{{ database_name }}" state=present
  register: db_created

- name: Define config.php values
  sudo: no
  command: wp core config {{ extra_config }} --dbname="{{ database_name }}" --dbuser="{{ database_user }}" --dbpass="{{ database_pass }}" --dbhost="{{ database_host }}"
  args:
    chdir: "{{ root_dir }}"

- name: Install wordpress app
  sudo: no
  command: "wp core install --url={{ hostname }} --title={{  wordpress_site_name }} --admin_user={{ wordpress_admin_user }} --admin_password={{  <PASSWORD>press_admin_pass }} --admin_email={{ wordpress_admin_email }}"
  args:
    chdir: "{{ root_dir }}"
  when: wordpress_install == "yes"

- name: Add the app domain to the hosts file
  lineinfile:
    dest=/etc/hosts
    line="127.0.0.1 {{ hostname }}"
    state=present

- name: Configure nginx virtualhost
  when: vendors.webserver == "nginx"
  template: src=wordpress.nginx.conf.j2 dest=/etc/nginx/sites-enabled/{{hostname}}.conf
  notify: restart nginx<commit_msg>check if a wordpress app wasn't installed before try to install it again<commit_after>- name: Check if the Wordpress App is already created
  stat: path={{ root_dir }}
  register: wordpress_installed

- name: Download latest Wordpress version
  command: "wp core download --path={{ root_dir }} --locale={{ wordpress_locale }}"
  sudo: no
  when: wordpress_installed.stat.exists == false and wordpress_version == false
- name: Download specific Wordpress version
  sudo: no
  command: wp core download --version="{{  wordpress_version }}" --path={{ root_dir }} --locale="{{ wordpress_locale }}"
  when: wordpress_installed.stat.exists == false and wordpress_version != false

- name: Create the database
  mysql_db: name="{{ database_name }}" state=present
  register: db_created

- name: Check if the Wordpress App is already configured
  stat: path={{ root_dir }}/wp-config.php
  register: wordpress_configured

- name: Define config.php values
  sudo: no
  command: wp core config {{ extra_config }} --dbname="{{ database_name }}" --dbuser="{{ database_user }}" --dbpass="{{ database_pass }}" --dbhost="{{ database_host }}"
  when: wordpress_configured.stat.exists == false
  args:
    chdir: "{{ root_dir }}"

- name: Install wordpress app
  sudo: no
  command: "wp core install --url={{ hostname }} --title={{  wordpress_site_name }} --admin_user={{ wordpress_admin_user }} --admin_password={{  <PASSWORD> }} --admin_email={{ wordpress_admin_email }}"
  args:
    chdir: "{{ root_dir }}"
  # If the config file doesn't in the last check, then it was created in the previous step
  when: wordpress_install == "yes" and wordpress_configured.stat.exists == false

- name: Add the app domain to the hosts file
  lineinfile:
    dest=/etc/hosts
    line="127.0.0.1 {{ hostname }}"
    state=present

- name: Configure nginx virtualhost
  when: vendors.webserver == "nginx"
  template: src=wordpress.nginx.conf.j2 dest=/etc/nginx/sites-enabled/{{hostname}}.conf
  notify: restart nginx
{'fraction_non_alphanumeric': 0.13905079100749376, 'fraction_numerical': 0.0038856508465167916, 'mean_word_length': 4.253644314868804, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3509415', 'n_tokens_mistral': 1118, 'n_tokens_neox': 1096, 'n_words': 337}