From be39f4d67de9e4fd5caea98227c6d16f64ebbfbe Mon Sep 17 00:00:00 2001 From: alex <dariasrodrig@student.unimelb.edu.au> Date: Tue, 25 May 2021 13:03:40 +1000 Subject: [PATCH] ansible --- Ansible/.DS_Store | Bin 0 -> 8196 bytes Ansible/host_vars/couchdb.yaml | 9 +++++ Ansible/host_vars/mrc.yaml | 35 ++++++++++++++++ Ansible/inventory.ini | 0 Ansible/mrc.yaml | 15 +++++++ Ansible/roles/.DS_Store | Bin 0 -> 10244 bytes Ansible/roles/openstack-IP/main.yaml | 5 +++ Ansible/roles/openstack-common/.DS_Store | Bin 0 -> 6148 bytes .../roles/openstack-common/tasks/main.yaml | 22 ++++++++++ .../roles/openstack-couchdb/tasks/main.yml | 13 ++++++ Ansible/roles/openstack-images/.DS_Store | Bin 0 -> 6148 bytes .../roles/openstack-images/tasks/main.yaml | 15 +++++++ Ansible/roles/openstack-instance/.DS_Store | Bin 0 -> 6148 bytes .../roles/openstack-instance/tasks/main.yaml | 38 ++++++++++++++++++ .../roles/openstack-security-group/.DS_Store | Bin 0 -> 6148 bytes .../openstack-security-group/tasks/main.yaml | 27 +++++++++++++ .../roles/openstack-volume-snapshot/.DS_Store | Bin 0 -> 6148 bytes .../openstack-volume-snapshot/tasks/main.yaml | 12 ++++++ .../roles/openstack-volume/tasks/main.yaml | 21 ++++++++++ Ansible/run-mrc.sh | 3 ++ .../unimelb-comp90024-2021-grp-62-openrc.sh | 38 ++++++++++++++++++ 21 files changed, 253 insertions(+) create mode 100644 Ansible/.DS_Store create mode 100644 Ansible/host_vars/couchdb.yaml create mode 100644 Ansible/host_vars/mrc.yaml create mode 100644 Ansible/inventory.ini create mode 100644 Ansible/mrc.yaml create mode 100644 Ansible/roles/.DS_Store create mode 100644 Ansible/roles/openstack-IP/main.yaml create mode 100644 Ansible/roles/openstack-common/.DS_Store create mode 100644 Ansible/roles/openstack-common/tasks/main.yaml create mode 100644 Ansible/roles/openstack-couchdb/tasks/main.yml create mode 100644 Ansible/roles/openstack-images/.DS_Store create mode 100644 Ansible/roles/openstack-images/tasks/main.yaml create mode 100644 Ansible/roles/openstack-instance/.DS_Store create mode 100644 Ansible/roles/openstack-instance/tasks/main.yaml create mode 100644 Ansible/roles/openstack-security-group/.DS_Store create mode 100644 Ansible/roles/openstack-security-group/tasks/main.yaml create mode 100644 Ansible/roles/openstack-volume-snapshot/.DS_Store create mode 100644 Ansible/roles/openstack-volume-snapshot/tasks/main.yaml create mode 100644 Ansible/roles/openstack-volume/tasks/main.yaml create mode 100644 Ansible/run-mrc.sh create mode 100644 Ansible/unimelb-comp90024-2021-grp-62-openrc.sh diff --git a/Ansible/.DS_Store b/Ansible/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..303519d62799ae1fb120892d70f23ee65dacfea9 GIT binary patch literal 8196 zcmZQzU|@7AO)+F(kYHe7;9!8z0^AH(0Z1N%F(jFwB7z|E7#IW?7~&bq7!nzZ7>Ye} zpmL+sXb6mkz-S1JhQMeDjE2DA3IRrlb2xC+`w-btax?@+LtsRP0H}OWfVAxy9H4Xq zga%15FfuTJy8w&~3@oq!Vg&aC7(j9$tsokt6-0xyGBAQzU^Bp485p5j8NuBUkUjyh zQH%^=?F@`yn?d4W?F@`yn;94wA=()jp*Ax@dnk+$?F@_%?F@`y+rdVT5~Cq78Ukn` z0P4GQGGs91GZZtFAot(%laq4tlNcb`*^z;PLGM2pfc0b1kyKt>0M&6KsURn_xWvHV zIwKP^3o9Et2MF+T#0F>Nmj{<5mXsDdB^E`4cmate8A(ufNPd0}oSm2ymYG@}FCgNa zpI4HYnU`7wQXZU{lA4rQ6ce7Amy%!ZlwX>cQVcc+D!~Z?@dD!2)y5_|3g!m2IttZ> zh89L3wrOoGCx^JIp{-{^Ze>+<O>Nx_uwURs3Ijic4<~0bFfd^8X->LfaB_Zb0Yn{h zHg;9H`7SQd@ZexzXsG_7bQlzhSj@}KPa#reK?btT;F1oDd1b*xc{%xc>EKcpG`y3` zP{feTpvO?jkjRkBkmH$y61VHo;+B=6h#{XLhanX-ii50@Q5Lt#VH*2LVSyU!YgaKa zFd)g|h;0-VSYsJU1xoBP8i0})k}O)RaxoM!lrrQo=rX`!x0oRVHD(#R(c()TtRs^l zmm!rQharhUmm!%UpCOl_fWeZ%fWd&lh{1$Gm%#|kGGx$YNM|TwC}7ZKFk>)c&}GPH zC}2os$b+UO4BHrN85kHQfQyL#kdz0mff*Sf6*waU1GoYot^YysI*La_VBkZ58R7&9 zQ2*bRfdSX}KSb3iIT`|^AuudMfRV)|*u@D_X=C*usILvG%@d%qpguULHfIF&%OUze kN<dwEaCe*$)apd21!)DzfxF_P4FPDtj8dZ^Fn}Qd00w3w3jhEB literal 0 HcmV?d00001 diff --git a/Ansible/host_vars/couchdb.yaml b/Ansible/host_vars/couchdb.yaml new file mode 100644 index 0000000..b286919 --- /dev/null +++ b/Ansible/host_vars/couchdb.yaml @@ -0,0 +1,9 @@ +- hosts: mrc.db + vars: + database_user: 'admin' + database_password: 'admin' + cookie: 'alexis' + ansible_python_interpreter: /usr/bin/python3.8 + + roles: + - role: \ No newline at end of file diff --git a/Ansible/host_vars/mrc.yaml b/Ansible/host_vars/mrc.yaml new file mode 100644 index 0000000..6be6d08 --- /dev/null +++ b/Ansible/host_vars/mrc.yaml @@ -0,0 +1,35 @@ +# Common vars +availability_zone: melbourne-qh2-uom + +# Volume +volumes: + - vol_name: volPrueba1 + vol_size: 10 + - vol_name: volPrueba2 + vol_size: 10 + +#Security group +security_groups: + - name: demo_ssh + description: "Demo security group for SSH access" + protocol: tcp + port_range_min: 22 + port_range_max: 22 + remote_ip_prefix: 0.0.0.0/0 + - name: demo_http + description: "Demo security group for HTTP" + protocol: tcp + port_range_min: 80 + port_range_max: 80 + remote_ip_prefix: 0.0.0.0/0 + +#Instance +instances: + - name: prueba1 + volumes: 'volPrueba1' + - name: prueba2 + volumes: 'volPrueba2' + +instance_image: 34ce7ec8-50f2-4604-a38f-7d81d1c2041d #f8b79936-6616-4a22-b55d-0d0a1d27bceb +instance_key_name: couchTestKey +instance_flavor: uom.mse.1c4g \ No newline at end of file diff --git a/Ansible/inventory.ini b/Ansible/inventory.ini new file mode 100644 index 0000000..e69de29 diff --git a/Ansible/mrc.yaml b/Ansible/mrc.yaml new file mode 100644 index 0000000..c361698 --- /dev/null +++ b/Ansible/mrc.yaml @@ -0,0 +1,15 @@ +- hosts: localhost + vars: + ansible_python_interpreter: /usr/bin/python3.8 + vars_files: + - host_vars/mrc.yaml + gather_facts: true + + roles: + - role: openstack-common + - role: openstack-images + - role: openstack-volume + - role: openstack-security-group + - role: openstack-instance + - role: openstack-IP +# - role: openstack-volume-snapshot \ No newline at end of file diff --git a/Ansible/roles/.DS_Store b/Ansible/roles/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..a678e9ccbf602db43c82f66b7eb3fe52b6f7be06 GIT binary patch literal 10244 zcmZQzU|@7AO)+F(P+(wS;9!8z0z3>@0Z1N%F(jFwA{rp`7#IW?7>XH67!nzh8L}C4 zp>m_tXb6mkz-S1JhQMeDjE2DA3IRrlb2zvm^e8zR0;3@?8UpYT0F@7*4g!dFfVA-$ z8Xz=Ch=GxT0o(;(WME){X<`KT0~kPZAgv%8q!mPiv@$S)SYR{2S{WFjS{cFJ5Rg6r zuu+WQt_g?_*3Q5PwwZx}5o|L910zH`10&RCMraR(5u%-e5o|jH10zH`*vwI4Gz3ON z05t?aeRlzde1-ysRE9j1{(CY*K0_`;E<-*;o@Y*ea#Buy5(6Z2J2EgZ==}!+uwexC zCzTf$K=q$UD#*z!E-^5;&d9{f!pg?Z0Rp@nvB4Sn<-sM1C8fnqiAB*MUO-|=MiP`A zlAoUgXD23wWu}(L3y3)9=anR8=A{;alm};~q$VX6#e`?(rR0}8<(KBA6obuyN^pWe zynuLhwXungg1JGhjzYDep@k8MZCYE)$sw+4XzQ7fTUk|IQ(HF!>@#?A!@v*W!^xT8 zupkg_Iq8PM$@#ej5M7d+h|!aq@8SXtD^QVE^F!${D7*=Vac+JJS^5exklkniaw<W) z%7TmXa`N-i!R0t8O<)U$Oom*BM22*RREA=-^s}C*^n;{-M5P}jf1{<J^ElHFk{*)M z4~jk#(hrh8qSFtO9<=l$gth$1gqKHo49N_ssA-5%7A*}CWyUZ~M@0D@H7!ZUFfcF> zr4L7XB2q8bG)0tNEa{3UeQ0S*0&ChTW=Lg7W+-JSV#s7DVW?!#Wk_czV#sGGWhg*P zXWeM&jAZkMX__NB9MICA3<CoL$!6e4i)5ICHC>Wy4wf`ZvKeUU6?@%V#*ojD!%)hQ zi%|~#L`$Cp^`piElRnNm1<6hv;ZD#llG-Fl_MwI=xJM_6H6J7CVbEnLX2@emWGG-L zX2@X3XDC6<$qb-Y)I4yb^*^YQ!$5|K!!$3G5fZ4WNV1NBft>Kfk*>&a4~~>ZhDoSt z58NIm!xXe!4Nh>Q#ApZ%st{m?xJCgq{_o1bfNTCAqH2^J4S~@R7?vTx$l?<0;shPc z!RABISUYGuJpn2S8iNOo<}-rE=OOw)N<c&V;Nf^C$f6?9*dj;_T#16TGBPlLhvOL; bAfx#MI2kaU#vzI77o)b=M*IIGz5fpY7QO9$ literal 0 HcmV?d00001 diff --git a/Ansible/roles/openstack-IP/main.yaml b/Ansible/roles/openstack-IP/main.yaml new file mode 100644 index 0000000..274029c --- /dev/null +++ b/Ansible/roles/openstack-IP/main.yaml @@ -0,0 +1,5 @@ +- hosts: host1 + tasks: + - name: Show host's ip + debug: + msg: "{{ ansible_ssh_host }}" \ No newline at end of file diff --git a/Ansible/roles/openstack-common/.DS_Store b/Ansible/roles/openstack-common/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..be96e3e647ce5519c2c4cfefb36bf36645fb9fcf GIT binary patch literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8zOq>i@0Z1N%F(jFwBJ3dZz-APC=Hw?Q<>V(pWk#vN z9s;1aV`V5|NMtBx$Ywx}KTy(eWME*>`ws?Sk07Z`Dlaa8#`KA#f}G6a5(9(lj7-cd ztZeKYAi&EJ8=R3}9$b=GQd;bkSQHK71tgYaBth9B`T03;c4AUkW@>r7fQWN`UP)qR zUTP6Yd2nV*YEoiROn7EqN`ARheraAxG1wfa1Sbf@3y4=&8=L4Tm>bmUC{!C7S{Q-Y zrnR-49O9~mww?*Ol~vU>wRJPVeqdl^gwPE9P#Q+fWME)G@?lQ8VQ_MOZUID^aUH5` zZoZ2P)c>H&QS(FTFetQ;^ylWM5KvK&fouaPz>)1Q3ogpb$<IrN<SvLSM#<3-7!85Z z5THs3K+8c6ZmO6zYRG5^jE2B)3IS00pa5-sI6&zJ2n~{AU}RtbcL5j~7+7HbW(4;G z7(j9$tsokt6-0xyGBAQzU^Bp485p5j8NuBUkUnrTh=Gv-tet_80j!;YkpZk7-gsk# zXlG!A+RO-Qgn`V3XlG!AXlG!AXoop(lpYO%(GY-!05gOZ0M-Al3=FvX{}5H9<Y)+t zhQP240Y(;=U>7G)<%z?4pt=@RpC&-%LA5`qI%Wjb*9b9iRm=n#P?UfQgQ|OwRuB!Y WiWwOoHTh^m02V@{^k@jsKLh}zgLjYs literal 0 HcmV?d00001 diff --git a/Ansible/roles/openstack-common/tasks/main.yaml b/Ansible/roles/openstack-common/tasks/main.yaml new file mode 100644 index 0000000..efa7810 --- /dev/null +++ b/Ansible/roles/openstack-common/tasks/main.yaml @@ -0,0 +1,22 @@ +- name: Install pip + become: yes + apt: + name: ['python3-pip'] + state: latest + update_cache: yes + when: ansible_distribution == "Ubuntu" +# sudo apt-get update; sudo apt-get install python-pip + +- name: Update pip + become: yes + pip: + name: ['pip'] + state: latest +# pip install --upgrade pip + +- name: Install openstacksdk + become: yes + pip: + name: ['openstacksdk'] + state: latest +# pip install openstacksdk \ No newline at end of file diff --git a/Ansible/roles/openstack-couchdb/tasks/main.yml b/Ansible/roles/openstack-couchdb/tasks/main.yml new file mode 100644 index 0000000..78bafce --- /dev/null +++ b/Ansible/roles/openstack-couchdb/tasks/main.yml @@ -0,0 +1,13 @@ +- name: Bind the clustered interface to all IP addresses availble on this machine + + command: curl -X PUT http://{{ database_user }}:{{ database_password }}@127.0.0.1:5984/_node/_local/_config/httpd/bind_address -d '"0.0.0.0"' + +- name: Set the UUID of the node to + + command: curl -X PUT http://{{ database_user }}:{{ database_password }}@127.0.0.1:5984/_node/_local/_config/couchdb/uuid -d '"{{ database_uuid }}"' + +- name: Set the shared http secret for cookie creation + + command: curl -X PUT http://{{ database_user }}:{{ database_password }}@127.0.0.1:5984/_node/_local/_config/couch_httpd_auth/secret -d '"{{ database_secret }}" + + - name: Setup cluster diff --git a/Ansible/roles/openstack-images/.DS_Store b/Ansible/roles/openstack-images/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..fb81acb434381dab2a77292b929357eaf44dd81c GIT binary patch literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8zOq>i@0Z1N%F(jFwBJ3dZz-APC=Hw?Q<>V(pWk#vN z9s;1aV`V5|NMtBx$Ywx}KTy(eWME*>`ws?Sk07Z`Dlaa8#`KA#f}G6a5(9(lj7-cd ztZeKYAi&EJ8=R3}9$b=GQd;bkSQHK71tgYaBth9B`T03;c4AUkW@>r7fQWN`UP)qR zUTP6Yd2nV*YEoiROn7EqN`ARheraAxG1wfa1Sbf@3y4=&8=L4Tm>bmUC{!C7S{Q-Y zrnR-49O9~mww?*Ol~vU>wRJPVeqdl^gwPE9P#Q+fWME)G@?lQ8VQ_MOZUID^@ieMz zZoZ2P)c>H&QS(FTFetQ;^ylWM5KvK&fouaPz>)1Q3ogpb$<IrN<SvLSM#<3-7!85Z z5THs3K+8c6ZmO6zYRG5^jE2B)3IS00pa5-sI6&zJ2n~{AU}RtbcL5j~7+7HbW(4;G z7(j9$tsokt6-0xyGBAQzU^Bp485p5j8NuBUkUnrTh=Gv-tet_80j!;YkpZk7-gsk# zXlG!A+RO-Qgn`V3XlG!AXlG!AXoop(lpYO%(GY-!05gOZ0M-Al3=FvX{}5H9<Y)+t zhQP240Y(;=U>7G)<%z?4pt=@RpC&-%LA5`qI%Wjb*9b9iRm=n#P?UfQgQ|OwRuB!Y WiWwOoHTh^m02V@{^k@jsKLh{(BX_L; literal 0 HcmV?d00001 diff --git a/Ansible/roles/openstack-images/tasks/main.yaml b/Ansible/roles/openstack-images/tasks/main.yaml new file mode 100644 index 0000000..79fbfbf --- /dev/null +++ b/Ansible/roles/openstack-images/tasks/main.yaml @@ -0,0 +1,15 @@ +# Show all available Openstack images +- name: Retrieve all available Openstack images + os_image_info: + register: image_result + +- name: Get image names and Ids + set_fact: + image_facts: "{{ image_facts|default([]) + [ {'name': item.name, 'id': item.id} ] }}" + loop: '{{ image_result.openstack_image }}' + when: item.name is defined + +- name: Show images + debug: + msg: "Image name: {{ item.name }}; Image id: {{ item.id }}" + loop: '{{ image_facts }}' diff --git a/Ansible/roles/openstack-instance/.DS_Store b/Ansible/roles/openstack-instance/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..dab08dd871431ca9132d86d21e0aad1abbe1b54e GIT binary patch literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8zOq>i@0Z1N%F(jFwBJ3dZz-APC=Hw?Q<>V(pWk#vN z9s;1aV`V5|NMtBx$Ywx}KTy(eWME*>`ws?Sk07Z`Dlaa8#`KA#f}G6a5(9(lj7-cd ztZeKYAi&EJ8=R3}9$b=GQd;bkSQHK71tgYaBth9B`T03;c4AUkW@>r7fQWN`UP)qR zUTP6Yd2nV*YEoiROn7EqN`ARheraAxG1wfa1Sbf@3y4=&8=L4Tm>bmUC{!C7S{Q-Y zrnR-49O9~mww?*Ol~vU>wRJPVeqdl^gwPE9P#Q+fWME)G@?lQ8VQ_MOZUID^IRaHS zH{Znt>VHt?sQICE7!+Da`g8MB2&gE?K(+xC;K=ru1sCPz<maVBau>uEqvU7^jE2By z2v8*ipyeP3H&sj<HDojdMnhmYg#f60P=K~R9H4Xqga%15FfuTJy8w&~3@k8zGlKg8 z3?Mm>RuB!+3Zg+;85lt<uo+;j42)2%jNonvNFTTv#K6b^*3Q7l0M^dH$N<(3Z@e)= zv@<Y5ZDs^D!a(Liv@<Y5v@<Y5w8NY?N{@!XXb3<<fEhvyfa-r&1_oUHe~7A4ax?@+ zLtt2j03(Y_u!|F@^2FgiP+beEPZOZ>pxPf)9W#RJYlIlMDrSNVC`v$uLDfA-D~JYH W#f%J)ntZe&01Kf}dNc&+9|8c-Fn2rv literal 0 HcmV?d00001 diff --git a/Ansible/roles/openstack-instance/tasks/main.yaml b/Ansible/roles/openstack-instance/tasks/main.yaml new file mode 100644 index 0000000..57bade5 --- /dev/null +++ b/Ansible/roles/openstack-instance/tasks/main.yaml @@ -0,0 +1,38 @@ +--- +# 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 }}' + security_groups: '{{ sg_names }}' + volumes: '{{ item.volumes }}' + auto_floating_ip: yes + wait: yes + timeout: 600 + state: present + loop: '{{ instances }}' + register: os_instance + +- debug: + msg: "Instance {{ item.openstack.name }} has been created. IP address is {{ item.openstack.public_v4 }}" + loop: '{{ os_instance.results }}' + when: item.openstack is defined + +- name: Wait for connection + wait_for: + host: "{{ item.openstack.public_v4 }}" + port: 22 + timeout: 240 + search_regex: OpenSSH + loop: '{{ os_instance.results }}' + when: item.openstack is defined + +- name: Add host + add_host: + name: '{{ item.openstack.public_v4 }}' + groups: COUCHGROUP + loop: '{{ os_instance.results }}' + when: item.openstack is defined \ No newline at end of file diff --git a/Ansible/roles/openstack-security-group/.DS_Store b/Ansible/roles/openstack-security-group/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..98d5e0394ffe78a5d2ed6c0e1232f86632b3c93f GIT binary patch literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8zOq>i@0Z1N%F(jFwBJ3dZz-APC=Hw?Q<>V(pWk#vN z9s;1aV`V5|NMtBx$Ywx}KTy(eWME*>`ws?Sk07Z`Dlaa8#`KA#f}G6a5(9(lj7-cd ztZeKYAi&EJ8=R3}9$b=GQd;bkSQHK71tgYaBth9B`T03;c4AUkW@>r7fQWN`UP)qR zUTP6Yd2nV*YEoiROn7EqN`ARheraAxG1wfa1Sbf@3y4=&8=L4Tm>bmUC{!C7S{Q-Y zrnR-49O9~mww?*Ol~vU>wRJPVeqdl^gwPE9P#Q+fWME)G@?lQ8VQ_MOZUID^Sproy zH{Znt>VHt?sQICE7!+Da`g8MB2&gE?K(+xC;K=ru1sCPz<maVBau>uEqvU7^jE2By z2v8*ipyeP3H&sj<HDojdMnhmYg#f60P=K~R9H4Xqga%15FfuTJy8w&~3@k8zGlKg8 z3?Mm>RuB!+3Zg+;85lt<uo+;j42)2%jNonvNFTTv#K6b^*3Q7l0M^dH$N<(3Z@e)= zv@<Y5ZDs^D!a(Liv@<Y5v@<Y5w8NY?N{@!XXb3<<fEhvyfa-r&1_oUHe~7A4ax?@+ zLtt2j03(Y_u!|F@^2FgiP+beEPZOZ>pxPf)9W#RJYlIlMDrSNVD1t^yz%q;skeZy4 Z0aBAQGC*qb(S`sxct(lQ5EzgU005jNcKiSU literal 0 HcmV?d00001 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 0000000..3ee4b19 --- /dev/null +++ b/Ansible/roles/openstack-security-group/tasks/main.yaml @@ -0,0 +1,27 @@ +--- +# 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 group(s) {{ sg_names }} have been created." + +# Create security group rules +- name: Create security group rules + os_security_group_rule: + security_group: '{{ item.name }}' + protocol: '{{ item.protocol }}' + port_range_min: '{{ item.port_range_min }}' + port_range_max: '{{ item.port_range_max }}' + remote_ip_prefix: '{{ item.remote_ip_prefix }}' + state: present + loop: '{{ security_groups }}' \ No newline at end of file diff --git a/Ansible/roles/openstack-volume-snapshot/.DS_Store b/Ansible/roles/openstack-volume-snapshot/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..03c72bd1edce31e5bf5890819cd238efb6ac6980 GIT binary patch literal 6148 zcmZQzU|@7AO)+F(5MW?n;9!8zOq>i@0Z1N%F(jFwBJ3dZz-APC=Hw?Q<>V(pWk#vN z9s;1aV`V5|NMtBx$Ywx}KTy(eWME*>`ws?Sk07Z`Dlaa8#`KA#f}G6a5(9(lj7-cd ztZeKYAi&EJ8=R3}9$b=GQd;bkSQHK71tgYaBth9B`T03;c4AUkW@>r7fQWN`UP)qR zUTP6Yd2nV*YEoiROn7EqN`ARheraAxG1wfa1Sbf@3y4=&8=L4Tm>bmUC{!C7S{Q-Y zrnR-49O9~mww?*Ol~vU>wRJPVeqdl^gwPE9P#Q+fWME)G@?lQ8VQ_MOZUID^u?kf- zH{Znt>VHt?sQICE7!+Da`g8MB2&gE?K(+xC;K=ru1sCPz<maVBau>uEqvU7^jE2By z2v8*ipyeP3H&sj<HDojdMnhmYg#f60P=K~R9H4Xqga%15FfuTJy8w&~3@k8zGlKg8 z3?Mm>RuB!+3Zg+;85lt<uo+;j42)2%jNonvNFTTv#K6b^*3Q7l0M^dH$N<(3Z@e)= zv@<Y5ZDs^D!a(Liv@<Y5v@<Y5w8NY?N{@!XXb3<<fEhvyfa-r&1_oUHe~7A4ax?@+ zLtt2j03(Y_u!|F@^2FgiP+beEPZOZ>pxPf)9W#RJYlIlMDrSNVC`v$uLDfA-D~JYH W#f%J)ntZe&01Kf}dNc&+9|8bsJ9k_F literal 0 HcmV?d00001 diff --git a/Ansible/roles/openstack-volume-snapshot/tasks/main.yaml b/Ansible/roles/openstack-volume-snapshot/tasks/main.yaml new file mode 100644 index 0000000..be7c6b1 --- /dev/null +++ b/Ansible/roles/openstack-volume-snapshot/tasks/main.yaml @@ -0,0 +1,12 @@ +--- +# create volume snapshot +- name: Create volume snapshot + os_volume_snapshot: + state: present + volume: '{{ item.vol_name }}' + display_name: "{{ item.vol_name }}-{{ lookup('pipe', 'date +%Y-%m-%d-%H-%M-%S') }}" + wait: yes # wait until the snapshot is created + timeout: 600 + force: yes + availability_zone: '{{ availability_zone }}' + loop: '{{ volumes }}' \ No newline at end of file diff --git a/Ansible/roles/openstack-volume/tasks/main.yaml b/Ansible/roles/openstack-volume/tasks/main.yaml new file mode 100644 index 0000000..e85e7fe --- /dev/null +++ b/Ansible/roles/openstack-volume/tasks/main.yaml @@ -0,0 +1,21 @@ +--- +# Create volumes from vars +- name: Create volume(s) on NeCTAR + os_volume: + display_name: '{{ item.vol_name }}' + size: '{{ item.vol_size }}' + availability_zone: '{{ availability_zone }}' + wait: yes + timeout: 600 + state: present + loop: '{{ volumes }}' + register: os_vol + +# Get a list of volume Ids from the reutrn value of os_volume +- 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" \ No newline at end of file diff --git a/Ansible/run-mrc.sh b/Ansible/run-mrc.sh new file mode 100644 index 0000000..17c9fc8 --- /dev/null +++ b/Ansible/run-mrc.sh @@ -0,0 +1,3 @@ +. ./unimelb-comp90024-2021-grp-62-openrc.sh; ansible-playbook mrc.yaml + +#. ./unimelb-comp90024-2021-grp-62-openrc.sh; ansible-playbook couchdb.yaml \ No newline at end of file diff --git a/Ansible/unimelb-comp90024-2021-grp-62-openrc.sh b/Ansible/unimelb-comp90024-2021-grp-62-openrc.sh new file mode 100644 index 0000000..3383b97 --- /dev/null +++ b/Ansible/unimelb-comp90024-2021-grp-62-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=c82f39882d974dbf8b5c925fb3eb4448 +export OS_PROJECT_NAME="unimelb-comp90024-2021-grp-62" +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="alejandro.ariasrodriguez@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='NmQ0Y2IyOTkwOGIwZTQw' +# 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 -- GitLab