ansible-test2

This commit is contained in:
zhangzhihan
2020-02-23 18:54:58 +08:00
parent e8b6f77567
commit 325785e9a6
27 changed files with 143 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#!/bin/bash
#
killall -9 consul-replicate
cd /opt/consul-internal/bin/;./consul-replicate -prefix "device_info@consul-external_new" &>/dev/null &
cd /opt/consul-internal/bin/;./consul-replicate -prefix "device_list@consul-external_new" &>/dev/null &
cd /opt/consul-internal/bin/;./consul-replicate -prefix "tags@consul-external_new" &>/dev/null &

View File

@@ -0,0 +1,12 @@
{
"server" : true,
"datacenter" : "",
"data_dir" : "/var/consul-external",
"encrypt" : "",
"disable_update_check" : true,
"bootstrap" : true,
"log_file" : "/var/consul-external/log/consul_external.log",
"retry_join" : [""],
"retry_interval" : "10s"
}

View File

@@ -0,0 +1,14 @@
# Systemd unit file for default tomcat
#
[Unit]
Description=Consul-cluster
After=network.target
[Service]
EnvironmentFile=/opt/consul-cluster/etc/systemd/consul.conf
ExecStartPre=/opt/consul-cluster/script/consul_bind_ip_generate.sh
ExecStart=/opt/consul-cluster/bin/consul agent -config-dir /opt/consul-cluster/etc/ -config-file /opt/consul-cluster/etc/consul/config-server.json -bind ${CONSUL_BIND_ADDRESS} -client 0.0.0.0
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,8 @@
#!/bin/bash
rm -rf /usr/lib/systemd/system/consul*service
rm -rf /usr/lib/systemd/system/consul*service
rm -rf /var/consul*
cp -f /opt/consul-cluster/etc/systemd/consul-server.service /usr/lib/systemd/system/consul-server-cluster.service
cp -f /opt/consul-cluster/bin/consul /usr/bin/
ln -sf /opt/consul-cluster/script/consul_path_setup.sh /etc/profile.d/

View File

@@ -0,0 +1,6 @@
#!/bin/bash
#BIND_ADDRESS=$(/usr/sbin/ip route | /usr/bin/grep default | head -n 1 | /usr/bin/awk '{print $5}' | /usr/bin/xargs ifconfig | /usr/bin/grep "inet" | /usr/bin/grep -v "inet6" | /usr/bin/awk '{print $2}')
BIND_ADDRESS=$(ifconfig ens34 | grep inet | head -1 |awk '{print $2}')
#BIND_ADDRESS=192.168.200.5
systemctl set-environment CONSUL_BIND_ADDRESS=${BIND_ADDRESS}

View File

@@ -0,0 +1,3 @@
PATH=/opt/consul-external/bin:${PATH}
export PATH

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,6 @@
#!/bin/bash
#
killall -9 consul-replicate
cd /opt/consul-internal/bin/;./consul-replicate -prefix "device_info@consul-external_new" &>/dev/null &
cd /opt/consul-internal/bin/;./consul-replicate -prefix "device_list@consul-external_new" &>/dev/null &
cd /opt/consul-internal/bin/;./consul-replicate -prefix "tags@consul-external_new" &>/dev/null &

View File

@@ -0,0 +1,12 @@
{
"server" : true,
"datacenter" : "",
"data_dir" : "/var/consul-external",
"encrypt" : "",
"disable_update_check" : true,
"bootstrap" : true,
"log_file" : "/var/consul-external/log/consul_external.log",
"retry_join" : [""],
"retry_interval" : "10s"
}

View File

@@ -0,0 +1,14 @@
# Systemd unit file for default tomcat
#
[Unit]
Description=Consul-external
After=network.target
[Service]
EnvironmentFile=/opt/consul-external/etc/systemd/consul.conf
ExecStartPre=/opt/consul-external/script/consul_bind_ip_generate.sh
ExecStart=/opt/consul-external/bin/consul agent -config-dir /opt/consul-external/etc/ -config-file /opt/consul-external/etc/consul/config-server.json -bind ${CONSUL_BIND_ADDRESS} -client 0.0.0.0
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,11 @@
#!/bin/bash
rm -rf /usr/lib/systemd/system/consul*service
rm -rf /usr/lib/systemd/system/consul*service
rm -rf /var/consul*
cp -f /opt/consul-external/etc/systemd/consul-server.service /usr/lib/systemd/system/consul-server-external.service
cp -f /opt/consul-external/bin/consul /usr/bin/
ln -sf /opt/consul-external/script/consul_path_setup.sh /etc/profile.d/

View File

@@ -0,0 +1,6 @@
#!/bin/bash
#BIND_ADDRESS=$(/usr/sbin/ip route | /usr/bin/grep default | head -n 1 | /usr/bin/awk '{print $5}' | /usr/bin/xargs ifconfig | /usr/bin/grep "inet" | /usr/bin/grep -v "inet6" | /usr/bin/awk '{print $2}')
BIND_ADDRESS=$(ifconfig ens1.200 | grep inet | head -1 |awk '{print $2}')
#BIND_ADDRESS=192.168.200.5
systemctl set-environment CONSUL_BIND_ADDRESS=${BIND_ADDRESS}

View File

@@ -0,0 +1,3 @@
PATH=/opt/consul-external/bin:${PATH}
export PATH

Binary file not shown.

Binary file not shown.

View File

@@ -0,0 +1,11 @@
{
"server" : false,
"datacenter" : "",
"data_dir" : "/var/consul-internal",
"encrypt" : "",
"disable_update_check" : true,
"log_level" : "err",
"log_file" : "/var/consul-internal/log/consul_internal.log",
"retry_join" : [""],
"retry_interval" : "10s"
}

View File

@@ -0,0 +1,14 @@
# Systemd unit file for default tomcat
#
[Unit]
Description=Consul-internal
After=network.target
[Service]
EnvironmentFile=/opt/consul-internal/etc/systemd/consul.conf
ExecStartPre=/opt/consul-internal/script/consul_bind_ip_generate.sh
ExecStart=/opt/consul-internal/bin/consul agent -config-dir /opt/consul-internal/etc/ -config-file /opt/consul-internal/etc/consul/config-client.json -bind ${CONSUL_BIND_ADDRESS}
[Install]
WantedBy=multi-user.target

View File

@@ -0,0 +1,10 @@
#!/bin/bash
rm -f /usr/lib/systemd/system/consul*service
rm -f /usr/lib/systemd/system/consul*service
cp -f /opt/consul-internal/etc/systemd/consul-client.service /usr/lib/systemd/system/consul-client-internal.service
cp -f /opt/consul-internal/bin/consul /usr/bin/
ln -sf /opt/consul-internal/script/consul_path_setup.sh /etc/profile.d/

View File

@@ -0,0 +1,4 @@
#!/bin/bash
BIND_ADDRESS=$(ifconfig ens1.200 | grep inet | head -1 |awk '{print $2}')
systemctl set-environment CONSUL_BIND_ADDRESS=${BIND_ADDRESS}

View File

@@ -0,0 +1,3 @@
PATH=/opt/consul-internal/bin:${PATH}
export PATH