<commit_before>---
# tasks file for create_worker_instance
- debug: var=worker_instance_type
- name: create a new worker SPOT instance in the private vpc
  local_action:
    module: ec2
    count: "{{ count }}"
    state: present
    region: "{{ region }}"
    key_name: "{{ key_name }}"
    image: "{{ image_hvm }}"
    instance_type: "{{ worker_instance_type }}"
    instance_profile_name: ingest-worker
    group_id: [ "{{ sec_grp_ingest_private_id }}" ]
    wait: true
    wait_timeout: 500
    vpc_subnet_id: "{{ subnet_id_private }}"
    instance_tags:
        project: "{{ tag_project }}"
        subproject: "{{ tag_subproject }}"
        Name: "{{ name_env}}-worker"
    volumes:
    - device_name: /dev/xvda
      device_type: gp2
      volume_size: 8
      delete_on_termination: yes
    spot_price: "{{ spot_bid_price }}"
  register: ec2_worker
  when: ondemand is undefined
- name: create a new worker ON-DEMAND instance in the private vpc
  local_action:
    module: ec2
    count: "{{ count }}"
    state: present
    region: "{{ region }}"
    key_name: "{{ key_name }}"
    image: "{{ image_hvm }}"
    instance_type: "{{ worker_instance_type }}"
    instance_profile_name: ingest-worker
    group_id: [ "{{ sec_grp_ingest_private_id }}" ]
    wait: true
    wait_timeout: 500
    vpc_subnet_id: "{{ subnet_id_private }}"
    instance_tags:
        project: "{{ tag_project }}"
        subproject: "{{ tag_subproject }}"
        Name: "{{ name_env}}-worker"
    volumes:
    - device_name: /dev/xvda
      device_type: gp2
      volume_size: 8
      delete_on_termination: yes
  register: ec2_worker
  when: ondemand is defined
# http://codepoets.co.uk/2014/ansible-random-things/
- name: clear previous instance ips if they match
  local_action: command  ssh-keygen -f "~/.ssh/known_hosts" -R {{ item.private_ip }}  
  with_items: ec2_worker.instances
- debug: var=ec2_worker
- name: Wait for SSH to come up
  wait_for: host={{ item.private_ip }} port=22 delay=60 timeout=320 state=started
  with_items: ec2_worker.instances
<commit_msg>2 paths so no undefined variables.<commit_after>---
# tasks file for create_worker_instance
- debug: var=worker_instance_type
- name: create a new worker SPOT instance in the private vpc
  local_action:
    module: ec2
    count: "{{ count }}"
    state: present
    region: "{{ region }}"
    key_name: "{{ key_name }}"
    image: "{{ image_hvm }}"
    instance_type: "{{ worker_instance_type }}"
    instance_profile_name: ingest-worker
    group_id: [ "{{ sec_grp_ingest_private_id }}" ]
    wait: true
    wait_timeout: 500
    vpc_subnet_id: "{{ subnet_id_private }}"
    instance_tags:
        project: "{{ tag_project }}"
        subproject: "{{ tag_subproject }}"
        Name: "{{ name_env}}-worker"
    volumes:
    - device_name: /dev/xvda
      device_type: gp2
      volume_size: 8
      delete_on_termination: yes
    spot_price: "{{ spot_bid_price }}"
  register: ec2_spot
  when: ondemand is undefined
- name: create a new worker ON-DEMAND instance in the private vpc
  local_action:
    module: ec2
    count: "{{ count }}"
    state: present
    region: "{{ region }}"
    key_name: "{{ key_name }}"
    image: "{{ image_hvm }}"
    instance_type: "{{ worker_instance_type }}"
    instance_profile_name: ingest-worker
    group_id: [ "{{ sec_grp_ingest_private_id }}" ]
    wait: true
    wait_timeout: 500
    vpc_subnet_id: "{{ subnet_id_private }}"
    instance_tags:
        project: "{{ tag_project }}"
        subproject: "{{ tag_subproject }}"
        Name: "{{ name_env}}-worker"
    volumes:
    - device_name: /dev/xvda
      device_type: gp2
      volume_size: 8
      delete_on_termination: yes
  register: ec2_ondemand
  when: ondemand is defined
# http://codepoets.co.uk/2014/ansible-random-things/
- name: clear previous instance ips if they match
  local_action: command  ssh-keygen -f "~/.ssh/known_hosts" -R {{ item.private_ip }}  
  with_items: ec2_spot.instances
  when: ondemand is undefined
- name: clear previous instance ips if they match
  local_action: command  ssh-keygen -f "~/.ssh/known_hosts" -R {{ item.private_ip }}  
  with_items: ec2_ondemand.instances
  when: ondemand is defined
- debug: var=ec2_spot
  when: ondemand is undefined
- debug: var=ec2_ondemand
  when: ondemand is defined
- name: Wait for SSH to come up
  wait_for: host={{ item.private_ip }} port=22 delay=60 timeout=320 state=started
  with_items: ec2_spot.instances
  when: ondemand is undefined
- name: Wait for SSH to come up
  wait_for: host={{ item.private_ip }} port=22 delay=60 timeout=320 state=started
  with_items: ec2_ondemand.instances
  when: ondemand is defined

{'fraction_non_alphanumeric': 0.11784946236559139, 'fraction_numerical': 0.014408602150537634, 'mean_word_length': 3.290590405904059, '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': '4933923', 'n_tokens_mistral': 1650, 'n_tokens_neox': 1583, 'n_words': 386}