Skip to content
Snippets Groups Projects
Commit 0a605e61 authored by Diego Alejandro Arias Rodriguez's avatar Diego Alejandro Arias Rodriguez
Browse files

install couchdb form scratch

parent d7b6b570
Branches
No related tags found
No related merge requests found
...@@ -16,11 +16,10 @@ ...@@ -16,11 +16,10 @@
- hosts: COUCHGROUP - hosts: COUCHGROUP
gather_facts: true gather_facts: true
- hosts: COUCHGROUP
roles: roles:
- role: openstack-proxy
- role: openstack-run-script - role: openstack-run-script
#roles:
......
#!/bin/bash #!/bin/bash
echo "== Set variables ==" echo "== Set variables =="
export declare nodes=$1
export declare -a nodes=($2) declare var1= echo $1
export VERSION='3.0.0'
"I was run:" > msg.txt
echo $1 >>msg.txt
export declare nodes=($1 $2)
#export declare -a nodes=($2)
#export VERSION='3.0.0'
export masternode=`echo ${nodes} | cut -f1 -d' '` export masternode=`echo ${nodes} | cut -f1 -d' '`
export declare othernodes=`echo ${nodes[@]} | sed s/${masternode}//` export declare othernodes=`echo ${nodes[@]} | sed s/${masternode}//`
export size=${#nodes[@]} export size=${#nodes[@]}
......
...@@ -50,11 +50,11 @@ security_groups: ...@@ -50,11 +50,11 @@ security_groups:
#Instance #Instance
instances: instances:
- name: couchdb1 - name: prueba4
volumes: 'volumedb1' volumes: 'volumedb1'
- name: couchdb2 - name: prueba5
volumes: 'volumedb2' volumes: 'volumedb2'
instance_image: 34ce7ec8-50f2-4604-a38f-7d81d1c2041d #f8b79936-6616-4a22-b55d-0d0a1d27bceb instance_image: 916cad7a-c545-48b2-b36c-d509ee63b3ce #f8b79936-6616-4a22-b55d-0d0a1d27bceb
instance_key_name: testkey instance_key_name: testkey
instance_flavor: uom.mse.1c4g instance_flavor: uom.mse.1c4g
\ No newline at end of file
echo "====== getting ip ======"
NODENAME=$(/sbin/ip -o -4 addr list eth0 | awk '{print $4}' | cut -d/ -f1)
echo "nodename couchdb@{$NODENAME}"
# Enabling Apache CouchDB repository.
sudo apt update && sudo apt install -y curl apt-transport-https gnupg
curl -L https://couchdb.apache.org/repo/bintray-pubkey.asc | sudo apt-key add -
echo "deb https://apache.bintray.com/couchdb-deb bionic main" | sudo tee -a /etc/apt/sources.list
# Set the password variable.
echo "== setting password for couchdb ===="
COUCHDB_PASSWORD=admin
# Bindaddress: 0.0.0.0 (does not bind to anything).
echo "== Setting up cluster variable for couch =="
echo "couchdb couchdb/mode select clustered
couchdb couchdb/mode seen true
couchdb couchdb/nodename string couchdb@${NODENAME}
couchdb couchdb/nodename seen true
couchdb couchdb/cookie string elmo
couchdb couchdb/cookie seen true
couchdb couchdb/bindaddress string 0.0.0.0
couchdb couchdb/bindaddress seen true
couchdb couchdb/adminpass password ${COUCHDB_PASSWORD}
couchdb couchdb/adminpass seen true
couchdb couchdb/adminpass_again password ${COUCHDB_PASSWORD}
couchdb couchdb/adminpass_again seen true" | sudo debconf-set-selections
# update cache
sudo apt update
# Enter non-interactive mode instead of interactive mode here.
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y couchdb
- 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=localhost,127.0.0.1,localaddress,172.16.0.0/12,.melbourne.rc.nectar.org.au,.storage.unimelb.edu.au,.cloud.unimelb.edu.au
- name: Reboot VM that might have lots of updates to apply
become: yes
reboot:
reboot_timeout: 3600
- name: example copying file with owner and permissions
copy:
src: /home/alex/CCC/project/comp90024/Ansible/install_couchdb.sh
dest: /home/ubuntu/install_couchdb.sh
owner: ubuntu
group: ubuntu
mode: 0644
- name: change script permissions
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 - name: Run script cluster
script: /home/alex/CCC/project/comp90024/Ansible/cluster_setup.sh COUCHGROUP[0] COUCHGROUP[1] script: sh /home/alex/CCC/project/comp90024/Ansible/cluster_setup.sh COUCHGROUP[0] COUCHGROUP[1]
\ No newline at end of file \ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment