diff --git a/Ansible/CCCGroup21.pem b/Ansible/CCCGroup21.pem new file mode 100644 index 0000000000000000000000000000000000000000..f656c5a40255caa31a84286d9e46519ee5bc4841 --- /dev/null +++ b/Ansible/CCCGroup21.pem @@ -0,0 +1,27 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIEpAIBAAKCAQEArlj87Mx5ph+RUIkP2fnOmRcSfh5b9S3piERGt/gHAeULUK9F +vskxn7DpAzGPD59QM1TSegdICp8YIEVb2lDvM6MSLk8hby2+ohdcA7AGtSyNURf9 +xCMAi4z4a5xjZp1gzIKnJ7tWcYPKI8xxfKpJ/KCqP7rCuslCCqKGMcJMHVICZSn9 +lyd7C7/G5YjSf4J7wmnA7b7KTRjSP/Tdfo1EGwkG8k6btYimT3u2o6akmtI/97rl +4EYe1Y5xGOmKnyeGjLFi7Od6ufXAUTODNPN2H+IufX+GVdm9lhRxh9yHN6b9MfQy +2J021DrGDOOaqtocAoY1jkKMjXHjyHyrcqpypwIDAQABAoIBAGH1EbaidD8IQYc0 +Wzmnh5KwSe2edSBeeXXclrdKnfVMkXz13YQCWuVUarcmozCt3Eva/p8ddDaziMSo +86DIFH24w8BNKYXj99Xutf5EaqBktcm4ZxZKbEX8IJ+lsJu5FOgTCIPkV/9TgsF2 +XtUigIt2YfGIp1x3M6nyAt/2QPm/ar1nZsY4ebqBo+oL0VKYhhj8AW657FSV3Iza +n5n5AfkcjRyKUvbWvdi/vXsQDW7hwsOxI8TqHcvo12e5Kujm1KuSZ/Ros+DgmvK7 +596I38s0UgT2lPbxq/bgANsoCubIqLq/YA38hWsN/07kz7D+LX12l/+Wppgc0ZgM +mfP1iiECgYEA1Ds02s8ZCcE8mBLA4yhoXiT+QuCK79fX8TYNEt0dJoqS/JbsKBBc +AcH75YY7VeIFn0AHJmlgu26enfVz/qKVxhh6Vb6ooBwryEEJQUeQbOjHfNWZC7qf +No2ZJFZ7/65C2ZhfdBq/BEn0NMeqp5T23zlehcIx2Dz2z0Px5odAZqkCgYEA0k20 +pPzta04hzh4+a+jsB9Ric4/0BfZfFg1t2AfXkSrbB2pdKFCw+CbJtHrAP4Dr/EUn +153YEAd2ZkZCO+UWB8vc7J++yhYoqVNDa7/pyNJnyYV3z8o//+c1NawCsy2KIVLc +YG4pe1WYPce7PyjeVvFsK9cIFQfG6yi2v/cx8M8CgYEAo7U78yDXBoBJdmDY6yCL +STut6fZ9Fb9gck8oTInFZ6py8WaVqd3cqvpwjT862+eqQIpKOaYFmO8eaWgh3qSZ +daICE8wrFL5GQ4VvVyyVynzRDIlTMgn1sEYPgEk6AyLvrBtuXggXmn5VYrU1/WjZ ++ZyuPe1rN4rnM0ANA68GzWkCgYEAjqI3T+Nfn3SphuOKUKP0WccZUumihty3Vvya +sHd5JDMdxKTGNA6uSE/+Y9MRSsDEzR+WSy36Gb0F943VZEwWqgkBeNdLjkKDJ3ya +cJ0EEblqvQox3ZN93rFQrGtSlXXghoNthlWQ+t5t2BD8FXVBf1RUmlNIXwMcTega +Mo6Up48CgYAkZjY+U7R/AXGGFOD2pTEbX4h7VJ/nUoOTgvZdwW9p8rN1IoNSeSSY +QE0/wBylRMfHYXUmpurdbPSW62XTzj6cWQistWFrCuMvZV+D0JMRrsDoNbdq+EYr +DJ7LLnXcXVUREketYEzRiObc8mUfC1Qbj0JCel7Get1s9rhgKOo0zQ== +-----END RSA PRIVATE KEY----- diff --git a/Ansible/exec-infrastructure.sh b/Ansible/exec-infrastructure.sh new file mode 100644 index 0000000000000000000000000000000000000000..969513029ffb602bcc3e58c0e349a59488f72386 --- /dev/null +++ b/Ansible/exec-infrastructure.sh @@ -0,0 +1,11 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# + +. ./openrc.sh; ansible-playbook -i hosts --ask-become-pass nectar.yml \ No newline at end of file diff --git a/Ansible/host_vars/docker_vars.yaml b/Ansible/host_vars/docker_vars.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c6757ba0de1a305b8e2391e254a68c2390c1442e --- /dev/null +++ b/Ansible/host_vars/docker_vars.yaml @@ -0,0 +1,14 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +--- +volumes: + - device: /dev/vdb + mountpoint: /var/lib/docker + diff --git a/Ansible/host_vars/vars.yaml b/Ansible/host_vars/vars.yaml new file mode 100644 index 0000000000000000000000000000000000000000..9f195de696c89fe2fd1abc771bb285e5b5d486f8 --- /dev/null +++ b/Ansible/host_vars/vars.yaml @@ -0,0 +1,97 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +# common vars +availability_zone: melbourne-qh2-uom + +# volume +volumes: + - vol_name: volume1 + vol_size: 60 + - vol_name: volume2 + vol_size: 60 + - vol_name: volume3 + vol_size: 60 + +volumes_web: + - vol_name: volume4 + vol_size: 30 + +# security group +security_groups: + - name: ssh + description: "ssh security group" + rules: + - protocol: tcp + port_range_min: 22 + port_range_max: 22 + remote_ip_prefix: 0.0.0.0/0 + - name: http + description: "http security group" + rules: + - protocol: tcp + port_range_min: 80 + port_range_max: 80 + remote_ip_prefix: 0.0.0.0/0 + - protocol: tcp + port_range_min: 443 + port_range_max: 443 + remote_ip_prefix: 0.0.0.0/0 + - name: docker + description: "docker security group" + rules: + - protocol: tcp + port_range_min: 2376 + port_range_max: 2377 + remote_ip_prefix: 0.0.0.0/0 + - name: couchdb + description: "couchdb security group" + rules: + - protocol: tcp + port_range_min: 5984 + port_range_max: 5984 + remote_ip_prefix: 0.0.0.0/0 + - protocol: tcp + port_range_min: 5986 + port_range_max: 5986 + remote_ip_prefix: 0.0.0.0/0 + - protocol: tcp + port_range_min: 4369 + port_range_max: 4369 + remote_ip_prefix: 0.0.0.0/0 + - protocol: tcp + port_range_min: 9100 + port_range_max: 9200 + remote_ip_prefix: 0.0.0.0/0 + - name: web-service + description: "open webservice port" + rules: + - protocol: tcp + port_range_min: 8080 + port_range_max: 8080 + remote_ip_prefix: 0.0.0.0/0 +# instance +instances: + - name: Server1 + volumes: ['volume1'] + + - name: server2 + volumes: ['volume2'] + +instances_web: + - name: Server3 + volumes: ['volume3'] + + - name: server4 + volumes: ['volume4'] + +instance_image: 45225edb-66d8-4fd0-bf41-132a31a18166 +instance_key_name: CCCGroup21 +instance_flavor: uom.mse.2c9g +instance_network: qh2-uom-internal diff --git a/Ansible/hosts b/Ansible/hosts new file mode 100644 index 0000000000000000000000000000000000000000..e4e0443167b57661cadc8cd40ebdebfb2e0538e0 --- /dev/null +++ b/Ansible/hosts @@ -0,0 +1,15 @@ +[HOSTS] + +[HOSTS:vars] +ansible_python_interpreter=/usr/bin/python3 +ansible_user=ubuntu +ansible_ssh_private_key_file=/etc/ansible/CCCGroup21.pem +ansible_ssh_common_args='-o StrictHostKeyChecking=no' + +[WEBHOSTS] + +[WEBHOSTS:vars] +ansible_python_interpreter=/usr/bin/python3 +ansible_user=ubuntu +ansible_ssh_private_key_file=/etc/ansible/CCCGroup21.pem +ansible_ssh_common_args='-o StrictHostKeyChecking=no' diff --git a/Ansible/nectar.yaml b/Ansible/nectar.yaml new file mode 100644 index 0000000000000000000000000000000000000000..bc1f4cd6d6eefa79d2d3adb923cad83875937ac3 --- /dev/null +++ b/Ansible/nectar.yaml @@ -0,0 +1,86 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +- hosts: localhost + vars_files: + - host_vars/vars.yaml + gather_facts: true + + roles: + - role: openstack-common + - role: openstack-volume + - role: openstack-security-group + - role: openstack-instance + + +- hosts: HOSTS + vars_files: + - host_vars/docker_vars.yaml + gather_facts: true + + tasks: + # add server proxy + - name: add proxy + become: yes + lineinfile: + path: /etc/environment + state: present + line: "{{ item }}" + with_items: "{{ proxy }}" + # configure docker proxy + - name: configure docker proxy + become: yes + command: sudo mkdir -p /etc/systemd/system/docker.service.d + - name: create a http proxy conf file + become: yes + copy: + dest: /etc/systemd/system/docker.service.d/http-proxy.conf + force: no + content: | + [Service] + Environment="HTTP_PROXY=http://wwwproxy.unimelb.edu.au:8000" + - name: create a https proxy conf file + become: yes + copy: + dest: /etc/systemd/system/docker.service.d/https-proxy.conf + force: no + content: | + [Service] + Environment="HTTP_PROXY=http://wwwproxy.unimelb.edu.au:8000" + - name: Flush changes + become: yes + command: sudo systemctl daemon-reload + - name: restart docker + become: yes + command: sudo systemctl restart docker + roles: + - role: infra-common + - role: infra-volumes + - role: infra-docker + - role: openstack-proxy + + +- hosts: WEBHOSTS + vars_files: + - host_vars/docker_vars.yaml + gather_facts: true + + roles: + - role: infra-common + - role: infra-volumes + - role: infra-docker + - role: openstack-proxy + +- hosts: HOSTS + gather_facts: true + + roles: + - role: launch-couchdb + # - role: twitter-harvester + diff --git a/Ansible/openrc.sh b/Ansible/openrc.sh new file mode 100644 index 0000000000000000000000000000000000000000..8c3da38cfe0226b44b40d09d436eb6e5f55fe0ab --- /dev/null +++ b/Ansible/openrc.sh @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +# To use an OpenStack cloud you need to authenticate against the Identity +# service named keystone, which returns a **Token** and **Service Catalog**. +# The catalog contains the endpoints for all services the user/tenant has +# access to - such as Compute, Image Service, Identity, Object Storage, Block +# Storage, and Networking (code-named nova, glance, keystone, swift, +# cinder, and neutron). +# +# *NOTE*: Using the 3 *Identity API* does not necessarily mean any other +# OpenStack API is version 3. For example, your cloud provider may implement +# Image API v1.1, Block Storage API v2, and Compute API v2.0. OS_AUTH_URL is +# only for the Identity API served through keystone. +export OS_AUTH_URL=https://keystone.rc.nectar.org.au:5000/v3/ +# With the addition of Keystone we have standardized on the term **project** +# as the entity that owns the resources. +export OS_PROJECT_ID=ea2dfc1d5cc742debb1bfc70d0cdeb48 +export OS_PROJECT_NAME="unimelb-comp90024-2020-grp-21" +export OS_USER_DOMAIN_NAME="Default" +if [ -z "$OS_USER_DOMAIN_NAME" ]; then unset OS_USER_DOMAIN_NAME; fi +export OS_PROJECT_DOMAIN_ID="default" +if [ -z "$OS_PROJECT_DOMAIN_ID" ]; then unset OS_PROJECT_DOMAIN_ID; fi +# unset v2.0 items in case set +unset OS_TENANT_ID +unset OS_TENANT_NAME +# In addition to the owning entity (tenant), OpenStack stores the entity +# performing the action as the **user**. +export OS_USERNAME="sagar.chaudhari@student.unimelb.edu.au" +# With Keystone you pass the keystone password. +echo "Please enter your OpenStack Password for project $OS_PROJECT_NAME as user $OS_USERNAME: " +read -sr OS_PASSWORD_INPUT +export OS_PASSWORD=$OS_PASSWORD_INPUT +# If your configuration has multiple regions, we set that information here. +# OS_REGION_NAME is optional and only valid in certain environments. +export OS_REGION_NAME="Melbourne" +# Don't leave a blank variable, unset it if it was empty +if [ -z "$OS_REGION_NAME" ]; then unset OS_REGION_NAME; fi +export OS_INTERFACE=public +export OS_IDENTITY_API_VERSION=3 \ No newline at end of file diff --git a/Ansible/roles/infra-common/tasks/main.yaml b/Ansible/roles/infra-common/tasks/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..e5a1037682ad0333432df0cf268c039b8ed6d0a7 --- /dev/null +++ b/Ansible/roles/infra-common/tasks/main.yaml @@ -0,0 +1,29 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +--- +- name: Gather facts of remote host + setup: + gather_subset: all + +- name: Install dependencies + tags: always + become: yes + apt: + name: ['apt-transport-https', 'build-essential', 'ca-certificates', 'curl', 'git', 'python3-dev', 'python3-pip', 'python3-setuptools', 'software-properties-common', 'unzip', 'vim'] + state: latest + install_recommends: no + update_cache: yes + +- name: Update pip + tags: always + become: yes + pip: + name: ['pip'] + state: latest \ No newline at end of file diff --git a/Ansible/roles/infra-docker/tasks/main.yaml b/Ansible/roles/infra-docker/tasks/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..436120ebf3283d4c5f6786977aa24560a0d35881 --- /dev/null +++ b/Ansible/roles/infra-docker/tasks/main.yaml @@ -0,0 +1,57 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +--- +- name: Uninstall old versions of docker + tags: 'docker' + become: yes + apt: + name: ['docker', 'docker-engine', 'docker.io'] + state: absent + +- name: Install dependencies + tags: 'docker' + become: yes + apt: + name: ['apt-transport-https', 'ca-certificates', 'curl', 'python-setuptools', 'software-properties-common'] + state: latest + install_recommends: no + update_cache: yes + +- name: Add Docker apt repository key + tags: 'docker' + become: yes + apt_key: + url: https://download.docker.com/linux/ubuntu/gpg + state: present + +- name: Add Docker apt repository and update apt cache + tags: 'docker' + become: yes + apt_repository: + repo: "deb https://download.docker.com/linux/{{ ansible_distribution|lower }} {{ ansible_distribution_release }} stable" + mode: '644' + update_cache: yes + state: present + +- name: Install docker + tags: 'docker' + become: yes + apt: + name: ['docker-ce'] + state: latest + install_recommends: no + update_cache: yes + +- name: Install docker-compose + tags: 'docker' + become: yes + pip: + name: ['docker-compose'] + state: latest \ No newline at end of file diff --git a/Ansible/roles/infra-volumes/defaults/main.yaml b/Ansible/roles/infra-volumes/defaults/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..f8b14807f70d58b5b759d698b3a861fa62139e38 --- /dev/null +++ b/Ansible/roles/infra-volumes/defaults/main.yaml @@ -0,0 +1,13 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +--- +volumes: + - mountpoint: /var/lib/docker + diff --git a/Ansible/roles/infra-volumes/tasks/main.yaml b/Ansible/roles/infra-volumes/tasks/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c79defea234309606b00513fbd51b6bfca8add45 --- /dev/null +++ b/Ansible/roles/infra-volumes/tasks/main.yaml @@ -0,0 +1,60 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +--- +- name: Install dependencies + tags: 'volumes' + become: yes + apt: + name: ['xfsprogs'] + state: latest + install_recommends: no + update_cache: yes + +- name: Make file system + tags: 'volumes' + become: yes + filesystem: + fstype: xfs + dev: "{{ item.device }}" + when: item.device is defined + with_items: + - "{{ volumes }}" + +- name: Checking folders + tags: 'volumes' + become: yes + stat: + path: "{{ item.mountpoint }}" + register: directory_stats + with_items: + - "{{ volumes }}" + +- name: Create directory + tags: 'volumes' + become: yes + file: + path: "{{ item.item.mountpoint }}" + recurse: yes + state: directory + when: item.stat.exists == false + with_items: + - "{{ directory_stats.results }}" + +- name: Mount device + tags: 'volumes' + become: yes + mount: + path: "{{ item.mountpoint }}" + src: "{{ item.device }}" + fstype: xfs + state: mounted + when: item.device is defined + with_items: + - "{{ volumes }}" \ No newline at end of file diff --git a/Ansible/roles/launch-couchdb/tasks/main.yml b/Ansible/roles/launch-couchdb/tasks/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..66ad92f7f64389b431b26020480b2678f075604e --- /dev/null +++ b/Ansible/roles/launch-couchdb/tasks/main.yml @@ -0,0 +1,26 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +- name: docker pull couchdb + command: sudo docker pull couchdb:latest + become: yes + +- name: Run a CouchDB Docker Container + become: yes + become_user: root + command: sudo docker run -d --name couchdb --log-opt max-size=100m --restart always -p 5984:5984 -p 5986:5986 -p 4369:4369 -p 9100-9200:9100-9200 -v /home/ubuntu/common/data:/opt/couchdb/data -e COUCHDB_USER='admin' -e COUCHDB_PASSWORD='password' -e COUCHDB_SECRET='mysecret' couchdb -setcookie mycookie + +- name: Curl command + become: yes + become_user: root + shell: curl -sL https://deb.nodesource.com/setup_8.x + args: + warn: no + + diff --git a/Ansible/roles/openstack-common/tasks/main.yaml b/Ansible/roles/openstack-common/tasks/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c83a4bb5d95a61845182978cc75bad544d212f0d --- /dev/null +++ b/Ansible/roles/openstack-common/tasks/main.yaml @@ -0,0 +1,30 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +# install dependancies in the host +- name: Install pip + become: yes + apt: + name: ['python3-pip'] + state: latest + update_cache: yes + when: ansible_distribution == "Ubuntu" + +- name: Update pip + become: yes + pip: + name: ['pip'] + state: latest + +- name: Install openstacksdk + become: yes + pip: + name: ['openstacksdk'] + state: latest + diff --git a/Ansible/roles/openstack-instance/tasks/main.yaml b/Ansible/roles/openstack-instance/tasks/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..b053dfc49ac431fae9bf8b94882923d310f5721f --- /dev/null +++ b/Ansible/roles/openstack-instance/tasks/main.yaml @@ -0,0 +1,76 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +# Create an instance on MRC +- name: Create an instance + os_server: + name: '{{ item.name }}' + image: '{{ instance_image }}' + key_name: '{{ instance_key_name }}' + flavor: '{{ instance_flavor}}' + availability_zone: '{{ availability_zone }}' + network: '{{ instance_network }}' + security_groups: '{{ sg_names }}' + volumes: '{{ item.volumes }}' + auto_floating_ip: yes + wait: yes + timeout: 600 + state: present + loop: '{{ instances }}' + register: os_instance + +- name: Create an instance + os_server: + name: '{{ item.name }}' + image: '{{ instance_image }}' + key_name: '{{ instance_key_name }}' + flavor: '{{ instance_flavor}}' + availability_zone: '{{ availability_zone }}' + network: '{{ instance_network }}' + security_groups: '{{ sg_names }}' + volumes: '{{ item.volumes }}' + auto_floating_ip: yes + wait: yes + timeout: 600 + state: present + loop: '{{ instances_web }}' + register: os_instance_web + +- debug: + msg: "Instance {{ item.openstack.name }} has been created. IP address is {{ item.openstack.public_v4 }}" + with_items: + - '{{ os_instance.results }}' + - '{{ os_instance_web.results }}' + when: item.openstack is defined + +- name: Wait for connecetion + wait_for: + host: "{{ item.openstack.public_v4 }}" + port: 22 + timeout: 120 + search_regex: OpenSSH + with_items: + - '{{ os_instance.results }}' + - '{{ os_instance_web.results }}' + when: item.openstack is defined + +# add hosts to ansible memory inventory +- name: Add host + add_host: + name: '{{ item.openstack.public_v4 }}' + groups: HOSTS + loop: '{{ os_instance.results }}' + when: item.openstack is defined + +- name: Add web host + add_host: + name: '{{ item.openstack.public_v4 }}' + groups: WEBHOSTS + loop: '{{ os_instance_web.results }}' + when: item.openstack is defined diff --git a/Ansible/roles/openstack-proxy/tasks/main.yml b/Ansible/roles/openstack-proxy/tasks/main.yml new file mode 100644 index 0000000000000000000000000000000000000000..2a0ea74e11dd3cdee7ad6444058f69a6530e2c07 --- /dev/null +++ b/Ansible/roles/openstack-proxy/tasks/main.yml @@ -0,0 +1,25 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +- name: Insert/Update "proxy setting" in /etc/environment + become: yes + become_user: root + blockinfile: + path: /etc/environment + block: | + HTTP_PROXY: http://wwwproxy.unimelb.edu.au:8000/ + HTTPS_PROXY: http://wwwproxy.unimelb.edu.au:8000/ + http_proxy: http://wwwproxy.unimelb.edu.au:8000/ + https_proxy: http://wwwproxy.unimelb.edu.au:8000/ + No_proxy: http://wwwproxy.unimelb.edu.au:8000/ + +- name: Reboot VM that might have lots of updates to apply + become: yes + reboot: + reboot_timeout: 3600 diff --git a/Ansible/roles/openstack-security-group/tasks/main.yaml b/Ansible/roles/openstack-security-group/tasks/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..72d06f9dd5b134f2bcf8a99e820fec144798a77c --- /dev/null +++ b/Ansible/roles/openstack-security-group/tasks/main.yaml @@ -0,0 +1,35 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +# create a security group +- name: Create a security group + os_security_group: + name: '{{ item.name }}' + description: '{{ item.description }}' + state: present + loop: '{{ security_groups }}' + +- name: Create a list of security group names + set_fact: + sg_names: '{{ sg_names|default([]) + [ item.name ] }}' + loop: '{{ security_groups }}' + +- debug: + msg: "Security groups {{ sg_names }} have been created." + +# create security group rules +- name: Create security group rules + os_security_group_rule: + security_group: '{{ item.0.name }}' + protocol: '{{ item.1.protocol }}' + port_range_min: '{{ item.1.port_range_min }}' + port_range_max: '{{ item.1.port_range_max }}' + remote_ip_prefix: '{{ item.1.remote_ip_prefix }}' + state: present + loop: '{{ security_groups | subelements("rules", "skip_missing=True") }}' diff --git a/Ansible/roles/openstack-volume/tasks/main.yaml b/Ansible/roles/openstack-volume/tasks/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..c3517f054466d284df0a1505b1ba1ebda29e5f68 --- /dev/null +++ b/Ansible/roles/openstack-volume/tasks/main.yaml @@ -0,0 +1,30 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +# create volumes +- name: Create volumes(s) on MRC + os_volume: + display_name: '{{ item.vol_name }}' + size: '{{ item.vol_size }}' + availability_zone: '{{ availability_zone }}' + wait: yes + timeout: 600 + state: present + with_items: + - '{{ volumes }}' + - '{{ volumes_web }}' + register: os_vol + +- name: Create a list of volume IDs + set_fact: + os_vol_ids: '{{ os_vol_ids|default([]) + [ item.id ] }}' + loop: '{{ os_vol.results }}' + +- debug: + msg: "Volume {{ os_vol_ids }} has been created." diff --git a/Ansible/roles/twitter-harvester/tasks/main.yaml b/Ansible/roles/twitter-harvester/tasks/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..0c88addce94603d8897beec8ae832d581f38439c --- /dev/null +++ b/Ansible/roles/twitter-harvester/tasks/main.yaml @@ -0,0 +1,34 @@ +# COMP90024 Cluster and Cloud Computing +# Assignment 2, Semester 1 2020 +# Team 21 +# Vishal Juneja - Melbourne +# Shekher Mudgal - Melbourne +# Sagar Chaudhari - Melbourne +# Sharath Chandran - Melbourne +# Rudolph Almeida - Melbourne +# +- name: Install pip + become: yes + apt: + name: ['python3-pip'] + state: latest + update_cache: yes + when: ansible_distribution == "Ubuntu" + +- name: Update pip + become: yes + pip: + name: ['pip'] + state: latest + +- name: Clone harvester git repo + git: + repo: https://gitlab.eng.unimelb.edu.au/shekherm/comp90024-project-group21.git + dest: /home/ubuntu/CCC2020-Group21 + accept_hostkey: yes + +- name: start stream harvester + shell: python3 ~/CCC2020-Group21/harvester/streamer.py & + +- name: start search harvester + shell: python3 ~/CCC2020-Group21/harvester/scraper.py SAG "$(head -n1 queries.txt| tail-1)" &>/dev/null & \ No newline at end of file diff --git a/couchdb views.txt b/couchdb views.txt new file mode 100644 index 0000000000000000000000000000000000000000..5e2df2ec82ca391c67669f573cce2edff4aeba0e --- /dev/null +++ b/couchdb views.txt @@ -0,0 +1,83 @@ +{ + "_id": "_design/analysis", + "_rev": "48-7682b380d1c6bef39a5f2a1d7d96ff4c", + "views": { + "daniel": { + "reduce": "_count", + "map": "function (doc) {\n if(doc.Daniel_Andrews>0)\n emit(doc.Daniel_Andrews, doc.sentiment);\n}" + }, + "gladys": { + "reduce": "_count", + "map": "function (doc) {\n if(doc.Gladys_Berejiklian>0)\n emit(doc.Gladys_Berejiklian, doc.sentiment);\n}" + }, + "mark": { + "reduce": "_count", + "map": "function (doc) {\r\n if(doc.Mark_McGowan>0)\r\n emit(doc.Mark_McGowan, doc.sentiment);\r\n}" + }, + "steven": { + "reduce": "_count", + "map": "function (doc) {\r\n if(doc.Steven_Marshall>0)\r\n emit(doc.Steven_Marshall, doc.sentiment);\r\n}" + }, + "peter": { + "reduce": "_count", + "map": "function (doc) {\r\n if(doc.Peter_Gutwein>0)\r\n emit(doc.Peter_Gutwein, doc.sentiment);\r\n}" + }, + "total": { + "reduce": "_sum", + "map": "function (doc) {\n emit(doc.id, 1);\n}" + }, + "annastacia_negative": { + "reduce": "_count", + "map": "function (doc) {\n if(doc.Annastacia_Palaszczuk>0 && doc.sentiment==-1 )\n emit(doc.Annastacia_Palaszczuk, doc.sentiment);\n}" + }, + "annastacia_positive": { + "reduce": "_count", + "map": "function (doc) {\n if(doc.Annastacia_Palaszczuk>0 && doc.sentiment==1 )\n emit(doc.Annastacia_Palaszczuk, doc.sentiment);\n}" + }, + "daniel_negative": { + "reduce": "_count", + "map": "function (doc) {\n if(doc.Daniel_Andrews>0 && doc.sentiment==-1)\n emit(doc.Daniel_Andrews, doc.sentiment);\n}" + }, + "daniel_positive": { + "reduce": "_count", + "map": "function (doc) {\n if(doc.Daniel_Andrews>0 && doc.sentiment==1)\n emit(doc.Daniel_Andrews, doc.sentiment);\n}" + }, + "gladys_negative": { + "reduce": "_count", + "map": "function (doc) {\n if(doc.Gladys_Berejiklian>0 && doc.sentiment==-1)\n emit(doc.Gladys_Berejiklian, doc.sentiment);\n}" + }, + "gladys_positive": { + "reduce": "_count", + "map": "function (doc) {\n if(doc.Gladys_Berejiklian>0 && doc.sentiment==1)\n emit(doc.Gladys_Berejiklian, doc.sentiment);\n}" + }, + "annastacia": { + "reduce": "_count", + "map": "function (doc) {\n if(doc.Annastacia_Palaszczuk>0)\n emit(doc.Annastacia_Palaszczuk, doc.sentiment);\n}" + }, + "mark_positive": { + "reduce": "_count", + "map": "function (doc) {\r\n if(doc.Mark_McGowan>0 && doc.sentiment==1)\r\n emit(doc.Mark_McGowan, doc.sentiment);\r\n}" + }, + "mark_negative": { + "reduce": "_count", + "map": "function (doc) {\r\n if(doc.Mark_McGowan>0 && doc.sentiment==-1)\r\n emit(doc.Mark_McGowan, doc.sentiment);\r\n}" + }, + "peter_negative": { + "reduce": "_count", + "map": "function (doc) {\r\n if(doc.Peter_Gutwein>0 && doc.sentiment==-1)\r\n emit(doc.Peter_Gutwein, doc.sentiment);\r\n}" + }, + "peter_positive": { + "reduce": "_count", + "map": "function (doc) {\r\n if(doc.Peter_Gutwein>0 && doc.sentiment==1)\r\n emit(doc.Peter_Gutwein, doc.sentiment);\r\n}" + }, + "steven_positive": { + "reduce": "_count", + "map": "function (doc) {\r\n if(doc.Steven_Marshall>0 && doc.sentiment==1)\r\n emit(doc.Steven_Marshall, doc.sentiment);\r\n}" + }, + "steven_negative": { + "reduce": "_count", + "map": "function (doc) {\r\n if(doc.Steven_Marshall>0 && doc.sentiment==-1)\r\n emit(doc.Steven_Marshall, doc.sentiment);\r\n}" + } + }, + "language": "javascript" +} \ No newline at end of file