forked from stackbill/marketplace
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1da48d9
commit bc1a4ce
Showing
3 changed files
with
138 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#!/bin/bash | ||
|
||
RED='\033[1;31m' | ||
NC='\033[0m' | ||
|
||
echo -e "${RED} | ||
################################################################################################################ | ||
# Your MarketPlace App has been deployed successfully! # | ||
# Passwords are stored under /root/ # | ||
################################################################################################################ | ||
${NC}" | ||
|
||
echo | ||
echo -e "${RED}This message will be removed in the next login!${NC}" | ||
echo | ||
echo | ||
echo -e "${RED}Refer to the below RabbitMQ Admin details${NC}" | ||
echo | ||
cat /root/.admin_password | ||
echo | ||
|
||
#Cleanup script | ||
rm -rf /usr/local/src/ | ||
mkdir -p /usr/local/src/ | ||
rm -rf /var/lib/cloud/instances/* | ||
rm -rf /var/lib/cloud/data/* | ||
find /var/log -mtime -1 -type f -exec truncate -s 0 {} \; >/dev/null 2>&1 | ||
rm -rf /var/log/*.gz /var/log/*.[0-9] /var/log/*-???????? | ||
cat /dev/null > /var/log/lastlog; cat /dev/null > /var/log/wtmp | ||
apt-get -y autoremove >/dev/null 2>&1 | ||
apt-get -y autoclean >/dev/null 2>&1 | ||
history -c | ||
cat /dev/null > /root/.bash_history | ||
unset HISTFILE | ||
|
||
rm -rf /root/.bashrc | ||
cp /etc/skel/.bashrc /root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/bash | ||
|
||
mkdir -p {/usr/local/src/rabbitmq-20-04/opt/cloudstack/,/usr/local/src/rabbitmq-20-04/} | ||
|
||
cd /usr/local/src/rabbitmq-20-04/opt/cloudstack/ && wget https://raw.githubusercontent.com/stackbill/marketplace/main/common-files/opt/cloudstack/rabbitmq-cleanup.sh | ||
|
||
cd /usr/local/src/rabbitmq-20-04/ && wget https://raw.githubusercontent.com/stackbill/marketplace/main/rabbitmq-20-04/rabbitmq.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
- name: RabbitMQ Setup | ||
hosts: localhost | ||
tasks: | ||
- name: Restarting sshd | ||
shell: "sed -i 's/#Match User anoncvs/ForceCommand echo Please wait until the installation is completed..../g' /etc/ssh/sshd_config && systemctl restart sshd" | ||
|
||
- name: Updating Packages | ||
ansible.builtin.apt: | ||
update_cache: yes | ||
|
||
- name: Installing Dependencies | ||
apt: | ||
name: [ 'curl', 'software-properties-common', 'apt-transport-https', 'lsb-release' ] | ||
state: latest | ||
|
||
- name: Import Erlang GPG Key and repo | ||
shell: "{{ item }}" | ||
with_items: | ||
- curl -fsSL https://packages.erlang-solutions.com/ubuntu/erlang_solutions.asc | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/erlang.gpg | ||
- echo "deb https://packages.erlang-solutions.com/ubuntu $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/erlang.list | ||
|
||
- name: Updating Packages | ||
ansible.builtin.apt: | ||
update_cache: yes | ||
|
||
- name: Installing Erlang | ||
apt: | ||
name: erlang | ||
state: present | ||
|
||
- name: Add RabbitMQ Repository | ||
shell: curl -s https://packagecloud.io/install/repositories/rabbitmq/rabbitmq-server/script.deb.sh | sudo bash | ||
|
||
- name: Updating Packages | ||
ansible.builtin.apt: | ||
update_cache: yes | ||
|
||
- name: Installing rabbitmq | ||
apt: | ||
name: rabbitmq-server | ||
state: present | ||
|
||
- name: Enable the RabbitMQ Management Web dashboard | ||
shell: sudo rabbitmq-plugins enable rabbitmq_management | ||
|
||
- name: Restarting service rabbitmq | ||
service: | ||
name: rabbitmq-server | ||
state: restarted | ||
|
||
- name: Generating Admin password | ||
shell: openssl rand -hex 24 | ||
register: adminpassword | ||
|
||
- debug: | ||
var: adminpassword.stdout | ||
|
||
- name: Storing mysql password | ||
copy: | ||
dest: "/root/.admin_password" | ||
content: | | ||
rabbitmq_user = mqadmin | ||
rabbitmq_pass = "{{ adminpassword.stdout }}" | ||
- name: Adding Admin User | ||
shell: "{{ item }}" | ||
with_items: | ||
- sudo rabbitmqctl add_user mqadmin {{ adminpassword.stdout }} | ||
- sudo rabbitmqctl set_user_tags mqadmin administrator | ||
- sudo rabbitmqctl set_permissions -p / mqadmin ".*" ".*" ".*" | ||
- sudo rabbitmqctl delete_user guest | ||
- sudo rabbitmq-diagnostics | ||
ignore_errors: true | ||
|
||
- name: Creating a directory for shell script | ||
ansible.builtin.file: | ||
path: /opt/cloudstack | ||
state: directory | ||
|
||
- name: Copy files for shell script | ||
copy: | ||
src: "{{ item.confsrc }}" | ||
dest: "{{ item.confdest }}" | ||
with_items: | ||
- { confsrc: '/usr/local/src/rabbitmq-20-04/opt/cloudstack/rabbitmq-cleanup.sh', confdest: '/opt/cloudstack/'} | ||
|
||
- name: Adding a line for shell script | ||
lineinfile: | ||
path: /root/.bashrc | ||
line: "chmod +x /opt/cloudstack/rabbitmq-cleanup.sh && /opt/cloudstack/rabbitmq-cleanup.sh" | ||
state: present | ||
|
||
- name: Restarting sshd | ||
shell: "sed -i 's/ForceCommand echo Please wait until the installation is completed..../#Match User anoncvs/g' /etc/ssh/sshd_config && systemctl restart sshd" |