<commit_before>- name: Launch instances
  hosts: localhost
  connection: local
  gather_facts: False

  tasks:
    - name: Provision a set of instances
      ec2:
         key_name: walkscore_base_keypair2
         group: react-server
         instance_type: t2.medium
         image: ami-d732f0b7
         region: us-west-2
         vpc_subnet_id: subnet-d94db0ae
         assign_public_ip: yes
         instance_profile_name: react-server-box
         wait: yes
         exact_count: 1
         count_tag:
            Name: react-server-box
         instance_tags:
            Name: react-server-box
      register: ec2

    - name: Add all instance public IPs to host group
      add_host: hostname={{ item.public_ip }} groups=react-server-box-hosts
      with_items: '{{ ec2.instances }}'

    - name: Wait for SSH to come up
      wait_for: host={{ item.public_dns_name }} port=22 delay=30 timeout=320 state=started
      with_items: '{{ ec2.instances }}'

- name: Configuration
  hosts: react-server-box-hosts
  user: ubuntu

  tasks:
    - name: Gather facts about instances
      action: ec2_facts

    - name: Set up Docker
      script: docker-setup.sh

    - name: Copy Docker Compose configuration
      copy: src=docker-compose.yml dest=/home/ubuntu/docker-compose.yml mode=0644

    - name: Copy NGINX configuration
      copy: src=../nginx.conf dest=/home/ubuntu/nginx.conf mode=0644

    - name: Deploy services
      shell: sudo docker-compose up -d

    - name: Wait for the service to become available<commit_msg>Using become instead of sudo<commit_after>- name: Launch instances
  hosts: localhost
  connection: local
  gather_facts: False

  tasks:
    - name: Provision a set of instances
      ec2:
         key_name: walkscore_base_keypair2
         group: react-server
         instance_type: t2.medium
         image: ami-d732f0b7
         region: us-west-2
         vpc_subnet_id: subnet-d94db0ae
         assign_public_ip: yes
         instance_profile_name: react-server-box
         wait: yes
         exact_count: 1
         count_tag:
            Name: react-server-box
         instance_tags:
            Name: react-server-box
      register: ec2

    - name: Add all instance public IPs to host group
      add_host: hostname={{ item.public_ip }} groups=react-server-box-hosts
      with_items: '{{ ec2.instances }}'

    - name: Wait for SSH to come up
      wait_for: host={{ item.public_dns_name }} port=22 delay=30 timeout=320 state=started
      with_items: '{{ ec2.instances }}'

- name: Configuration
  hosts: react-server-box-hosts
  user: ubuntu

  tasks:
    - name: Gather facts about instances
      action: ec2_facts

    - name: Set up Docker
      script: docker-setup.sh

    - name: Copy Docker Compose configuration
      copy: src=docker-compose.yml dest=/home/ubuntu/docker-compose.yml mode=0644

    - name: Copy NGINX configuration
      copy: src=../nginx.conf dest=/home/ubuntu/nginx.conf mode=0644

    - name: Deploy services
      shell: docker-compose up -d
      become: true

    - name: Wait for the service to become available
{'fraction_non_alphanumeric': 0.08503071451665051, 'fraction_numerical': 0.020691884901390237, 'mean_word_length': 2.355748373101952, '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': '4735127', 'n_tokens_mistral': 1033, 'n_tokens_neox': 943, 'n_words': 264}