<commit_before>---
- hosts: express.local
  vars_prompt:
    - name: "type"
      prompt: "[C]reate an new site or [R]einstall an existing site"
      private: no

    - name: "path"
      prompt: "Enter the path for the site"
      private: no

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

  tasks:
      - name: Create mysql database
        mysql_db:
            name: "{{database}}"
            state: present
        when: type == "C" or type == "c" or type == "create" or type == "Create"

      - name: Clear drush cache
        action: command drush cc drush
        when: type == "C" or type == "c" or type == "create" or type == "Create"
        args:
            chdir: "/data/web/express/"

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


      - name: Add Express
        become: yes
        become_user: dplagnt
        command: drush dslm-add-profile express --current
        when: type == "C" or type == "c" or type == "create" or type == "Create"
        args:
            chdir: "/data/web/express/{{path}}/"
            creates: "/data/web/express/{{path}}/profiles/express/express.info"

      - name: Set file permissions
        become: yes
        when: type == "C" or type == "c" or type == "create" or type == "Create"
        file:
            path: "/data/web/express/{{path}}"
            state: directory
            mode: 0775
            recurse: yes

      - name: Create settings.php file
        when: type == "C" or type == "c" or type == "create" or type == "Create"
        template:
            src: templates/express_settings.j2
            dest: "/data/web/express/{{path}}/sites/default/settings.php"
            mode: 0774

      - name: Create settings.local_pre.php file
        when: type == "C" or type == "c" or type == "create" or type == "Create"
        template:
            src: templates/express_settings_local_pre.j2
            dest: "/data/web/express/{{path}}/sites/default/settings.local_pre.php"
            mode: 0774

      - name: Create settings.local_post.php file
        when: type == "C" or type == "c" or type == "create" or type == "Create"
        template:
            src: templates/express_settings_local_post.j2
            dest: "/data/web/express/{{path}}/sites/default/settings.local_post.php"
            mode: 0774

      - name: Create temp files directory
        when: type == "C" or type == "c" or type == "create" or type == "Create"
        file:
            path: "{{ item }}"
            state: directory
        with_items:
            - "/data/files/{{path}}/tmp"

      - name: Remove files directory
        when: type == "R" or type == "r" or type == "reinstall" or type == "Reinstall"
        file:
            path: "{{ item }}"
            state: absent
        with_items:
            - "/data/files/{{path}}/files"

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

      - debug: var=install_output.stdout_lines<commit_msg>Added 'skeleton' option.<commit_after>---
- hosts: express.local
  vars_prompt:
    - name: "type"
      prompt: "[C]reate an new site, [R]einstall an existing site, or [S]keleton a site (do not run install)"
      private: no

    - name: "path"
      prompt: "Enter the path for the site"
      private: no

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

  tasks:
      - name: Create mysql database
        mysql_db:
            name: "{{database}}"
            state: present
        when: type == "C" or type == "c" or type == "create" or type == "Create" or type == "S" or type == "s" or type == "skeleton" or type == "Skeleton"

      - name: Clear drush cache
        action: command drush cc drush
        when: type == "C" or type == "c" or type == "create" or type == "Create" or type == "S" or type == "s" or type == "skeleton" or type == "Skeleton"
        args:
            chdir: "/data/web/express/"

      - name: Create dslm entry for site
        become: yes
        become_user: dplagnt
        command: "drush dslm-new {{path}} --current"
        when: type == "C" or type == "c" or type == "create" or type == "Create" or type == "S" or type == "s" or type == "skeleton" or type == "Skeleton"
        args:
            chdir: "/data/web/express/"
            creates: "/data/web/express/{{path}}/install.php"


      - name: Add Express
        become: yes
        become_user: dplagnt
        command: drush dslm-add-profile express --current
        when: type == "C" or type == "c" or type == "create" or type == "Create" or type == "S" or type == "s" or type == "skeleton" or type == "Skeleton"
        args:
            chdir: "/data/web/express/{{path}}/"
            creates: "/data/web/express/{{path}}/profiles/express/express.info"

      - name: Set file permissions
        become: yes
        when: type == "C" or type == "c" or type == "create" or type == "Create" or type == "S" or type == "s" or type == "skeleton" or type == "Skeleton"
        file:
            path: "/data/web/express/{{path}}"
            state: directory
            mode: 0775
            recurse: yes

      - name: Create settings.php file
        when: type == "C" or type == "c" or type == "create" or type == "Create" or type == "S" or type == "s" or type == "skeleton" or type == "Skeleton"
        template:
            src: templates/express_settings.j2
            dest: "/data/web/express/{{path}}/sites/default/settings.php"
            mode: 0774

      - name: Create settings.local_pre.php file
        when: type == "C" or type == "c" or type == "create" or type == "Create" or type == "S" or type == "s" or type == "skeleton" or type == "Skeleton"
        template:
            src: templates/express_settings_local_pre.j2
            dest: "/data/web/express/{{path}}/sites/default/settings.local_pre.php"
            mode: 0774

      - name: Create settings.local_post.php file
        when: type == "C" or type == "c" or type == "create" or type == "Create" or type == "S" or type == "s" or type == "skeleton" or type == "Skeleton"
        template:
            src: templates/express_settings_local_post.j2
            dest: "/data/web/express/{{path}}/sites/default/settings.local_post.php"
            mode: 0774

      - name: Create temp files directory
        when: type == "C" or type == "c" or type == "create" or type == "Create" or type == "S" or type == "s" or type == "skeleton" or type == "Skeleton"
        file:
            path: "{{ item }}"
            state: directory
        with_items:
            - "/data/files/{{path}}/tmp"

      - name: Remove files directory
        when: type == "R" or type == "r" or type == "reinstall" or type == "Reinstall"
        file:
            path: "{{ item }}"
            state: absent
        with_items:
            - "/data/files/{{path}}/files"

      - name: Install site
        command: drush si express -y
        become: yes
        become_user: dplagnt
        register: install_output
        when: type == "C" or type == "c" or type == "create" or type == "Create" or type == "R" or type == "r" or type == "reinstall" or type == "Reinstall"
        args:
            chdir: "/data/web/express/{{path}}/"

      - debug: var=install_output.stdout_lines
{'fraction_non_alphanumeric': 0.1460983606557377, 'fraction_numerical': 0.004983606557377049, 'mean_word_length': 1.9229589881180529, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '1968939', 'n_tokens_mistral': 2380, 'n_tokens_neox': 2311, 'n_words': 742}