This repository has been archived on 2025-09-14. You can view files and clone it, but cannot push or open issues or pull requests.
Files
tsg-wannat-ansible-deploy/roles/natgw/tasks/main.yml
2021-12-01 21:42:24 +08:00

74 lines
1.9 KiB
YAML

---
- name: "copy natgw_rpm_file to destination server"
copy:
src: "{{ role_path }}/files/rpm/{{ wannat_global.rpm_files.natgw_rpm_file }}"
dest: "/tmp/"
#- name: "install natgw"
# yum:
# name: "{{ packages }}"
# state: present
# vars:
# packages:
# - /tmp/{{ wannat_global.rpm_files.natgw_rpm_file }}
- name: "install natgw"
shell: rpm --nodeps --force -i /tmp/{{ wannat_global.rpm_files.natgw_rpm_file }}
args:
warn: false
- name: "Creates /opt/tsg/wannat/natgw directory"
file:
path: /opt/tsg/wannat/natgw
state: directory
- name: "Creates /opt/tsg/wannat/natgw/conf directory"
file:
path: /opt/tsg/wannat/natgw/conf
state: directory
- name: "copy natgw_set_iptables_rule.sh to destination server"
copy:
src: "{{ role_path }}/files/script/natgw_set_iptables_rule.sh"
dest: "/opt/tsg/wannat/natgw/"
mode: a+x
- name: "Template the natgw.conf"
template:
src: "{{ role_path }}/templates/natgw.conf.j2"
dest: /opt/tsg/wannat/natgw/conf/natgw.conf
tags: template
- name: "Template the natgw_log.conf"
template:
src: "{{ role_path }}/templates/natgw_log.conf.j2"
dest: /opt/tsg/wannat/natgw/conf/natgw_log.conf
tags: template
- name: "Template the maat compile table info"
template:
src: "{{ role_path }}/templates/compile_tableinfo.conf.j2"
dest: /opt/tsg/wannat/natgw/conf/compile_tableinfo.conf
tags: template
- name: "Template the maat plugin table info"
template:
src: "{{ role_path }}/templates/plugin_tableinfo.conf.j2"
dest: /opt/tsg/wannat/natgw/conf/plugin_tableinfo.conf
tags: template
- name: "Template the natgw.service"
template:
src: "{{ role_path }}/templates/natgw.service.j2"
dest: /usr/lib/systemd/system/natgw.service
tags: template
- name: "enable natgw service"
systemd:
name: natgw
enabled: yes
daemon_reload: yes
state: started