
# Copyright 2017-present Open Networking Foundation
#
# 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: User Local bin directory
  file:
    path=/home/{{ ansible_user }}/bin
    state=directory
    owner={{ ansible_user }}
    group={{ ansible_user }}
    mode="0755"

- name: Copy Utility Commands
  copy:
    src=files/bin/{{ item }}
    dest=/home/{{ ansible_user }}/bin
    owner={{ ansible_user }}
    group={{ ansible_user }}
    mode="0755"
  with_items:
    - minify
    - onos-cfg-get
    - onos-cfg-post
    - onos-cfg-delete
    - ping-test.sh

- name: Include Utility Commands in User Path
  lineinfile:
    dest=/home/{{ ansible_user }}/.bashrc
    line="PATH=$HOME/bin:$PATH"
    state=present
    insertafter=EOF

- name: Custom ONOS
  unarchive:
    src=files/onos-1.6.0.ubuntu.tar.gz
    dest=/home/{{ ansible_user }}
    owner={{ ansible_user }}
    group={{ ansible_user }}

- name: ONOS Fabric Configuration
  template:
    src=templates/fabric-network-config.json.j2
    dest=/home/{{ ansible_user }}/fabric-network.config.json
    owner={{ ansible_user }}
    group={{ ansible_user }}
    mode="0644"
