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

191 lines
5.5 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: "Install sapp rpm package"
shell: rpm -i /tmp/rpm_download/{{ item.value }}* --prefix {{ prefix_path.sapp }}
when: item.key is search("sapp")
with_dict: "{{ sapp_rpm_version }}"
- name: "Install tcpdump_mesa rpm package"
shell: rpm -i /tmp/rpm_download/{{ sapp_rpm_version.tcpdump_mesa }}* --prefix {{ prefix_path.framework }}
- 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: replace Requires to Wants in sapp service file
replace:
path: "{{ item }}"
regexp: 'Requires'
replace: 'Wants'
with_items:
- /usr/lib/systemd/system/sapp.service
- 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_server
template:
src: "{{ role_path }}/templates/conflist.inf.j2.j2"
dest: /opt/tsg/tsg-os-provision/templates/conflist.inf.j2
tags: template
- 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 - 7400-MCN0 and 9140
template:
src: "{{ role_path }}/templates/necessary_plug_list.conf.j2"
dest: /opt/tsg/sapp/etc/necessary_plug_list.conf
tags: template
- 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:
- runtime_env == 'TSG-9140' or runtime_env == 'TSG-server'
- 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:
- runtime_env == 'TSG-7400-mcn0'
- 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: /usr/lib/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_override_env.conf.j2"
dest: /usr/lib/systemd/system/sapp.service.d/service_override_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:
- runtime_env == 'TSG-7400-mcn0'
- name: "replace action: replace service WantedBy from multi-user.target to workload.target"
replace:
path: "{{ item }}"
regexp: 'WantedBy=multi-user.target'
replace: 'WantedBy=workload.target'
with_items:
- /usr/lib/systemd/system/sapp.service
- name: 'delete r2,r3'
file:
path: "/opt/tsg/sapp/{{ item }}"
state: absent
with_items:
- r2
- r3
##################### sapp #####################
- name: "systemctl daemon-reload"
systemd:
daemon_reload: yes
when: runtime_env == 'TSG-server'
- name: "enable sapp"
systemd:
name: sapp
enabled: yes