From beb4590a5d1576af6e839423d6235734b1dd97e1 Mon Sep 17 00:00:00 2001 From: zhangzhihan Date: Wed, 1 Apr 2020 10:31:23 +0800 Subject: 优化双臂模式部署 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- roles/firewall/tasks/main.yml | 14 +++++++++++ roles/firewall/templates/maat.conf.j2 | 30 ++++++++++++++++++++++ roles/firewall/templates/main.conf.j2 | 47 +++++++++++++++++++++++++++++++++++ roles/sapp/tasks/main.yml | 18 ++++---------- roles/sapp/templates/maat.conf.j2 | 30 ---------------------- roles/sapp/templates/main.conf.j2 | 47 ----------------------------------- 6 files changed, 96 insertions(+), 90 deletions(-) create mode 100644 roles/firewall/templates/maat.conf.j2 create mode 100644 roles/firewall/templates/main.conf.j2 delete mode 100644 roles/sapp/templates/maat.conf.j2 delete mode 100644 roles/sapp/templates/main.conf.j2 diff --git a/roles/firewall/tasks/main.yml b/roles/firewall/tasks/main.yml index 8ffef49..df9a0af 100644 --- a/roles/firewall/tasks/main.yml +++ b/roles/firewall/tasks/main.yml @@ -73,3 +73,17 @@ - /tmp/ansible_deploy/tsg_master-debug-1.0.1.f624b67-1.el7.centos.x86_64.rpm state: present when: install_tsg_master == "yes" + +- name: Template the tsgconf/main.conf + template: + src: "{{ role_path }}/templates/main.conf.j2" + dest: /home/mesasoft/sapp_run/tsgconf/main.conf + tags: template + + +- name: Template the tsgconf/maat.conf + template: + src: "{{ role_path }}/templates/maat.conf.j2" + dest: /home/mesasoft/sapp_run/tsgconf/maat.conf + tags: template + diff --git a/roles/firewall/templates/maat.conf.j2 b/roles/firewall/templates/maat.conf.j2 new file mode 100644 index 0000000..f723e36 --- /dev/null +++ b/roles/firewall/templates/maat.conf.j2 @@ -0,0 +1,30 @@ +[STATIC] +MAAT_MODE=2 +STAT_SWITCH=1 +PERF_SWITCH=1 +TABLE_INFO=tsgconf/tsg_static_tableinfo.conf +STAT_FILE=tsg_static_maat.status +EFFECT_INTERVAL_S=1 +REDIS_IP={{ maat_redis_server.address }} +REDIS_PORT_NUM=1 +REDIS_PORT=7002 +REDIS_INDEX=0 +JSON_CFG_FILE=tsgconf/tsg_maat.json +INC_CFG_DIR=tsgrule/inc/index/ +FULL_CFG_DIR=tsgrule/full/index/ + +[DYNAMIC] +MAAT_MODE=2 +STAT_SWITCH=1 +PERF_SWITCH=1 +TABLE_INFO=tsgconf/tsg_dynamic_tableinfo.conf +STAT_FILE=tsg_dynamic_maat.status +EFFECT_INTERVAL_S=1 +REDIS_IP={{ dynamic_maat_redis_server.address }} +REDIS_PORT_NUM=1 +REDIS_PORT=7002 +REDIS_INDEX=1 +JSON_CFG_FILE=tsgconf/tsg_maat.json +INC_CFG_DIR=tsgrule/inc/index/ +FULL_CFG_DIR=tsgrule/full/index/ + diff --git a/roles/firewall/templates/main.conf.j2 b/roles/firewall/templates/main.conf.j2 new file mode 100644 index 0000000..2e3b994 --- /dev/null +++ b/roles/firewall/templates/main.conf.j2 @@ -0,0 +1,47 @@ +[FTP_PLUG] +LOG_PATH=./tsglog/fw_ftp_plug/fw_ftp_plug +LOG_LEVEL=10 +TIMEOUT=600 +[MAIL_PLUG] +LOG_PATH=./tsglog/fw_mail_plug/fw_mail_plug +LOG_LEVEL=10 +TIMEOUT=600 +[HTTP_PLUG] +LOG_PATH=./tsglog/fw_http_plug/fw_http_plug +LOG_LEVEL=10 +[DNS_PLUG] +LOG_PATH=./tsglog/fw_dns_plug/fw_dns_plug +LOG_LEVEL=10 +[MAAT] +PROFILE=./tsgconf/maat.conf +IP_ADDR_TABLE=TSG_OBJ_IP_ADDR +SUBSCRIBER_ID_TABLE=TSG_OBJ_SUBSCRIBER_ID +CB_SUBSCRIBER_IP_TABLE=TSG_DYN_SUBSCRIBER_IP + +[TSG_LOG] +MODE=1 +NIC_NAME={{ nic_mgr.name }} +MAX_SERVICE=1 +LOG_LEVEL=10 +LOG_PATH=./tsglog/tsglog +BROKER_LIST={{ log_kafkabrokers.address }} +COMMON_FIELD_FILE=tsgconf/tsg_log_field.conf + +[STATISTIC] +CYCLE=0 +TELEGRAF_PORT=8100 +TELEGRAF_IP=127.0.0.1 +OUTPUT_PATH=./tsg_statistic.log +APP_NAME=statistic + +[FIELD_STAT] +CYCLE=3 +TELEGRAF_PORT=8125 +TELEGRAF_IP=127.0.0.1 +OUTPUT_PATH=./tsg_stat.log +APP_NAME=tsg_master + +[SYSTEM] +LOG_LEVEL=10 +LOG_PATH=./tsglog/tsg_master +POLICY_PRIORITY_LABEL=POLICY_PRIORITY diff --git a/roles/sapp/tasks/main.yml b/roles/sapp/tasks/main.yml index 131d5b1..54b70b4 100644 --- a/roles/sapp/tasks/main.yml +++ b/roles/sapp/tasks/main.yml @@ -10,6 +10,11 @@ - /tmp/ansible_deploy/sapp-4.0.5.3385992-1.el7.x86_64.rpm state: present +- name: make dir + file: + path: /home/mesasoft/sapp_run/tsgconf + state: directory + - name: Template the sapp.toml template: src: "{{ role_path }}/templates/sapp.toml.j2" @@ -34,19 +39,6 @@ dest: /home/mesasoft/sapp_run/etc/gdev.conf tags: template -- name: Template the tsgconf/main.conf - template: - src: "{{ role_path }}/templates/main.conf.j2" - dest: /home/mesasoft/sapp_run/tsgconf/main.conf - tags: template - - -- name: Template the tsgconf/maat.conf - template: - src: "{{ role_path }}/templates/maat.conf.j2" - dest: /home/mesasoft/sapp_run/tsgconf/maat.conf - tags: template - - name: "enable sapp" systemd: name: sapp diff --git a/roles/sapp/templates/maat.conf.j2 b/roles/sapp/templates/maat.conf.j2 deleted file mode 100644 index f723e36..0000000 --- a/roles/sapp/templates/maat.conf.j2 +++ /dev/null @@ -1,30 +0,0 @@ -[STATIC] -MAAT_MODE=2 -STAT_SWITCH=1 -PERF_SWITCH=1 -TABLE_INFO=tsgconf/tsg_static_tableinfo.conf -STAT_FILE=tsg_static_maat.status -EFFECT_INTERVAL_S=1 -REDIS_IP={{ maat_redis_server.address }} -REDIS_PORT_NUM=1 -REDIS_PORT=7002 -REDIS_INDEX=0 -JSON_CFG_FILE=tsgconf/tsg_maat.json -INC_CFG_DIR=tsgrule/inc/index/ -FULL_CFG_DIR=tsgrule/full/index/ - -[DYNAMIC] -MAAT_MODE=2 -STAT_SWITCH=1 -PERF_SWITCH=1 -TABLE_INFO=tsgconf/tsg_dynamic_tableinfo.conf -STAT_FILE=tsg_dynamic_maat.status -EFFECT_INTERVAL_S=1 -REDIS_IP={{ dynamic_maat_redis_server.address }} -REDIS_PORT_NUM=1 -REDIS_PORT=7002 -REDIS_INDEX=1 -JSON_CFG_FILE=tsgconf/tsg_maat.json -INC_CFG_DIR=tsgrule/inc/index/ -FULL_CFG_DIR=tsgrule/full/index/ - diff --git a/roles/sapp/templates/main.conf.j2 b/roles/sapp/templates/main.conf.j2 deleted file mode 100644 index 2e3b994..0000000 --- a/roles/sapp/templates/main.conf.j2 +++ /dev/null @@ -1,47 +0,0 @@ -[FTP_PLUG] -LOG_PATH=./tsglog/fw_ftp_plug/fw_ftp_plug -LOG_LEVEL=10 -TIMEOUT=600 -[MAIL_PLUG] -LOG_PATH=./tsglog/fw_mail_plug/fw_mail_plug -LOG_LEVEL=10 -TIMEOUT=600 -[HTTP_PLUG] -LOG_PATH=./tsglog/fw_http_plug/fw_http_plug -LOG_LEVEL=10 -[DNS_PLUG] -LOG_PATH=./tsglog/fw_dns_plug/fw_dns_plug -LOG_LEVEL=10 -[MAAT] -PROFILE=./tsgconf/maat.conf -IP_ADDR_TABLE=TSG_OBJ_IP_ADDR -SUBSCRIBER_ID_TABLE=TSG_OBJ_SUBSCRIBER_ID -CB_SUBSCRIBER_IP_TABLE=TSG_DYN_SUBSCRIBER_IP - -[TSG_LOG] -MODE=1 -NIC_NAME={{ nic_mgr.name }} -MAX_SERVICE=1 -LOG_LEVEL=10 -LOG_PATH=./tsglog/tsglog -BROKER_LIST={{ log_kafkabrokers.address }} -COMMON_FIELD_FILE=tsgconf/tsg_log_field.conf - -[STATISTIC] -CYCLE=0 -TELEGRAF_PORT=8100 -TELEGRAF_IP=127.0.0.1 -OUTPUT_PATH=./tsg_statistic.log -APP_NAME=statistic - -[FIELD_STAT] -CYCLE=3 -TELEGRAF_PORT=8125 -TELEGRAF_IP=127.0.0.1 -OUTPUT_PATH=./tsg_stat.log -APP_NAME=tsg_master - -[SYSTEM] -LOG_LEVEL=10 -LOG_PATH=./tsglog/tsg_master -POLICY_PRIORITY_LABEL=POLICY_PRIORITY -- cgit v1.2.3