summaryrefslogtreecommitdiffstats
path: root/playbooks/openshift-install-cifs.yml
blob: 92ed09c06aad524f1f84743e1fe7cd399e618268 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
---

- hosts: nodes
  serial: 1
  vars: 
    vendor_name: openshift.io
    driver_name: cifs
    driver_location: "{{ playbook_dir }}/../anslib/openshift-flexvolume-cifs/flexvolume-driver/cifs"
    volume_plugin_path: "/usr/libexec/kubernetes/kubelet-plugins/volume/exec"
    openshift_node_service: origin-node
    install_packages:
      - cifs-utils
  tasks:
    - name: Install required packages
      package:
        name: "{{ install_packages }}"
        state: present
    - name: Validate driver exists
      stat:
        path: "{{ driver_location }}"
      register: driver_exists
      delegate_to: localhost
    - name: Fail if driver not found
      fail:
        msg: Driver file not found!
      when: not driver_exists.stat.exists
    - name: Create cifs driver directory
      file:
        state: directory
        path: "{{ volume_plugin_path }}/{{ vendor_name }}~{{ driver_name }}"
    - name: Copy cifs driver
      copy:
        src: "{{ driver_location }}"
        dest: "{{ volume_plugin_path }}/{{ vendor_name }}~{{ driver_name }}/{{ driver_name }}"
        mode: 0755
      register: driver_copy
    - name: Restart OpenShift Node Service
      service:
        name: "{{ openshift_node_service }}"
        state: restarted