<commit_before>---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Ensure apt cache is up to date
  apt:
    update_cache: yes
    cache_valid_time: "{{ cache_timeout }}"
  when:
    - ansible_pkg_mgr == 'apt'

- name: Remove known problem packages
  package:
    name: "{{ item }}"
    state: absent
  register: remove_packages
  until: remove_packages|success
  retries: 5
  delay: 2
  with_items: "{{ pip_install_remove_distro_packages }}"

# Under CentOS, this will add the repo and its key to the keyring
# Under Ubuntu, this will only add the key
# Under SUSE, it will do nothing
- name: Install external repo key with package
  package:
    name: "{{ pip_install_external_repo_key_package }}"
    state: "{{ pip_install_external_repo_key_package_state | default('present') }}"
  when:
    - user_external_repo_key is not defined
    - ansible_pkg_mgr != 'zypper'
  tags:
    - add-repo-keys

- name: Install repo for distro binaries
  apt_repository:
    repo: "{{ uca_repo }}"
    state: present
    update_cache: yes
    filename: "{{ uca_apt_source_list_filename | default(omit) }}"
  register: uca_add_repo
  until: uca_add_repo|success
  retries: 5
  delay: 2
  when:
    - ansible_pkg_mgr == 'apt'
    - uca_enable
  tags:
    - add-uca-repo

- name: Install external repo key manually (apt)
  apt_key:
    id: "{{ user_external_repo_key.id | default(omit) }}"
    keyserver: "{{ user_external_repo_key.keyserver | default(omit) }}"
    url: "{{ user_external_repo_key.url | default(omit) }}"
    state: present
  when:
    - ansible_pkg_mgr == 'apt'
    - user_external_repo_key is defined
  register: add_keys
  until: add_keys|success
  retries: 5
  delay: 2
  tags:
    - add-repo-keys

- name: Install external repo key manually (rpm)
  rpm_key:
    key: "{{ user_external_repo_key.key }}"
    validate_certs: "{{ user_external_repo_key.validate_certs | default(omit) }}"
    state: present
  when:
    - ansible_pkg_mgr == 'yum'
    - user_external_repo_key is defined
  register: add_keys
  until: add_keys|success
  retries: 5
  delay: 2
  tags:
    - add-repo-keys

- name: Install external repo manually (apt)
  apt_repository:
    repo: "{{ user_external_repo.repo }}"
    state: "{{ user_external_repo.state | default('present') }}"
    update_cache: yes
    filename: "{{ user_external_repo.filename | default(omit) }}"
  register: use_external_repo_apt
  until: use_external_repo_apt|success
  retries: 5
  delay: 2
  when:
    - ansible_pkg_mgr == 'apt'
    - user_external_repo is defined
    - user_external_repo.repo is defined
  tags:
    - add-external-repo

- name: Install external repo manually (yum)
  yum_repository:
    name: "{{ user_external_repo.name }}"
    description: "{{ user_external_repo.description | default(omit) }}"
    baseurl: "{{ user_external_repo.baseurl | default(omit) }}"
    gpgkey: "{{ user_external_repo.gpgkey | default(omit) }}"
    gpgcheck: "{{ user_external_repo.gpgcheck | default(omit) }}"
    enabled: "{{ user_external_repo.enabled | default('yes') }}"
  register: use_external_repo_yum
  until: use_external_repo_yum|success
  retries: 5
  delay: 2
  when:
    - ansible_pkg_mgr == 'yum'
    - user_external_repo is defined
    - user_external_repo.name is defined
  tags:
    - add-external-repo<commit_msg>Allow the manipulation of multiple keys/repos<commit_after>---
# Copyright 2016, Rackspace US, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- name: Ensure apt cache is up to date
  apt:
    update_cache: yes
    cache_valid_time: "{{ cache_timeout }}"
  when:
    - ansible_pkg_mgr == 'apt'

- name: Remove known problem packages
  package:
    name: "{{ item }}"
    state: absent
  register: remove_packages
  until: remove_packages|success
  retries: 5
  delay: 2
  with_items: "{{ pip_install_remove_distro_packages }}"

# Under CentOS, this will add the repo and its key to the keyring
# Under Ubuntu, this will only add the key
# Under SUSE, it will do nothing
- name: Install external repo key with package
  package:
    name: "{{ pip_install_external_repo_key_package }}"
    state: "{{ pip_install_external_repo_key_package_state | default('present') }}"
  when:
    - user_external_repo_key is not defined
    - ansible_pkg_mgr != 'zypper'
  tags:
    - add-repo-keys

- name: Install repo for distro binaries
  apt_repository:
    repo: "{{ uca_repo }}"
    state: present
    update_cache: yes
    filename: "{{ uca_apt_source_list_filename | default(omit) }}"
  register: uca_add_repo
  until: uca_add_repo|success
  retries: 5
  delay: 2
  when:
    - ansible_pkg_mgr == 'apt'
    - uca_enable
  tags:
    - add-uca-repo

- name: Install external repo key manually (apt)
  apt_key:
    id: "{{ item.id | default(omit) }}"
    keyserver: "{{ item.keyserver | default(omit) }}"
    url: "{{ item.url | default(omit) }}"
    state: "{{ item.state | default('present') }}"
  register: add_keys
  until: add_keys|success
  retries: 5
  delay: 2
  with_items: "{{ user_external_repo_keys_list }}"
  when:
    - ansible_pkg_mgr == 'apt'
    - user_external_repo_keys_list is defined
  tags:
    - add-repo-keys

- name: Install external repo key manually (rpm)
  rpm_key:
    key: "{{ item.key }}"
    validate_certs: "{{ item.validate_certs | default(omit) }}"
    state: "{{ item.state | default('present') }}"
  register: add_keys
  until: add_keys|success
  retries: 5
  delay: 2
  with_items: "{{ user_external_repo_keys_list }}"
  when:
    - ansible_pkg_mgr == 'yum'
    - user_external_repo_keys_list is defined
  tags:
    - add-repo-keys

- name: Install external repo manually (apt)
  apt_repository:
    repo: "{{ item.repo }}"
    state: "{{ item.state | default('present') }}"
    update_cache: yes
    filename: "{{ item.filename | default(omit) }}"
  register: use_external_repo_apt
  until: use_external_repo_apt|success
  retries: 5
  delay: 2
  with_items: "{{ user_external_repos_list }}"
  when:
    - ansible_pkg_mgr == 'apt'
    - user_external_repos_list is defined
  tags:
    - add-external-repo

- name: Install external repo manually (yum)
  yum_repository:
    name: "{{ item.name }}"
    description: "{{ item.description | default(omit) }}"
    baseurl: "{{ item.baseurl | default(omit) }}"
    gpgkey: "{{ item.gpgkey | default(omit) }}"
    gpgcheck: "{{ item.gpgcheck | default(omit) }}"
    enabled: "{{ item.enabled | default('yes') }}"
  register: use_external_repo_yum
  until: use_external_repo_yum|success
  retries: 5
  delay: 2
  with_items: "{{ user_external_repos_list }}"
  when:
    - ansible_pkg_mgr == 'yum'
    - user_external_repos_list is defined
  tags:
    - add-external-repo
{'fraction_non_alphanumeric': 0.11147327249022164, 'fraction_numerical': 0.005215123859191656, 'mean_word_length': 3.623869801084991, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, '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': '5733596', 'n_tokens_mistral': 2604, 'n_tokens_neox': 2543, 'n_words': 696}