<commit_before>---
- hosts: localhost
  tasks:
    - debug: msg="{{ ansible_user_dir }}"
    - name: Remove persistent connection sockets, force new connection
      shell: rm -f {{ ansible_user_dir }}/.ansible/cp/ansible-ssh-* &>/dev/null

# Copy clustertests script
- hosts: stack_nodes
  tasks:
    - set_fact:
        test_dir:     "/var/tmp/cluster-tests"
    - set_fact:
        test_script:  "{{ test_dir }}/clustertests"
        test_logfile: "{{ test_dir }}/clustertests.log"
    - name: Create cluster-tests directory
      file: path="{{ test_dir }}" state=directory
    - name: Copy test script
      synchronize: src="../test/clustertests" dest="{{ test_script }}"
    - name: Delete log file if present
      file: path="{{ test_logfile }}" state=absent
    - name: Create empty log file
      file: path="{{ test_logfile }}" state=touch
       
# Include stack-specific tests, copied then executed
- include: "tests.{{ stack_type }}.yml"

# Pull the log files
- hosts: stack_nodes
  tasks:
    - synchronize: mode=pull src="{{ test_logfile }}" dest="./{{ stack_data_dir }}/{{ inventory_hostname }}_clustertests.log"

# Merge the files together (in inventory order)
- hosts: localhost
  tasks:
    - file: path="./{{ stack_data_dir }}/clustertests.log" state=absent
    - shell: cat "./{{ stack_data_dir }}/{{ item }}_clustertests.log" >> "./{{ stack_data_dir }}/clustertests.log"
      with_items: "{{ groups.stack_nodes | default([]) }}"<commit_msg>Brute-force cleanup after tests, so state is cleaned.<commit_after>---
- hosts: localhost
  tasks:
    - name: Remove persistent connection sockets, force new connection
      shell: rm -f {{ ansible_user_dir }}/.ansible/cp/ansible-ssh-* &>/dev/null

# Copy clustertests script
- hosts: stack_nodes
  tasks:
    - set_fact:
        test_dir:     "/var/tmp/cluster-tests"
    - set_fact:
        test_script:  "{{ test_dir }}/clustertests"
        test_logfile: "{{ test_dir }}/clustertests.log"
    - name: Capture iptables state (for later restore)
      become: true
      become_user: root
      shell: iptables-save > /var/tmp/iptables-rules
    - name: Create cluster-tests directory
      file: path="{{ test_dir }}" state=directory
    - name: Copy test script
      synchronize: src="../test/clustertests" dest="{{ test_script }}"
    - name: Delete log file if present
      file: path="{{ test_logfile }}" state=absent
    - name: Create empty log file
      file: path="{{ test_logfile }}" state=touch
       
# Include stack-specific tests, copied then executed
- include: "tests.{{ stack_type }}.yml"

# Pull the log files
- hosts: stack_nodes
  tasks:
    - synchronize: mode=pull src="{{ test_logfile }}" dest="./{{ stack_data_dir }}/{{ inventory_hostname }}_clustertests.log"

# Merge the files together (in inventory order)
- hosts: localhost
  tasks:
    - file: path="./{{ stack_data_dir }}/clustertests.log" state=absent
    - shell: cat "./{{ stack_data_dir }}/{{ item }}_clustertests.log" >> "./{{ stack_data_dir }}/clustertests.log"
      with_items: "{{ groups.stack_nodes | default([]) }}"

# Cleanup
- hosts: stack_nodes
  tasks:
    - name: Restore iptables state
      become: true
      become_user: root
      shell: iptables-restore < /var/tmp/iptables-rules

# Include platform-specific networking data (only for romana_master_ip used below)
- include: "network.{{ platform }}.yml"

- hosts: controller
  tasks:
  - name: Re-create databases
    shell: "{{ romana_bin_dir }}/{{ item }} -overwriteSchema -rootURL http://{{ romana_master_ip }}:9600"
    with_items:
      - topology
      - tenant
      - ipam
      - policy
  - name: Restart services
    become: true
    become_user: root
    service: name="romana-{{ item }}" state="restarted"
    with_items:
      - topology
      - tenant
      - ipam
      - policy
  - name: Re-run post-install script
    command: /var/tmp/romana-post-install.sh

- hosts: computes
  tasks:
  - name: Truncate /etc/ethers
    become: true
    become_user: root
    copy: content='' dest="/etc/ethers" force=yes
  - name: Restart services
    become: true
    become_user: root
    service: name="{{ item }}" state="started"
    with_items:
      - dnsmasq-calico
      - romana-agent
      - romana-policy-agent
{'fraction_non_alphanumeric': 0.13909155095316544, 'fraction_numerical': 0.0009413979759943516, 'mean_word_length': 2.9388322520852643, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 10, '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': '4977527', 'n_tokens_mistral': 1386, 'n_tokens_neox': 1371, 'n_words': 360}