“yum clean all”会删除符号链接吗?

“yum clean all”会删除符号链接吗?

我正在运行融合升级剧本来升级版本。我的操作系统是 RHEL 7,我已经安装了 Python 3.9 并从 /usr/bin 目录创建了到它的符号链接。

运行合流剧本时,它有一个任务,yum-clean-all后面跟着以下任务

  • 自定义 Java 安装
  • 安装Java
  • ...
  • ...
  • 安装点子
  • 升级点
  • 安装 pip 包

该剧本在安装时失败pip packages,之后 ansible 不可用。

收到此错误 -

ansible --version

Traceback (most recent call last):
  File "/usr/local/bin/ansible", line 34, in <module>
    from ansible import context
ModuleNotFoundError: No module named 'ansible'

此外,此时也缺少从 /usr/bin 到 python3 的符号链接。

在 中/var/log/yum.log,我在我的剧本失败时看到了以下内容

Jan 04 14:50:44 Installed: python3-setuptools-39.2.0-10.el7.noarch
Jan 04 14:50:44 Installed: python3-pip-9.0.3-8.el7.noarch
Jan 04 14:50:44 Installed: python3-3.6.8-21.el7_9.x86_64
Jan 04 14:50:46 Installed: python3-libs-3.6.8-21.el7_9.x86_64

因此,我怀疑yum clean all删除了这些链接,但无法找到任何证实这一怀疑的内容。

所以,问题是 - 是否yum clean all删除符号链接。有相关文件吗?

如果这不是原因,我需要更深入地挖掘以找出发生了什么

感谢任何指点

更新

这部分的 Confluence 剧本

---
- name: Ensure Custom Repo file is not in repos when repository_configuration is Confluent
  file:
    state: absent
    path: /etc/yum.repos.d/custom-confluent.repo
  when:
    - repository_configuration == 'confluent'
    - installation_method == "package"

- name: Add Confluent Repo file
  template:
    src: confluent.repo.j2
    dest: /etc/yum.repos.d/confluent.repo
    mode: 0644
  register: confluent_repo_result
  until: confluent_repo_result is success
  retries: 5
  delay: 90
  when:
    - repository_configuration == 'confluent'
    - installation_method == "package"

- name: Ensure Confluent Repo file is not in repos when repository_configuration is Custom
  file:
    state: absent
    path: /etc/yum.repos.d/confluent.repo
  when:
    - repository_configuration == 'custom'

- name: Add Custom Repo file
  copy:
    src: "{{custom_yum_repofile_filepath}}"
    dest: /etc/yum.repos.d/custom-confluent.repo
    mode: 0644
  register: custom_repo_result
  until: custom_repo_result is success
  retries: 5
  delay: 90
  when: repository_configuration == 'custom'

# Not using handler because of https://github.com/ansible/ansible/issues/41313
- name: yum-clean-all
  command: yum clean all
  args:
    warn: false
  register: yum_clean_result
  until: yum_clean_result is success
  retries: 5
  delay: 90
  when: >
    confluent_repo_result.changed|default(False) or
    repository_configuration == 'custom'

- name: Custom Java Install
  include_tasks: custom_java_install.yml

- name: Install Java
  yum:
    name: "{{redhat_java_package_name}}"
    state: present
  register: java_install_result
  until: java_install_result is success  or ansible_check_mode
  retries: 10
  delay: 5
  when: install_java|bool
  tags: package

- name: Install OpenSSL and Unzip
  yum:
    name:
      - openssl
      - unzip
  tags: package

- name: Get Java Version
  shell: java -version
  register: version_output
  check_mode: false
  changed_when: false

- name: Print Java Version
  debug:
    msg: "Current Java Version is: {{version_output.stderr_lines[0]}}"

- name: Install pip
  yum:
    name:
      - python3-pip
    state: present
  become: true
  tags: package

- name: Upgrade pip
  ansible.builtin.pip:
    name: pip
    extra_args: --upgrade
  tags: package

- name: Install pip packages
  ansible.builtin.pip:
    name: "{{pip_packages}}"
  tags: package

相关内容