You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
3.0 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. ---
  2. - name: Update package management cache (zypper) - SUSE
  3. command: zypper -n --gpg-auto-import-keys ref
  4. register: make_cache_output
  5. until: make_cache_output is succeeded
  6. retries: 4
  7. delay: "{{ retry_stagger | random + 3 }}"
  8. when:
  9. - ansible_pkg_mgr == 'zypper'
  10. tags: bootstrap-os
  11. - name: Add debian 10 required repos
  12. when:
  13. - ansible_distribution == "Debian"
  14. - ansible_distribution_version == "10"
  15. tags:
  16. - bootstrap-os
  17. block:
  18. - name: Add Debian Backports apt repo
  19. apt_repository:
  20. repo: "deb http://deb.debian.org/debian {{ ansible_distribution_release }}-backports main"
  21. state: present
  22. filename: debian-backports
  23. - name: Set libseccomp2 pin priority to apt_preferences on Debian buster
  24. copy:
  25. content: |
  26. Package: libseccomp2
  27. Pin: release a={{ ansible_distribution_release }}-backports
  28. Pin-Priority: 1001
  29. dest: "/etc/apt/preferences.d/libseccomp2"
  30. owner: "root"
  31. mode: "0644"
  32. - name: Update package management cache (APT)
  33. apt:
  34. update_cache: true
  35. cache_valid_time: 3600
  36. when: ansible_os_family == "Debian"
  37. tags:
  38. - bootstrap-os
  39. - name: Remove legacy docker repo file
  40. file:
  41. path: "{{ yum_repo_dir }}/docker.repo"
  42. state: absent
  43. when:
  44. - ansible_os_family == "RedHat"
  45. - not is_fedora_coreos
  46. - name: Install epel-release on RHEL derivatives
  47. package:
  48. name: epel-release
  49. state: present
  50. when:
  51. - ansible_os_family == "RedHat"
  52. - not is_fedora_coreos
  53. - epel_enabled | bool
  54. tags:
  55. - bootstrap-os
  56. - name: Install packages requirements
  57. vars:
  58. # The json_query for selecting packages name is split for readability
  59. # see files/pkgs-schema.json for the structure of `pkgs`
  60. # and the matching semantics
  61. full_query: "[? value | (enabled == null || enabled) && ( {{ filters_os }} ) && ( {{ filters_groups }} ) ].key"
  62. filters_groups: "groups | @ == null || [? contains(`{{ group_names }}`, @)]"
  63. filters_os: "os == null || (os | ( {{ filters_family }} ) || ( {{ filters_distro }} ))"
  64. dquote: !unsafe '"'
  65. # necessary to workaround Ansible escaping
  66. filters_distro: "distributions.{{ dquote }}{{ ansible_distribution }}{{ dquote }} |
  67. @ == `{}` ||
  68. contains(not_null(major_versions, `[]`), '{{ ansible_distribution_major_version }}') ||
  69. contains(not_null(versions, `[]`), '{{ ansible_distribution_version }}') ||
  70. contains(not_null(releases, `[]`), '{{ ansible_distribution_release }}')"
  71. filters_family: "families && contains(families, '{{ ansible_os_family }}')"
  72. package:
  73. name: "{{ pkgs | dict2items | to_json|from_json | community.general.json_query(full_query) }}"
  74. state: present
  75. register: pkgs_task_result
  76. until: pkgs_task_result is succeeded
  77. retries: "{{ pkg_install_retries }}"
  78. delay: "{{ retry_stagger | random + 3 }}"
  79. when: not (ansible_os_family in ["Flatcar", "Flatcar Container Linux by Kinvolk"] or is_fedora_coreos)
  80. tags:
  81. - bootstrap-os