文件操作 - main.yml
返回文件管理
返回主菜单
删除本文件
文件: /usr/lib/python3.12/site-packages/ansible_collections/ovirt/ovirt/roles/infra/tasks/main.yml
编辑文件内容
--- - name: Main block block: - name: Check if mandatory parameters are correct ansible.builtin.fail: msg: "one of mandatory parameter data_center_name or compatibility_version is undefined" when: "data_center_name is undefined or compatibility_version is undefined" - name: Get list of oVirt infra hosts we can use throughtout the role ansible.builtin.set_fact: ovirt_infra_hosts: "{{ lookup('vars', hosts_var_name, default=[]) }}" - name: Check if hosts are correct ansible.builtin.fail: msg: "'{{ lookup('vars', hosts_var_name) }}' variable does not contain mandatory parameter '{{ item[1] }}'" when: item[1] not in item[0] with_nested: - "{{ ovirt_infra_hosts }}" - ['name'] - name: Login to oVirt ovirt_auth: url: "{{ engine_url | default(lookup('env','OVIRT_URL')) | default(omit) }}" username: "{{ engine_user | default(lookup('env','OVIRT_USERNAME')) | default(omit) }}" hostname: "{{ engine_fqdn | default(lookup('env','OVIRT_HOSTNAME')) | default(omit) }}" password: "{{ engine_password | default(lookup('env','OVIRT_PASSWORD')) | default(omit) }}" ca_file: "{{ engine_cafile | default(lookup('env','OVIRT_CAFILE')) | default(omit) }}" insecure: "{{ engine_insecure | default(true) }}" when: ovirt_auth is undefined or not ovirt_auth register: loggedin tags: - always - name: Create infrastrucutre import_tasks: create_infra.yml when: data_center_state == 'present' - name: Remove infrastrucutre import_tasks: remove_infra.yml when: data_center_state == 'absent' always: - name: Logout from oVirt ovirt_auth: state: absent ovirt_auth: "{{ ovirt_auth }}" when: not loggedin.skipped | default(false) tags: - always
修改文件时间
将文件时间修改为当前时间的前一年
删除文件