| # Note: When the target == "cluster" the installer |
| # is running to install voltha in the cluster hosts. |
| # Whe the target == "installer" the installer is being |
| # created. |
| - name: A .ssh directory for the voltha user exists |
| file: |
| #path: "{{ ansible_env['HOME'] }}/.ssh" |
| path: "{{ target_voltha_home }}/.ssh" |
| state: directory |
| owner: voltha |
| group: voltha |
| tags: [cluster_host] |
| |
| - name: known_hosts file is absent for the voltha user |
| file: |
| path: "{{ target_voltha_home }}/.ssh/known_hosts" |
| state: absent |
| tags: [cluster_host] |
| |
| - name: Known host checking is disabled |
| copy: |
| src: files/ssh_config |
| dest: "{{ target_voltha_home }}/.ssh/config" |
| owner: voltha |
| group: voltha |
| mode: 0600 |
| tags: [cluster_host] |
| |
| - name: Cluster host keys are propagated to all hosts in the cluster |
| copy: |
| src: files/.keys |
| dest: "{{ target_voltha_home }}" |
| owner: voltha |
| group: voltha |
| mode: 0600 |
| tags: [cluster_host] |
| |
| #- name: Required configuration directories are copied |
| # copy: |
| # src: "/home/vinstall/{{ item }}" |
| # dest: "{{ target_voltha_home }}" |
| # owner: voltha |
| # group: voltha |
| # with_items: |
| # - docker-py |
| # - netifaces |
| # - deb_files |
| # when: target == "cluster" |
| # tags: [cluster_host] |
| |
| - name: Required configuration directories are copied |
| synchronize: |
| src: "/home/vinstall/{{ item }}" |
| dest: "{{ target_voltha_home }}" |
| archive: no |
| owner: no |
| perms: no |
| recursive: yes |
| links: yes |
| with_items: |
| - docker-py |
| - netifaces |
| - deb_files |
| tags: [cluster-host] |
| |
| - name: apt lists are up-to-date |
| synchronize: |
| src: "/var/lib/apt/lists" |
| dest: "/var/lib/apt/lists" |
| archive: no |
| owner: no |
| perms: no |
| rsync_opts: |
| - "--exclude=lock" |
| - "--exclude=partial" |
| recursive: yes |
| links: yes |
| tags: [cluster_host] |
| |
| #- name: pre-emptive strike to avoid errors during package installation |
| # apt: |
| # name: "{{ item }}" |
| # state: absent |
| # with_items: |
| # - ubuntu-core-launcher |
| # - snapd |
| # tags: [cluster_host] |
| - name: A voltha directory under /var/log for voltha logs exists |
| file: |
| path: "/var/log/voltha" |
| state: directory |
| tags: [cluster_host] |
| |
| - name: Dependent software is installed (this can take about 10 Min, DONT'T PANIC, go for coffee instead) |
| command: dpkg -R -i "{{ target_voltha_home }}/deb_files" |
| # ignore_errors: true |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| #- name: Dependent software is initialized |
| # command: apt-get -y -f install |
| # when: target == "cluster" |
| # tags: [cluster_host] |
| |
| - name: Python packages are installed |
| command: pip install {{ item }} --no-index --find-links "file://{{ target_voltha_home }}/{{ item }}" |
| with_items: |
| - docker-py |
| - netifaces |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: Configuration directories are deleted |
| file: |
| path: "{{ target_voltha_home }}/{{ item }}" |
| state: absent |
| with_items: |
| - docker-py |
| - netifaces |
| - deb_files |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: Replicated filesystem file is created |
| command: "dd if=/dev/zero of={{ replicated_fs_dir }}/.cluster-fs-file bs=100M count=100" |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: The loop device is set up for file system creation |
| command: "losetup -f {{ replicated_fs_dir }}/.cluster-fs-file" |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: The xfs filesystem is created on the loop device |
| filesystem: |
| fstype: xfs |
| dev: /dev/loop0 |
| opts: -i size=512 |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: The loop device that's no longer needed is removed |
| command: "losetup -D" |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: The registry fileystem file is owned by voltha |
| file: |
| path: "{{ replicated_fs_dir }}/.cluster-fs-file" |
| mode: 0755 |
| owner: voltha |
| group: voltha |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: A brick for a glusterfs mountpoint is created |
| file: |
| path: "{{ replicated_fs_dir }}/brick1" |
| state: directory |
| mode: 0755 |
| owner: voltha |
| group: voltha |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: The replicated filesystem is mounted on boot |
| mount: |
| path: "{{ replicated_fs_dir }}/brick1" |
| src: "{{ replicated_fs_dir }}/.cluster-fs-file" |
| fstype: xfs |
| opts: loop |
| state: mounted |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: A directory for the glusterfs volume is created |
| file: |
| path: "{{ replicated_fs_dir }}/brick1/registry_volume" |
| state: directory |
| mode: 0755 |
| owner: voltha |
| group: voltha |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: Directories for voltha processes are created |
| file: |
| path: "{{ target_voltha_dir }}/{{ item }}" |
| state: directory |
| mode: 0755 |
| owner: voltha |
| group: voltha |
| with_items: |
| - registry_data |
| - consul/data |
| - consul/config |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: The glusterfs service is started |
| service: |
| name: glusterfs-server |
| enabled: yes |
| state: started |
| when: target == "cluster" |
| tags: [cluster_host] |
| |
| - name: The replicated filesystem is mounted on boot |
| mount: |
| path: "{{ target_voltha_dir }}/registry_data" |
| src: "{{ inventory_hostname }}:/registry_volume" |
| fstype: glusterfs |
| opts: "defaults,_netdev,noauto,x-systemd.automount" |
| state: present |
| when: target == "cluster" |
| tags: [cluster_host] |