From c0dfa72707cb97ba5f02a07cc81857eea521bf34 Mon Sep 17 00:00:00 2001 From: Takashi Okamoto Date: Tue, 28 Aug 2018 11:48:37 +0000 Subject: [PATCH] Separate RedHat specific vars for cri-o. --- roles/cri-o/files/mounts.conf | 1 + roles/cri-o/tasks/main.yaml | 36 +++++++++++++++++++++++++---------- roles/cri-o/vars/redhat.yml | 7 +++++++ 3 files changed, 34 insertions(+), 10 deletions(-) create mode 100644 roles/cri-o/files/mounts.conf create mode 100644 roles/cri-o/vars/redhat.yml diff --git a/roles/cri-o/files/mounts.conf b/roles/cri-o/files/mounts.conf new file mode 100644 index 000000000..b7cde9d8a --- /dev/null +++ b/roles/cri-o/files/mounts.conf @@ -0,0 +1 @@ +/usr/share/rhel/secrets:/run/secrets diff --git a/roles/cri-o/tasks/main.yaml b/roles/cri-o/tasks/main.yaml index 7edfd035e..3d9e67c86 100644 --- a/roles/cri-o/tasks/main.yaml +++ b/roles/cri-o/tasks/main.yaml @@ -1,21 +1,34 @@ --- +- name: gather os specific variables + include_vars: "{{ item }}" + with_first_found: + - files: + - "{{ ansible_distribution|lower }}-{{ ansible_distribution_version|lower|replace('/', '_') }}.yml" + - "{{ ansible_distribution|lower }}-{{ ansible_distribution_release }}.yml" + - "{{ ansible_distribution|lower }}-{{ ansible_distribution_major_version|lower|replace('/', '_') }}.yml" + - "{{ ansible_distribution|lower }}.yml" + - "{{ ansible_os_family|lower }}-{{ ansible_architecture }}.yml" + - "{{ ansible_os_family|lower }}.yml" + - defaults.yml + paths: + - ../vars + skip: true + tags: + - facts + - name: Add OpenShift Origin repository yum_repository: name: origin description: OpenShift Origin Repo baseurl: "{{ crio_rhel_repo_base_url }}" gpgcheck: no - when: - - ansible_os_family == 'RedHat' + when: ansible_distribution in ["CentOS","RedHat"] and not is_atomic -- name: Install cri-o +- name: Install cri-o packages package: name: "{{ item }}" state: present - with_items: - - cri-o - - cri-tools - - oci-systemd-hook + with_items: "{{ crio_packages }}" - name: Install cri-o config template: @@ -23,8 +36,11 @@ dest: /etc/crio/crio.conf - name: Copy mounts.conf - shell: | - cp -T /usr/share/containers/mounts.conf /etc/containers/mounts.conf + copy: + src: mounts.conf + dest: /etc/containers/mounts.conf + when: + - ansible_os_family == 'RedHat' - name: Create directory for oci hooks file: @@ -35,6 +51,6 @@ - name: Install cri-o service service: - name: crio + name: "{{ crio_service }}" enabled: yes state: restarted diff --git a/roles/cri-o/vars/redhat.yml b/roles/cri-o/vars/redhat.yml new file mode 100644 index 000000000..962dc9a0a --- /dev/null +++ b/roles/cri-o/vars/redhat.yml @@ -0,0 +1,7 @@ +--- +crio_packages: + - cri-o + - cri-tools + - oci-systemd-hook + +crio_service: crio \ No newline at end of file