<commit_before>---
- name: Prepare the odl controller for installation
  hosts: odl_controller
  become: yes
  become_user: root
  vars:
      - ansible_python_interpreter: "/usr/bin/python"
  tasks:
    - name: remove all repos
      command: "rm -f /etc/yum.repos.d/*"

    - name: install the rhos-release RPM
      shell: "yum localinstall -y {{ installer.product.rpm }}"

    - debug:
          msg: "rhos-release {{ installer.product.version }}-director -p {{ installer.product.build }}"

    - name: create necessary repos with for director using rhos-release
      command: "rhos-release {{ installer.product.version }}-director -p {{ installer.product.build }}"
      register: command_result
      until: command_result.stderr.find('Connection reset by peer') == -1
      retries: 40
      delay: 5

    - debug:
          msg: "rhos-release {{ installer.product.version }} -p {{ installer.product.build }}"

    - name: create necessary repos for core using rhos-release
      command: "rhos-release {{ installer.product.version }} -p {{ installer.product.build }}"

    - name: update system packages
      yum:
          state: latest
          name: "*"
      register: update

    - name: reboot the odl controller
      shell: "sleep 2 && shutdown -r now"
      async: 1
      poll: 0
      ignore_errors: true
      when: update|changed

    - name: Waiting for the odl controller to be available
      delegate_to: localhost
      become: no
      wait_for:
          host: "{{ hostvars[inventory_hostname].ansible_ssh_host }}"
          timeout: 120
      when: update|changed

- name: Install OpenDaylight distribution and iptables-service package
  hosts: odl_controller
  become: yes
  become_user: root
  vars:
      - ansible_python_interpreter: "/usr/bin/python"
  tasks:
    - name: Install OpenDaylight and IPTables
      yum: name={{ item }} state=present
      with_items:
        - opendaylight
        - iptables-services

    - name: Make sure the opendaylight service is stopped
      service: name=opendaylight state=stopped

    - name: Start the IPTables service
      service: name=iptables state=started enabled=true

    - name: Clean opendaylight data
      shell:  cd /opt/opendaylight && rm -rf data/* journal/* snapshots/*

- name: Set Iptables rule on openstack nodes
  hosts:
    - controller
    - compute
  become_user: root
  become: yes
  tasks:
    - name: Enable traffic from ODL Controller to nodes
      shell: iptables -I INPUT -s "{{ hostvars[item].ansible_ssh_host }}" -p tcp -j ACCEPT
      with_items: "{{ groups.odl_controller }}"

    - name: Make openvswitch_t a permissive domain
      command: semanage permissive -a openvswitch_t

- name: Set Iptables rules on opendaylight controller
  hosts:<commit_msg>Install Opendaylight RPM using URL<commit_after>---
- name: Prepare the odl controller for installation
  hosts: odl_controller
  become: yes
  become_user: root
  vars:
      - ansible_python_interpreter: "/usr/bin/python"
  tasks:
    - name: remove all repos
      command: "rm -f /etc/yum.repos.d/*"

    - name: install the rhos-release RPM
      shell: "yum localinstall -y {{ installer.product.rpm }}"

    - debug:
          msg: "rhos-release {{ installer.product.version }}-director -p {{ installer.product.build }}"

    - name: create necessary repos with for director using rhos-release
      command: "rhos-release {{ installer.product.version }}-director -p {{ installer.product.build }}"
      register: command_result
      until: command_result.stderr.find('Connection reset by peer') == -1
      retries: 40
      delay: 5

    - debug:
          msg: "rhos-release {{ installer.product.version }} -p {{ installer.product.build }}"

    - name: create necessary repos for core using rhos-release
      command: "rhos-release {{ installer.product.version }} -p {{ installer.product.build }}"

    - name: update system packages
      yum:
          state: latest
          name: "*"
      register: update

    - name: reboot the odl controller
      shell: "sleep 2 && shutdown -r now"
      async: 1
      poll: 0
      ignore_errors: true
      when: update|changed

    - name: Waiting for the odl controller to be available
      delegate_to: localhost
      become: no
      wait_for:
          host: "{{ hostvars[inventory_hostname].ansible_ssh_host }}"
          timeout: 120
      when: update|changed

- name: Install OpenDaylight distribution and iptables-service package
  hosts: odl_controller
  become: yes
  become_user: root
  vars:
      - ansible_python_interpreter: "/usr/bin/python"
  tasks:
    - name: Install OpenDaylight package
      yum: name={{ odl.rpm | default('opendaylight') }} state=present

    - name: Show the OpenDaylight package details
      command: yum info opendaylight

    - name: Install OpenDaylight and IPTables
      yum: name=iptables-services state=present

    - name: Make sure the opendaylight service is stopped
      service: name=opendaylight state=stopped

    - name: Start the IPTables service
      service: name=iptables state=started enabled=true

    - name: Clean opendaylight data
      shell:  cd /opt/opendaylight && rm -rf data/* journal/* snapshots/*

- name: Set Iptables rule on openstack nodes
  hosts:
    - controller
    - compute
  become_user: root
  become: yes
  tasks:
    - name: Enable traffic from ODL Controller to nodes
      shell: iptables -I INPUT -s "{{ hostvars[item].ansible_ssh_host }}" -p tcp -j ACCEPT
      with_items: "{{ groups.odl_controller }}"

    - name: Make openvswitch_t a permissive domain
      command: semanage permissive -a openvswitch_t

- name: Set Iptables rules on opendaylight controller
  hosts:
{'fraction_non_alphanumeric': 0.09671757065121994, 'fraction_numerical': 0.0035106196243637, 'mean_word_length': 2.695201037613489, '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': '1051788', 'n_tokens_mistral': 1761, 'n_tokens_neox': 1691, 'n_words': 524}