<commit_before># vim: ft=ansible
---
######################
# Deploy jobs via JJB
######################
- hosts: jenkins_master
  become: true
  tags:
    - jenkins_master
    - jenkins_jobs

  vars_files:
    - "{{ inventory_dir  }}/{{ vars_files_relative }}/vars/main.yml"
    - ~/.ansible/vars/toad_vars.yml

  pre_tasks:
    - name: Validate Git is installed
      package:
        name: git
        state: present

    - name: config get http.sslVerify
      git_config:
        name: http.sslVerify
        scope: global
      register: http_sslVerify

    - name: config http.sslVerify false
      git_config:
        name: http.sslVerify
        scope: global
        value: false
      when: http_sslVerify.config_value != 'false'

    - name: Locally clone Jenkins job configs
      git:
        repo: "{{ jenkins_job_config_git_src }}"
        dest: "{{ jenkins_job_config_file_src }}"
        version: master
        force: yes
        accept_hostkey: yes
      delegate_to: localhost
      changed_when: false
      tags:
        - clone_configs
      become: false

    - name: Locally clone Jenkins jobs
      git:
        repo: "{{ jenkins_job_builder_git_jobs_src }}"
        dest: "{{ jenkins_job_builder_file_jobs_src }}"
        version: master
        force: yes
        accept_hostkey: yes
      delegate_to: localhost
      changed_when: false
      tags:
        - clone_jobs
      become: false

    - name: Create folder to store config
      file:
        path: "{{ jenkins_job_config_file_dest }}"
        state: directory<commit_msg>Move jenkins master's jobs to jenkins slave in case of docker<commit_after># vim: ft=ansible
---
######################
# Deploy jobs via JJB
######################
- hosts: jenkins_master
  become: true
  tags:
    - jenkins_master
    - jenkins_jobs

  vars_files:
    - "{{ inventory_dir  }}/{{ vars_files_relative }}/vars/main.yml"
    - ~/.ansible/vars/toad_vars.yml

  pre_tasks:
    - name: Validate Git is installed
      package:
        name: git
        state: present

    - name: config get http.sslVerify
      git_config:
        name: http.sslVerify
        scope: global
      register: http_sslVerify

    - name: config http.sslVerify false
      git_config:
        name: http.sslVerify
        scope: global
        value: false
      when: http_sslVerify.config_value != 'false'

    - name: Locally clone Jenkins job configs
      git:
        repo: "{{ jenkins_job_config_git_src }}"
        dest: "{{ jenkins_job_config_file_src }}"
        version: master
        force: yes
        accept_hostkey: yes
      delegate_to: localhost
      changed_when: false
      tags:
        - clone_configs
      become: false

    - name: Locally clone Jenkins jobs
      git:
        repo: "{{ jenkins_job_builder_git_jobs_src }}"
        dest: "{{ jenkins_job_builder_file_jobs_src }}"
        version: master
        force: yes
        accept_hostkey: yes
      delegate_to: localhost
      changed_when: false
      tags:
        - clone_jobs
      become: false

    - name: Change all tasks to jenkins slave (docker)
      replace:
        dest: "{{ jenkins_job_builder_file_jobs_src }}/project-toad.yaml"
        regexp: "partner: master"
        replace: "partner: toad"
      delegate_to: localhost
      when: deploy_type is defined and deploy_type == 'docker'

    - name: Create folder to store config
      file:
        path: "{{ jenkins_job_config_file_dest }}"
        state: directory
{'fraction_non_alphanumeric': 0.10753306497987349, 'fraction_numerical': 0.0, 'mean_word_length': 2.221296296296296, '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': '7611866', 'n_tokens_mistral': 1105, 'n_tokens_neox': 1075, 'n_words': 266}