<commit_before>---
- name: Include OS-specific variables
  include_vars: "{{ item }}"
  with_first_found:
    - "{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml"
    - "{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml"
    - "{{ ansible_distribution }}.yml"
    - "{{ ansible_os_family }}.yml"
    - "default.yml"

- name: Add cloud repository for CentOS
  yum_repository:
    name: "centos-openstack-{{ openstack_version }}"
    description: "CentOS {{ ansible_distribution_major_version }} - OpenStack {{ openstack_version }}"
    baseurl: "http://mirror.centos.org/centos/{{ ansible_distribution_major_version }}/cloud/x86_64/openstack-{{ openstack_version }}/"
    gpgcheck: no
  when: ansible_distribution == 'CentOS' or ansible_distribution == 'Scientific'

- name: Add cloud repository for openSUSE
  zypper_repository:
    name: openstack
    repo: "obs://Cloud:OpenStack:{{ openstack_version }}/openSUSE_Leap_{{ ansible_distribution_version }}"
    disable_gpg_check: true
  when: ansible_distribution == 'openSUSE Leap'

- name: Add gplhost apt-key
  apt_key:
    url: http://syd2.apt-proxy.gplhost.com/debian/repository_key.asc
    state: present
  when: ansible_distribution == 'Debian' and ansible_distribution_major_version == '7'
- name: Add cloud repository for Debian 7
  apt_repository:
    repo: "deb http://syd2.apt-proxy.gplhost.com/debian {{ item }} main"
    state: present
  with_items:
    - juno
    - juno-backports
  when: ansible_distribution == 'Debian' and ansible_distribution_major_version == '7'

- name: Ensure debconf-utils is installed
  package:
    name: debconf-utils
    state: installed

# We include the datasources in the cloud.cfg file anyway, but the cloud-init
# package generates /etc/cloud/cloud.cfg.d/90_dpkg.cfg from debconf, so we
# also need to set this here, or package upgrades will just override it
- name: Set datasources for Ubuntu/Debian
  shell: "echo 'cloud-init cloud-init/datasources multiselect ConfigDrive OpenStack' | debconf-set-selections"

- name: Install cloud packages
  package:
    name: "{{ item }}"
    state: installed
  with_items: "{{ cloud_packages }}"

- name: Add dpkg-divert for cloud.cfg
  command: dpkg-divert --add --rename --quiet --local --divert /etc/cloud/cloud.cfg.debian /etc/cloud/cloud.cfg
  args:
    creates: '/etc/cloud/cloud.cfg.debian'

- name: Remove cloud repository for CentOS
  yum_repository:
    name: "centos-openstack-{{ openstack_version }}"
    state: absent
  when: ansible_distribution == 'CentOS' or ansible_distribution == 'Scientific'

- name: Remove cloud repository for Debian 7
  apt_repository:
    repo: "deb http://syd2.apt-proxy.gplhost.com/debian {{ item }} main"
    state: absent
  with_items:
    - juno<commit_msg>Fix datasource selection for Ubuntu/Debian<commit_after>---
- name: Include OS-specific variables
  include_vars: "{{ item }}"
  with_first_found:
    - "{{ ansible_distribution }}_{{ ansible_distribution_version }}.yml"
    - "{{ ansible_distribution }}_{{ ansible_distribution_major_version }}.yml"
    - "{{ ansible_distribution }}.yml"
    - "{{ ansible_os_family }}.yml"
    - "default.yml"

- name: Add cloud repository for CentOS
  yum_repository:
    name: "centos-openstack-{{ openstack_version }}"
    description: "CentOS {{ ansible_distribution_major_version }} - OpenStack {{ openstack_version }}"
    baseurl: "http://mirror.centos.org/centos/{{ ansible_distribution_major_version }}/cloud/x86_64/openstack-{{ openstack_version }}/"
    gpgcheck: no
  when: ansible_distribution == 'CentOS' or ansible_distribution == 'Scientific'

- name: Add cloud repository for openSUSE
  zypper_repository:
    name: openstack
    repo: "obs://Cloud:OpenStack:{{ openstack_version }}/openSUSE_Leap_{{ ansible_distribution_version }}"
    disable_gpg_check: true
  when: ansible_distribution == 'openSUSE Leap'

- name: Add gplhost apt-key
  apt_key:
    url: http://syd2.apt-proxy.gplhost.com/debian/repository_key.asc
    state: present
  when: ansible_distribution == 'Debian' and ansible_distribution_major_version == '7'
- name: Add cloud repository for Debian 7
  apt_repository:
    repo: "deb http://syd2.apt-proxy.gplhost.com/debian {{ item }} main"
    state: present
  with_items:
    - juno
    - juno-backports
  when: ansible_distribution == 'Debian' and ansible_distribution_major_version == '7'

- name: Ensure debconf is installed
  package:
    name: debconf
    state: installed

# We include the datasources in the cloud.cfg file anyway, but the cloud-init
# package generates /etc/cloud/cloud.cfg.d/90_dpkg.cfg from debconf, so we
# also need to set this here, or package upgrades will just override it
- name: Set datasources for Ubuntu/Debian
  shell: "echo 'cloud-init cloud-init/datasources multiselect ConfigDrive, OpenStack' | debconf-set-selections"

- name: Install cloud packages
  package:
    name: "{{ item }}"
    state: installed
  with_items: "{{ cloud_packages }}"

- name: Add dpkg-divert for cloud.cfg
  command: dpkg-divert --add --rename --quiet --local --divert /etc/cloud/cloud.cfg.debian /etc/cloud/cloud.cfg
  args:
    creates: '/etc/cloud/cloud.cfg.debian'

- name: Remove cloud repository for CentOS
  yum_repository:
    name: "centos-openstack-{{ openstack_version }}"
    state: absent
  when: ansible_distribution == 'CentOS' or ansible_distribution == 'Scientific'

- name: Remove cloud repository for Debian 7
  apt_repository:
    repo: "deb http://syd2.apt-proxy.gplhost.com/debian {{ item }} main"
    state: absent
  with_items:
    - juno
{'fraction_non_alphanumeric': 0.11939763356041593, 'fraction_numerical': 0.004661168877733955, 'mean_word_length': 3.9723707664884134, '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': '5304998', 'n_tokens_mistral': 1901, 'n_tokens_neox': 1787, 'n_words': 451}