Skip to content

Commit 8d89423

Browse files
influxdb-22-04
1 parent dd5d005 commit 8d89423

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

influxdb-22-04/influxdb.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
3+
mkdir -p {/usr/local/src/influxdb-22-04/opt/cloudstack/,/usr/local/src/influxdb-22-04/}
4+
5+
cd /usr/local/src/influxdb-22-04/opt/cloudstack/ && wget https://raw.githubusercontent.com/stackbill/marketplace/main/_common-files/opt/cloudstack/cleanup.sh
6+
7+
cd /usr/local/src/influxdb-22-04/ && wget https://raw.githubusercontent.com/stackbill/marketplace/main/influxdb-22-04/influxdb.yaml

influxdb-22-04/influxdb.yaml

+65
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
- name: Influxdb Setup
2+
hosts: localhost
3+
tasks:
4+
- name: Restarting sshd
5+
shell: "sed -i 's/#Match User anoncvs/ForceCommand echo Please wait until the installation is completed..../g' /etc/ssh/sshd_config && systemctl restart sshd"
6+
7+
- name: Updating Packages
8+
ansible.builtin.apt:
9+
update_cache: yes
10+
11+
- name: Configuring GPG key and adding Repo
12+
shell: "{{ item }}"
13+
with_items:
14+
- wget -q https://repos.influxdata.com/influxdata-archive_compat.key
15+
- echo '393e8779c89ac8d958f81f942f9ad7fb82a25e133faddaf92e15b16e6ac9ce4c influxdata-archive_compat.key' | sha256sum -c && cat influxdata-archive_compat.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg > /dev/null
16+
- echo 'deb [signed-by=/etc/apt/trusted.gpg.d/influxdata-archive_compat.gpg] https://repos.influxdata.com/debian stable main' | sudo tee /etc/apt/sources.list.d/influxdata.list
17+
- rm -rf /root/influxdata-archive_compat.key
18+
19+
- name: Remove the key file
20+
file:
21+
path: /root/influxdata-archive_compat.key
22+
state: absent
23+
24+
- name: Updating Packages
25+
ansible.builtin.apt:
26+
update_cache: yes
27+
28+
- name: Installing influxdb
29+
apt:
30+
name: influxdb2
31+
state: latest
32+
33+
- name: Enable influxdb
34+
ansible.builtin.systemd:
35+
name: influxdb
36+
state: started
37+
enabled: true
38+
39+
- name: Getting the status of the service
40+
shell: systemctl status influxdb | grep 'since'
41+
register: status
42+
43+
- debug:
44+
var: status.stdout
45+
46+
- name: Creating a directory for shell script
47+
ansible.builtin.file:
48+
path: /opt/cloudstack
49+
state: directory
50+
51+
- name: Copy files for shell script
52+
copy:
53+
src: "{{ item.confsrc }}"
54+
dest: "{{ item.confdest }}"
55+
with_items:
56+
- { confsrc: '/usr/local/src/influxdb-22-04/opt/cloudstack/cleanup.sh', confdest: '/opt/cloudstack/'}
57+
58+
- name: Adding a line for shell script
59+
lineinfile:
60+
path: /root/.bashrc
61+
line: "chmod +x /opt/cloudstack/cleanup.sh && /opt/cloudstack/cleanup.sh"
62+
state: present
63+
64+
- name: Restarting sshd
65+
shell: "sed -i 's/ForceCommand echo Please wait until the installation is completed..../#Match User anoncvs/g' /etc/ssh/sshd_config && systemctl restart sshd"

0 commit comments

Comments
 (0)