ansible-test2
This commit is contained in:
BIN
Ansible剧本编写测试题.docx
Executable file → Normal file
BIN
Ansible剧本编写测试题.docx
Executable file → Normal file
Binary file not shown.
BIN
ansible-playbook-test2/consul-cluster/bin/consul
Executable file
BIN
ansible-playbook-test2/consul-cluster/bin/consul
Executable file
Binary file not shown.
BIN
ansible-playbook-test2/consul-cluster/bin/consul-replicate
Executable file
BIN
ansible-playbook-test2/consul-cluster/bin/consul-replicate
Executable file
Binary file not shown.
6
ansible-playbook-test2/consul-cluster/bin/consul_replicate.sh
Executable file
6
ansible-playbook-test2/consul-cluster/bin/consul_replicate.sh
Executable 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 &
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
8
ansible-playbook-test2/consul-cluster/install.sh
Executable file
8
ansible-playbook-test2/consul-cluster/install.sh
Executable 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/
|
||||
6
ansible-playbook-test2/consul-cluster/script/consul_bind_ip_generate.sh
Executable file
6
ansible-playbook-test2/consul-cluster/script/consul_bind_ip_generate.sh
Executable 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}
|
||||
3
ansible-playbook-test2/consul-cluster/script/consul_path_setup.sh
Executable file
3
ansible-playbook-test2/consul-cluster/script/consul_path_setup.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
|
||||
PATH=/opt/consul-external/bin:${PATH}
|
||||
export PATH
|
||||
BIN
ansible-playbook-test2/consul-external/bin/consul
Executable file
BIN
ansible-playbook-test2/consul-external/bin/consul
Executable file
Binary file not shown.
BIN
ansible-playbook-test2/consul-external/bin/consul-replicate
Executable file
BIN
ansible-playbook-test2/consul-external/bin/consul-replicate
Executable file
Binary file not shown.
6
ansible-playbook-test2/consul-external/bin/consul_replicate.sh
Executable file
6
ansible-playbook-test2/consul-external/bin/consul_replicate.sh
Executable 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 &
|
||||
@@ -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"
|
||||
}
|
||||
|
||||
@@ -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
|
||||
11
ansible-playbook-test2/consul-external/install.sh
Executable file
11
ansible-playbook-test2/consul-external/install.sh
Executable 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/
|
||||
|
||||
|
||||
|
||||
6
ansible-playbook-test2/consul-external/script/consul_bind_ip_generate.sh
Executable file
6
ansible-playbook-test2/consul-external/script/consul_bind_ip_generate.sh
Executable 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}
|
||||
3
ansible-playbook-test2/consul-external/script/consul_path_setup.sh
Executable file
3
ansible-playbook-test2/consul-external/script/consul_path_setup.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
|
||||
PATH=/opt/consul-external/bin:${PATH}
|
||||
export PATH
|
||||
BIN
ansible-playbook-test2/consul-internal/bin/consul
Executable file
BIN
ansible-playbook-test2/consul-internal/bin/consul
Executable file
Binary file not shown.
BIN
ansible-playbook-test2/consul-internal/bin/consul-replicate
Executable file
BIN
ansible-playbook-test2/consul-internal/bin/consul-replicate
Executable file
Binary file not shown.
@@ -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"
|
||||
}
|
||||
@@ -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
|
||||
10
ansible-playbook-test2/consul-internal/install.sh
Executable file
10
ansible-playbook-test2/consul-internal/install.sh
Executable 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/
|
||||
|
||||
|
||||
|
||||
4
ansible-playbook-test2/consul-internal/script/consul_bind_ip_generate.sh
Executable file
4
ansible-playbook-test2/consul-internal/script/consul_bind_ip_generate.sh
Executable 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}
|
||||
3
ansible-playbook-test2/consul-internal/script/consul_path_setup.sh
Executable file
3
ansible-playbook-test2/consul-internal/script/consul_path_setup.sh
Executable file
@@ -0,0 +1,3 @@
|
||||
|
||||
PATH=/opt/consul-internal/bin:${PATH}
|
||||
export PATH
|
||||
Reference in New Issue
Block a user