Zack Williams | 41513bf | 2018-07-07 20:08:35 -0700 | [diff] [blame] | 1 | # 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 Barbarie | bcea2f4 | 2018-03-02 18:46:32 -0500 | [diff] [blame] | 14 | # 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 Barbarie | 2cbffca | 2018-03-26 16:20:03 -0400 | [diff] [blame] | 40 | path: "{{ target_voltha_home }}" |
Stephane Barbarie | bcea2f4 | 2018-03-02 18:46:32 -0500 | [diff] [blame] | 41 | 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 Barbarie | 2cbffca | 2018-03-26 16:20:03 -0400 | [diff] [blame] | 50 | dest: "{{ target_voltha_home }}" |
Stephane Barbarie | bcea2f4 | 2018-03-02 18:46:32 -0500 | [diff] [blame] | 51 | 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 Barbarie | 2cbffca | 2018-03-26 16:20:03 -0400 | [diff] [blame] | 63 | path: "{{ target_voltha_home }}/{{ item }}" |
Stephane Barbarie | bcea2f4 | 2018-03-02 18:46:32 -0500 | [diff] [blame] | 64 | 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 Barbarie | 30f64b8 | 2018-03-28 16:26:12 -0400 | [diff] [blame] | 90 | |
| 91 | - name: VOLT-HA Config | Disable all swaps |
| 92 | command: swapoff -a |
| 93 | when: target == "cluster" |
| 94 | tags: [voltha] |
Stephane Barbarie | 3b67e33 | 2018-04-03 11:45:36 -0400 | [diff] [blame] | 95 | |
| 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] |