<commit_before>---
  - name: Provision EC2 instances
    hosts: local
    connection: local
    gather_facts: False
    tags: provisioning
    vars:
      instance_type: t2.micro
      security_group: AppServerGroup  # Change based on your default app server security group
      image: ami-9398d3e0             # Amazon Linux AMI 2016.09.0 (HVM), SSD Volume Type
      region: eu-west-1               # Ireland
      keypair: ansible                # Change based on the keypair you're using
      count: 1

    tasks:
      - name: Create a security group
        local_action:
          module: ec2_group
          name: "{{security_group}}"
          description: "Default group for all applications"
          region: "{{region}}"
          rules:
            - proto: tcp
              #type: ssh
              from_port: 22
              to_port: 22
              cidr_ip: 0.0.0.0/0
            - proto: tcp
              from_port: 80
              to_port: 80
              cidr_ip: 0.0.0.0/0
          rules_egress:
            - proto: all
              #type: all
              cidr_ip: 0.0.0.0/0

      - name: Launch a new EC2 instance
        local_action: ec2
                      group={{security_group}}
                      instance_type={{instance_type}}
                      image={{image}}
                      wait=true
                      region={{region}}
                      keypair={{keypair}}
                      count={{count}}
        register: ec2

      - name: Add the EC2 instances to the local /.hosts file
        local_action: lineinfile
                      dest="./hosts"
                      regexp={{ item.public_ip }}
                      insertafter="[webserver]" line={{ item.public_ip }}
        with_items: "{{ ec2.instances }}"

      - name: Wait for SSH to come up
        local_action: wait_for
                      host={{ item.public_ip }}
                      port=22
                      state=started
        with_items: "{{ ec2.instances }}"

      - name: Add tag to instances
        local_action: ec2_tag
                      resource={{item.id}}
                      region={{region}}
                      state=present
        with_items: "{{ ec2.instances }}"
        args:
          tags:
            Name: GardenAPIServer<commit_msg>Added an Elastic IP for mapping to personal subdomain<commit_after>---
  - name: Provision EC2 instances
    hosts: local
    connection: local
    gather_facts: False
    tags: provisioning
    vars:
      instance_type: t2.micro
      security_group: AppServerGroup  # Change based on your default app server security group
      image: ami-9398d3e0             # Amazon Linux AMI 2016.09.0 (HVM), SSD Volume Type
      region: eu-west-1               # Ireland
      keypair: ansible                # Change based on the keypair you're using
      count: 1

    tasks:
      - name: Create a security group
        local_action:
          module: ec2_group
          name: "{{security_group}}"
          description: "Default group for all applications"
          region: "{{region}}"
          rules:
            - proto: tcp
              #type: ssh
              from_port: 22
              to_port: 22
              cidr_ip: 0.0.0.0/0
            - proto: tcp
              from_port: 80
              to_port: 80
              cidr_ip: 0.0.0.0/0
          rules_egress:
            - proto: all
              #type: all
              cidr_ip: 0.0.0.0/0

      - name: Launch a new EC2 instance
        local_action: ec2
                      group={{security_group}}
                      instance_type={{instance_type}}
                      image={{image}}
                      wait=true
                      region={{region}}
                      keypair={{keypair}}
                      count={{count}}
        register: ec2

      - name: Add the EC2 instances to the local /.hosts file
        local_action: lineinfile
                      dest="./hosts"
                      regexp={{ item.public_ip }}
                      insertafter="[webserver]" line={{ item.public_ip }}
        with_items: "{{ ec2.instances }}"

      - name: Associate the instance with pre-defined elastic IP
        local_action: ec2_eip
                      device_id={{ item.id }}
                      region={{ item.region }}
                      ip=192.168.3.11
        with_items: "{{ ec2.instances }}"

      - name: Wait for SSH to come up
        local_action: wait_for
                      host={{ item.public_ip }}
                      port=22
                      state=started
        with_items: "{{ ec2.instances }}"

      - name: Add tag to instances
        local_action: ec2_tag
                      resource={{item.id}}
                      region={{region}}
                      state=present
        with_items: "{{ ec2.instances }}"
        args:
          tags:
            Name: GardenAPIServer
{'fraction_non_alphanumeric': 0.08702691762801053, 'fraction_numerical': 0.022869864399919046, 'mean_word_length': 1.2361990950226245, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 7, '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': '1320123', 'n_tokens_mistral': 1399, 'n_tokens_neox': 1293, 'n_words': 352}