blob: eb1af5279f2f66744aadf8bae99160964ad9470f [file] [log] [blame]
Zack Williams41513bf2018-07-07 20:08:35 -07001# Copyright 2017-present Open Networking Foundation
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7# http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
Stephane Barbariebcea2f42018-03-02 18:46:32 -050014# Note: When the target == "cluster" the installer
15# is running to install voltha in the cluster hosts.
16# Whe the target == "installer" the installer is being
17# created.
18- name: VOLT-HA Config | The environment is properly set on login
19 template:
20 src: bashrc.j2
21 dest: "{{ target_voltha_home }}/.bashrc"
22 owner: voltha
23 group: voltha
24 mode: "u=rw,g=r,o=r"
25 when: target == "cluster"
26 tags: [voltha]
27
28- name: VOLT-HA Config | The .bashrc file is executed on ssh login
29 template:
30 src: bash_profile.j2
31 dest: "{{ target_voltha_home }}/.bash_profile"
32 owner: voltha
33 group: voltha
34 mode: "u=rw,g=r,o=r"
35 when: target == "cluster"
36 tags: [voltha]
37
38- name: VOLT-HA Config | Required directory exists
39 file:
Stephane Barbarie2cbffca2018-03-26 16:20:03 -040040 path: "{{ target_voltha_home }}"
Stephane Barbariebcea2f42018-03-02 18:46:32 -050041 state: directory
42 owner: voltha
43 group: voltha
44 when: target == "cluster"
45 tags: [voltha]
46
47- name: VOLT-HA Config | Configuration files and directories are copied
48 synchronize:
49 src: "{{ install_source }}/{{ item }}"
Stephane Barbarie2cbffca2018-03-26 16:20:03 -040050 dest: "{{ target_voltha_home }}"
Stephane Barbariebcea2f42018-03-02 18:46:32 -050051 archive: no
52 owner: no
53 perms: no
54 recursive: yes
55 links: yes
56 with_items:
57 - k8s
58 when: target == "cluster"
59 tags: [voltha]
60
61- name: VOLT-HA Config | Configuration directories are owned by voltha
62 file:
Stephane Barbarie2cbffca2018-03-26 16:20:03 -040063 path: "{{ target_voltha_home }}/{{ item }}"
Stephane Barbariebcea2f42018-03-02 18:46:32 -050064 owner: voltha
65 group: voltha
66 recurse: yes
67 follow: no
68 with_items:
69 - k8s
70 when: target == "cluster"
71 tags: [voltha]
72
73- name: VOLT-HA Config | Docker containers for Voltha are pulled
74 command: docker pull {{ docker_registry }}/{{ item }}
75 with_items: "{{ voltha_containers }}"
76 when: target == "cluster"
77 tags: [voltha]
78
79- name: VOLT-HA Config | Docker images are re-tagged to expected names
80 command: docker tag {{ docker_registry }}/{{ item }} {{ item }}
81 with_items: "{{ voltha_containers }}"
82 when: target == "cluster"
83 tags: [voltha]
84
85- name: VOLT-HA Config | Docker images are re-tagged to cluster registry names
86 command: docker tag {{ docker_registry }}/{{ item }} {{ inventory_hostname }}:5001/{{ item }}
87 with_items: "{{ voltha_containers }}"
88 when: target == "cluster"
89 tags: [voltha]
Stephane Barbarie30f64b82018-03-28 16:26:12 -040090
91- name: VOLT-HA Config | Disable all swaps
92 command: swapoff -a
93 when: target == "cluster"
94 tags: [voltha]
Stephane Barbarie3b67e332018-04-03 11:45:36 -040095
96- name: VOLT-HA Config | Comment out swap partitions from /etc/fstab
97 command: sed -i -e 's/^\/.* swap .*/#&/' /etc/fstab
98 when: target == "cluster"
99 tag: [voltha]