diff --git a/Ansible/all-in-one.yaml b/Ansible/all-in-one.yaml index fb0e13cfb43e8a3db58a1a8dc7a8caa42123ff11..08a414a47f40913d96b3a0fa04d95b7cc8d9c9f4 100644 --- a/Ansible/all-in-one.yaml +++ b/Ansible/all-in-one.yaml @@ -18,9 +18,12 @@ gather_facts: true roles: - role: openstack-proxy - - role: openstack-run-script + - role: openstack-run-script-installcdb - +- hosts: COUCHGROUP[0] + gather_facts: true + roles: + - role: openstack-run-script-cluster #- hosts: COUCHGROUP diff --git a/Ansible/cluster_setup.sh b/Ansible/cluster_setup.sh index cc1867f8555ffea7c1adcdbcb61b7aef87323215..258201356feb6b2d6170f05712274a8be9f857a1 100644 --- a/Ansible/cluster_setup.sh +++ b/Ansible/cluster_setup.sh @@ -1,22 +1,18 @@ -#!/bin/bash +#!/usr/bin/env bash +echo $1 >> IP.txt -echo "== Set variables ==" - -declare var1= echo $1 - -"I was run:" > msg.txt -echo $1 >>msg.txt export declare nodes=($1 $2) +echo $2 >> IP.txt #export declare -a nodes=($2) #export VERSION='3.0.0' export masternode=`echo ${nodes} | cut -f1 -d' '` -export declare othernodes=`echo ${nodes[@]} | sed s/${masternode}//` +export declare othernodes=`echo ${no des[@]} | sed s/${masternode}//` export size=${#nodes[@]} export user='admin' export pass='admin' -export cookie='alexis' export VERSION='3.1.1' -#set up cluter p1 +export cookie='alexis' + for node in ${othernodes} diff --git a/Ansible/host_vars/mrc.yaml b/Ansible/host_vars/mrc.yaml index 8ffa8d695c199de91ac72ded482c1cb133b946d8..7269ae713bdebdf53834c8afa67b944462d29c57 100644 --- a/Ansible/host_vars/mrc.yaml +++ b/Ansible/host_vars/mrc.yaml @@ -4,9 +4,11 @@ availability_zone: melbourne-qh2-uom # Volume volumes: - vol_name: volumedb1 - vol_size: 10 + vol_size: 40 - vol_name: volumedb2 - vol_size: 10 + vol_size: 40 + # - vol_name: volumedb3 + # vol_size: 40 #Security group security_groups: @@ -54,6 +56,8 @@ instances: volumes: 'volumedb1' - name: prueba5 volumes: 'volumedb2' + # - name: prueba6 + # volumes: 'volumedb3' instance_image: 916cad7a-c545-48b2-b36c-d509ee63b3ce #f8b79936-6616-4a22-b55d-0d0a1d27bceb instance_key_name: testkey diff --git a/Ansible/roles/openstack-run-script-cluster/tasks/main.yaml b/Ansible/roles/openstack-run-script-cluster/tasks/main.yaml new file mode 100644 index 0000000000000000000000000000000000000000..2802a6b62da27cfa4112b44807f06d4412706bff --- /dev/null +++ b/Ansible/roles/openstack-run-script-cluster/tasks/main.yaml @@ -0,0 +1,16 @@ +- name: Copy couch db cluster setup script with owner and permissions + copy: + src: /home/alex/CCC/project/comp90024/Ansible/cluster_setup.sh + dest: /home/ubuntu/cluster_setup.sh + owner: ubuntu + group: ubuntu + mode: 0644 + +- name: change script permissions + become: yes + shell: | + sudo chmod 777 /home/ubuntu/cluster_setup.sh + +- name: Run script cluster + become: yes + command: ./cluster_setup.sh {{ groups['COUCHGROUP'][0] }} {{ groups['COUCHGROUP'][1] }} \ No newline at end of file diff --git a/Ansible/roles/openstack-run-script/tasks/main.yaml b/Ansible/roles/openstack-run-script-installcdb/tasks/main.yaml similarity index 58% rename from Ansible/roles/openstack-run-script/tasks/main.yaml rename to Ansible/roles/openstack-run-script-installcdb/tasks/main.yaml index dcea6783ecfe2eb349f8b54a4ffed75395ca4a1f..d5806283e302a2b5a1d8f7051757ff2e99182494 100644 --- a/Ansible/roles/openstack-run-script/tasks/main.yaml +++ b/Ansible/roles/openstack-run-script-installcdb/tasks/main.yaml @@ -1,4 +1,4 @@ -- name: example copying file with owner and permissions +- name: Copy couch db installation script with owner and permissions copy: src: /home/alex/CCC/project/comp90024/Ansible/install_couchdb.sh dest: /home/ubuntu/install_couchdb.sh @@ -10,9 +10,7 @@ become: yes shell: | sudo chmod 777 /home/ubuntu/install_couchdb.sh + - name: install couchdb become: yes - command: sh /home/ubuntu/install_couchdb.sh - -- name: Run script cluster - script: sh /home/alex/CCC/project/comp90024/Ansible/cluster_setup.sh COUCHGROUP[0] COUCHGROUP[1] \ No newline at end of file + command: sh /home/ubuntu/install_couchdb.sh \ No newline at end of file