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/tfe/tasks/main.yml

147 lines
4.2 KiB
YAML

---
- name: "download rpm packages: tfe"
yum:
name: "{{ item.value }}"
conf_file: "{{ rpm_repo_config_path }}"
state: present
download_only: yes
download_dir: "{{ path_download }}"
with_dict: "{{ tfe_rpm_version }}"
- name: "copy tfe program to destination server"
copy:
src: "{{ role_path }}/files/"
dest: /tmp/ansible_deploy/
- name: "copy tfe.service to destination server"
copy:
src: "{{ role_path }}/files/tfe.service"
dest: /usr/lib/systemd/system/
mode: 0644
- name: "Get tfe rpm final version"
set_fact:
tfe_rpm_final_version: "{{ item.value }}"
when: item.key is search("tfe")
with_dict: "{{ tfe_rpm_version }}"
- name: "Get tfe rpm path"
find:
path: /tmp/rpm_download/
pattern: "{{ tfe_rpm_final_version }}*"
register: tfe_rpm_fullname
- name: "Install tfe from local path"
yum:
name: "{{ tfe_rpm_fullname.files[0].path }}"
state: present
disable_gpg_check: yes
- name: "tfe:copy cert file to device"
copy:
src: '{{ role_path }}/files/tsg_diagnose_ca.pem'
dest: /opt/tsg/tfe/resource/tfe/
- name: "template tfe-env config"
template:
src: "{{ role_path }}/templates/tfe-env-config.j2"
dest: /etc/sysconfig/tfe-env-config
- name: "move tfe sysctl.conf"
shell: mv /etc/sysctl.d/80-tfe.conf /usr/lib/sysctl.d/80-tfe.conf
when: runtime_env != 'TSG-X-P0906'
- name: "template the tfe.conf"
template:
src: "{{ role_path }}/templates/tfe.conf.j2.j2"
dest: /opt/tsg/tsg-os-provision/templates/tfe.conf.j2
when: runtime_env != 'TSG-X-P0906'
- name: "template the zlog.conf"
template:
src: "{{ role_path }}/templates/zlog.conf.j2"
dest: /opt/tsg/tfe/conf/tfe/zlog.conf
- name: "template the future.conf"
template:
src: "{{ role_path }}/templates/future.conf.j2"
dest: /opt/tsg/tfe/conf/tfe/future.conf
- name: "create conf/doh/"
file:
path: /opt/tsg/tfe/conf/doh/
state: directory
- name: "template the doh.conf"
template:
src: "{{ role_path }}/templates/doh.conf.j2"
dest: /opt/tsg/tfe/conf/doh/doh.conf
- name: "create a override conf - first step, create dir"
file:
path: /usr/lib/systemd/system/tfe.service.d/
state: directory
mode: '0755'
- name: "create a override conf - second step, copy a override service file"
template:
src: "{{ role_path }}/templates/require-mrzcpd.conf.j2"
dest: /usr/lib/systemd/system/tfe.service.d/require-mrzcpd.conf
- name: "copy slice file to tfe.service.d"
copy:
src: "{{ role_path }}/templates/service_override_slice.conf.j2"
dest: /usr/lib/systemd/system/tfe.service.d/service_override_slice.conf
mode: 0644
when: runtime_env != 'TSG-X-P0906'
- name: "copy env file to tfe.service.d"
copy:
src: "{{ role_path }}/templates/service_override_env.conf.j2"
dest: /usr/lib/systemd/system/tfe.service.d/service_override_env.conf
mode: 0644
- 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/tfe-env.service
- /usr/lib/systemd/system/tfe.service
when: runtime_env != 'TSG-X-P0906'
- name: "template the service_add_StartPostForRps.conf"
template:
src: "{{ role_path }}/templates/service_add_StartPostForRps.conf.j2.j2"
dest: /opt/tsg/tsg-os-provision/templates/service_add_StartPostForRps.conf.j2
when: runtime_env != 'TSG-X-P0906'
- name: "add condition into service depend provision result TSG-X-P0906"
copy:
src: "{{ role_path }}/files/service_override_Requires.conf"
dest: "/usr/lib/systemd/system/tfe-env.service.d/"
mode: 0644
when: runtime_env == 'TSG-X-P0906'
- name: "template tfe-env shell to dest"
template:
src: "{{ role_path }}/templates/{{ item.src }}"
dest: "/opt/tsg/tfe/{{ item.dest }}"
mode: 0755
when: runtime_env == 'TSG-X-P0906'
with_items:
- {src: "tfe-env-start.sh.j2", dest: "tfe-env-start.sh" }
- {src: "tfe-env-stop.sh.j2", dest: "tfe-env-stop.sh" }
##################### tfe #####################
- name: "enable tfe-env"
systemd:
name: tfe-env
enabled: yes
- name: "enable tfe"
systemd:
name: tfe
enabled: yes