<commit_before>---
- hosts: express.local
  vars_prompt:
    - name: "path"
      prompt: "Enter the path for the desired express site"
      private: no

    - name: "install"
      prompt: "Do you want to install the site as well? (Y/N)"
      private: no

  vars:
      database: "express_{{path}}"

  tasks:
      - name: Create mysql database.
        mysql_db: name={{database}} state=present

      - name: Clear drush cache
        action: command drush cc drush
        args:
            chdir: /data/web/express/

      - name: Create dslm entry for site
        action: command drush dslm-new {{path}} --current
        become: yes
        become_user: dplagnt
        args:
            chdir: /data/web/express/
            creates: /data/web/express/{{path}}/install.php

      - name: Add CU Fit
        command: drush dslm-add-profile cu_fit --current
        become: yes
        become_user: dplagnt
        args:
            chdir: /data/web/express/{{path}}/
            creates: /data/web/express/{{path}}/profiles/cu_fit/cu_fit.info

      - name: Set sites/default permissions
        file: >
            path=/data/web/express/{{path}}/sites/default
            state=directory
            mode=0755
            recurse=yes

      - name: Create settings.php file.
        template: >
            src=templates/express_settings.j2
            dest=/data/web/express/{{path}}/sites/default/settings.php

      - name: Create settings.local.php file.
        template: >
            src=templates/express_settings_local.j2
            dest=/data/web/express/{{path}}/sites/default/settings.local.php

      - name: Install site
        when: install == "Y"
        command: drush si cu_fit -y
        become: yes
        become_user: dplagnt
        register: install_output
        args:
            chdir: /data/web/express/{{path}}/

      - debug: var=install_output.stdout_lines<commit_msg>Added some clean up so that we can support update or clean installs.<commit_after>---
- hosts: express.local
  vars_prompt:
    - name: "path"
      prompt: "Enter the path for the desired express site"
      private: no

    - name: "install"
      prompt: "Do you want to install the site as well? (Y/N)"
      private: no

    - name: "remove"
      prompt: "Do you want to remove any old site files and databases? (Y/N)"
      private: no

  vars:
      database: "express_{{path}}"

  tasks:
      - name: Remove mysql database.
        when: remove == "Y" or remove == "y"
        mysql_db: name={{database}} state=absent

      - name: Remove previous site files
        become: yes
        when: remove == "Y" or remove == "y"
        file: "path=/data/web/express/{{ path }} state=absent"

      - name: Create mysql database.
        mysql_db: name={{database}} state=present

      - name: Clear drush cache
        action: command drush cc drush
        args:
            chdir: "/data/web/express/"

      - name: Create dslm entry for site
        become: yes
        become_user: dplagnt
        command: "drush dslm-new {{path}} --current"
        args:
            chdir: "/data/web/express/"
            creates: "/data/web/express/{{path}}/install.php"

      - name: Add CU Fit
        become: yes
        become_user: dplagnt
        command: drush dslm-add-profile cu_fit --current
        args:
            chdir: "/data/web/express/{{path}}/"
            creates: "/data/web/express/{{path}}/profiles/cu_fit/cu_fit.info"

      - name: Set sites/default permissions
        file: >
            path=/data/web/express/{{path}}/sites/default
            state=directory
            mode=0755
            recurse=yes

      - name: Create settings.php file.
        template: >
            src=templates/express_settings.j2
            dest="/data/web/express/{{path}}/sites/default/settings.php"

      - name: Create settings.local_pre.php file.
        template: >
            src=templates/express_settings_local_pre.j2
            dest="/data/web/express/{{path}}/sites/default/settings.local_pre.php"

      - name: Create settings.local_post.php file.
        template: >
            src=templates/express_settings_local_post.j2
            dest="/data/web/express/{{path}}/sites/default/settings.local_post.php"

      - name: Create temp files directory
        file: path={{ item }} state=directory
        with_items:
          - "/data/files/{{path}}/tmp"

      - name: Install site
        when: install == "Y" or install == "y"
        command: drush si cu_fit -y
        become: yes
        become_user: dplagnt
        register: install_output
        args:
            chdir: "/data/web/express/{{path}}/"

      - debug: var=install_output.stdout_lines
{'fraction_non_alphanumeric': 0.11684724877841512, 'fraction_numerical': 0.0027618440620352665, 'mean_word_length': 1.8812729498164014, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2990062', 'n_tokens_mistral': 1428, 'n_tokens_neox': 1384, 'n_words': 356}