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-tsg-os-buildimage/ansible/roles/sapp/tasks/main.yml
2021-07-29 13:22:49 +08:00

187 lines
5.6 KiB
YAML

---
- name: "Create directory /opt/tsg/framework and /opt/tsg/sapp if they not exist"
file:
path: "{{ item }}"
state: directory
mode: '0644'
with_items:
- /opt/tsg/sapp
- /opt/tsg/framework
- name: "download sapp and tcpdump_mesa rpms from localhost"
yum:
name: "{{ item.value }}"
conf_file: "{{ rpm_repo_config_path }}"
state: present
download_only: yes
download_dir: /tmp/rpm_download/
with_dict: "{{ sapp_rpm_version }}"
- name: "Install sapp and tcpdump_mesa rpm package"
shell: rpm -i /tmp/rpm_download/{{ item.rpm_version }}* --prefix {{ item.prefix_path }}
with_items:
- {"rpm_version": "{{ sapp_rpm_version.sapp }}", "prefix_path": "{{ sapp.prefix_path }}" }
- {"rpm_version": "{{ sapp_rpm_version.tcpdump_mesa }}", "prefix_path": "{{ framework.prefix_path }}" }
- name: replace sapp service
replace:
path: "{{ item }}"
regexp: '/home/mesasoft/sapp_run'
replace: '/opt/tsg/sapp'
with_items:
- /usr/lib/systemd/system/sapp.service
- /etc/sysconfig/sapp
- name: "mkdir tsgconf"
file:
path: /opt/tsg/sapp/tsgconf
state: directory
- name: Template the sapp.toml
template:
src: "{{ role_path }}/templates/sapp.toml.j2.j2"
dest: /opt/tsg/tsg-os-provision/templates/sapp.toml.j2
tags: template
- name: Template the project_list.conf
template:
src: "{{ role_path }}/templates/project_list.conf.j2"
dest: /opt/tsg/sapp/etc/project_list.conf
tags: template
- name: Template the send_raw_pkt.conf
template:
src: "{{ role_path }}/templates/send_raw_pkt.conf.j2"
dest: /opt/tsg/sapp/etc/send_raw_pkt.conf
tags: template
- name: Template the conflist.inf - tsg_9140
template:
src: "{{ role_path }}/templates/conflist.inf.j2.9000NPBP01R01"
dest: /opt/tsg/sapp/plug/conflist.inf
tags: template
when:
- PROFILE_ID == '9000-NPB-P01R01'
- name: Template the conflist.inf - tsg_7400
template:
src: "{{ role_path }}/templates/conflist.inf.j2.j2.7400MCN0P01R01"
dest: /opt/tsg/tsg-os-provision/templates/conflist.inf.j2
tags: template
when:
- PROFILE_ID == '7400-MCN0-P01R01'
- name: Template the entrylist.conf.j2
template:
src: "{{ role_path }}/templates/entrylist.conf.j2"
dest: /opt/tsg/sapp/etc/entrylist.conf
tags: template
- name: Template the asymmetric_addr_layer.conf.j2
template:
src: "{{ role_path }}/templates/asymmetric_addr_layer.conf.j2"
dest: /opt/tsg/sapp/etc/asymmetric_addr_layer.conf
tags: template
- name: Template the necessary_plug_list.conf - tsg_9140
template:
src: "{{ role_path }}/templates/necessary_plug_list.conf.j2.9000NPBP01R01"
dest: /opt/tsg/sapp/etc/necessary_plug_list.conf
tags: template
when:
- PROFILE_ID == '9000-NPB-P01R01'
- name: Template the necessary_plug_list.conf - tsg_7400
template:
src: "{{ role_path }}/templates/necessary_plug_list.conf.j2.j2.7400MCN0P01R01"
dest: /opt/tsg/tsg-os-provision/templates/necessary_plug_list.conf.j2
tags: template
when:
- PROFILE_ID == '7400-MCN0-P01R01'
- name: Template the vlan_flipping_map.conf - tsg-9140
template:
src: "{{ role_path }}/templates/vlan_flipping_map.conf.j2.9000NPBP01R01"
dest: /opt/tsg/sapp/etc/vlan_flipping_map.conf
tags: template
when:
- PROFILE_ID == '9000-NPB-P01R01'
- name: Template the vlan_flipping_map.conf - tsg-7400
template:
src: "{{ role_path }}/templates/vlan_flipping_map.conf.j2.j2.7400MCN0P01R01"
dest: /opt/tsg/tsg-os-provision/templates/vlan_flipping_map.conf.j2
tags: template
when:
- PROFILE_ID == '7400-MCN0-P01R01'
- name: Template the sapp_log.conf
template:
src: "{{ role_path }}/templates/sapp_log.conf.j2"
dest: /opt/tsg/sapp/etc/sapp_log.conf
tags: template
- name: Template the sapp_tmpfile.conf
template:
src: "{{ role_path }}/templates/sapp_tmpfile.conf.j2"
dest: /etc/tmpfiles.d/sapp_tmpfile.conf
tags: template
- name: Template the gdev.conf
template:
src: "{{ role_path }}/templates/gdev.conf.j2.j2"
dest: /opt/tsg/tsg-os-provision/templates/gdev.conf.j2
tags: template
- name: Template the well_known_port.conf
template:
src: "{{ role_path }}/templates/well_known_port.conf.j2"
dest: /opt/tsg/sapp/etc/well_known_port.conf
tags: template
- name: "Create /usr/lib/systemd/system/sapp.service.d/ directory if it does not exist"
file:
path: "{{ item }}"
state: directory
mode: '0755'
with_items:
- /usr/lib/systemd/system/sapp.service.d
- name: "sapp: service override timeoutsec"
template:
src: "{{ role_path }}/templates/service_override_timeoutsec.conf.j2"
dest: /usr/lib/systemd/system/sapp.service.d/service_override_timeoutsec.conf
mode: 0644
- name: "copy slice file to sapp.service.d"
copy:
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/sapp.service.d/service_override_slice.conf
mode: 0644
- name: "copy env conf to sapp.service.d"
copy:
src: "{{ role_path }}/templates/service_env.conf.j2"
dest: /usr/lib/systemd/system/sapp.service.d/service_env.conf
mode: 0644
- name: "copy fake promisc tools for tera mode - service file and scripts"
copy:
src: "{{ item.src }}"
dest: /opt/tsg/tsg-os-provision/files/
mode: "{{ item.mode }}"
with_items:
- { src: "{{ role_path }}/files/service_attach_startpre.conf.tera", mode: "0644" }
- { src: "{{ role_path }}/files/service_attach_startpre.conf.except_tera", mode: "0644" }
- { src: "{{ role_path }}/files/tera_fake_promisc_setup.sh", mode: "0755" }
when:
- PROFILE_ID == '7400-MCN0-P01R01'
##################### sapp #####################
- name: "enable sapp"
systemd:
name: sapp
enabled: yes