| # 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: The environment is properly set on login |
| template: |
| src: bashrc.j2 |
| dest: "{{ target_voltha_home }}/.bashrc" |
| owner: voltha |
| group: voltha |
| mode: "u=rw,g=r,o=r" |
| when: target == "cluster" |
| tags: [voltha] |
| |
| - name: The .bashrc file is executed on ssh login |
| template: |
| src: bash_profile.j2 |
| dest: "{{ target_voltha_home }}/.bash_profile" |
| owner: voltha |
| group: voltha |
| mode: "u=rw,g=r,o=r" |
| when: target == "cluster" |
| tags: [voltha] |
| |
| - name: Required directory exists |
| file: |
| path: "{{ target_voltha_dir }}" |
| state: directory |
| owner: voltha |
| group: voltha |
| when: target == "cluster" |
| tags: [voltha] |
| |
| - name: Configuration files and directories are copied |
| synchronize: |
| src: "/home/vinstall/{{ item }}" |
| dest: "{{ target_voltha_dir }}" |
| archive: no |
| owner: no |
| perms: no |
| recursive: yes |
| links: yes |
| with_items: |
| - compose |
| - nginx_config |
| - envoy |
| - voltha-swarm-start.sh |
| - voltha-swarm-stop.sh |
| when: target == "cluster" |
| tags: [voltha] |
| |
| - name: Insecure registry is configured and permitted |
| synchronize: |
| src: "/home/vinstall/daemon.json" |
| dest: /etc/docker/ |
| archive: no |
| owner: no |
| perms: no |
| recursive: no |
| links: yes |
| when: target == "cluster" |
| tags: [voltha] |
| |
| - name: Configuration directories are owned by voltha |
| file: |
| path: "{{ target_voltha_dir }}/{{ item }}" |
| owner: voltha |
| group: voltha |
| recurse: yes |
| follow: no |
| with_items: |
| - compose |
| - nginx_config |
| - envoy |
| when: target == "cluster" |
| tags: [voltha] |
| |
| - name: Script files are owned by voltha and executable |
| file: |
| path: "{{ target_voltha_dir }}/{{ item }}" |
| owner: voltha |
| group: voltha |
| mode: 0755 |
| follow: no |
| with_items: |
| - voltha-swarm-start.sh |
| - voltha-swarm-stop.sh |
| when: target == "cluster" |
| tags: [voltha] |
| |
| - name: Nginx statup script is executable |
| file: |
| path: "{{ target_voltha_dir }}/nginx_config/start_service.sh" |
| mode: 0755 |
| when: target == "cluster" |
| tags: [voltha] |
| |
| #- name: Configuration files are on the cluster host |
| # copy: |
| # src: "files/consul_config" |
| # dest: "{{ target_voltha_dir }}" |
| # owner: voltha |
| # group: voltha |
| # when: target == "cluster" |
| # tags: [voltha] |
| |
| - name: Docker containers for Voltha are pulled |
| command: docker pull {{ docker_registry }}/{{ item }} |
| with_items: "{{ voltha_containers }}" |
| when: target == "cluster" |
| tags: [voltha] |
| - name: Docker images are re-tagged to expected names |
| command: docker tag {{ docker_registry }}/{{ item }} {{ item }} |
| with_items: "{{ voltha_containers }}" |
| when: target == "cluster" |
| tags: [voltha] |
| - name: Docker images are re-tagged to cluster registry names |
| command: docker tag {{ docker_registry }}/{{ item }} {{ inventory_hostname }}:5001/{{ item }} |
| with_items: "{{ voltha_containers }}" |
| when: target == "cluster" |
| tags: [voltha] |
| #- name: Old docker image tags are removed |
| # command: docker rmi {{ docker_registry }}/{{ item }} |
| # with_items: "{{ voltha_containers }}" |
| # when: target == "cluster" |
| # tags: [voltha] |
| |
| |
| # Update the insecure registry to reflect the current installer. |
| # The installer name can change depending on whether test mode |
| # is being used or not. |
| - name: Enable insecure install registry |
| template: |
| src: "{{ docker_daemon_json }}" |
| dest: "{{ docker_daemon_json_dest }}" |
| register: copy_result |
| when: target == "installer" |
| tags: [voltha] |
| |
| - name: Debain Daemon is reloaded |
| command: systemctl daemon-reload |
| when: copy_result|changed and is_systemd is defined and target == "installer" |
| tags: [voltha] |
| |
| - name: Debian Docker service is restarted |
| service: |
| name: docker |
| state: restarted |
| when: copy_result|changed or user_result|changed |
| when: target == "installer" |
| tags: [voltha] |
| |
| #- name: TEMPORARY RULE TO INSTALL ZOOKEEPER |
| # command: docker pull zookeeper |
| # when: target == "installer" |
| # tags: [voltha] |
| |
| - name: Docker images are re-tagged to registry for push |
| command: docker tag {{ item }} {{ docker_push_registry }}/{{ item }} |
| with_items: "{{ voltha_containers }}" |
| when: target == "installer" |
| tags: [voltha] |
| |
| - name: Docker containers for Voltha are pushed |
| command: docker push {{ docker_push_registry }}/{{ item }} |
| with_items: "{{ voltha_containers }}" |
| when: target == "installer" |
| tags: [voltha] |
| |
| - name: Temporary registry push tags are removed |
| command: docker rmi {{ docker_push_registry }}/{{ item }} |
| with_items: "{{ voltha_containers }}" |
| when: target == "installer" |
| tags: [voltha] |
| |
| - name: voltha components are started |
| command: "{{ target_voltha_dir }}/voltha-swarm-start.sh" |
| become: voltha |
| when: target == "startup" |
| tags: [voltha] |
| |
| - name: cluster specific insecure registry is started |
| command: "docker stack deploy -c {{ target_voltha_dir }}/compose/docker-compose-registry.yml registry" |
| become: voltha |
| when: target == "startup" |
| tags: [voltha] |
| |
| - name: wait for the cluster startup to settle |
| command: "sleep 15" |
| become: voltha |
| when: target == "startup" |
| tags: [voltha] |
| |
| - name: Docker containers in the cluster are pushed to the cluster registry |
| command: docker push {{ inventory_hostname }}:5001/{{ item }} |
| with_items: "{{ voltha_containers }}" |
| when: target == "startup" |
| tags: [voltha] |
| |