簡體   English   中英

Ansible 社區分開模塊詢問“您確定要繼續”,是否有覆蓋

[英]Ansible community parted module asking "Are you sure you want to continue", is there an override

我正在嘗試使用 Ansible 擴展ext4分區以填充 Alpine 上的磁盤。

按照這里的社區分開的模塊文檔,我應該也可以。 但是,在執行該操作時,返回的錯誤消息顯示"Warning: Partition /dev/xvda3 is being used. Are you sure you want to continue?\n"

無論如何,是否有強制此操作在實時系統上進行,因為即使啟用了-s標志,Parted 似乎也在要求用戶交互?

我正在使用的任務:

 - name: Read device information
  community.general.parted: device=/dev/xvda unit=MiB
  register: sdb_info

 - name: Extend an existing partition to fill all available space
  community.general.parted:
    device: /dev/xvda
    number: "{{ sdb_info.partitions | length }}"
    part_end: "100%"
    resize: true
    state: present

ansible-playbook main.yaml -vvvv的完整錯誤:

fatal: [10.10.30.100]: FAILED! => {
    "changed": false,
    "err": "Warning: Partition /dev/xvda3 is being used. Are you sure you want to continue?\n",
    "invocation": {
        "module_args": {
            "align": "optimal",
            "device": "/dev/xvda",
            "flags": null,
            "fs_type": null,
            "label": "msdos",
            "name": null,
            "number": 3,
            "part_end": "100%",
            "part_start": "0%",
            "part_type": "primary",
            "resize": true,
            "state": "present",
            "unit": "KiB"
        }
    },
    "msg": "Error while running parted script: /usr/sbin/parted -s -m -a optimal /dev/xvda -- resizepart 3 100%",
    "out": "",
    "rc": 1
}

目標主機:

  • Alpine-VM 3.16.2
  • 分開 3.5
  • Python 3.10.5

當地的:

  • Ansible 2.13.3
  • Python 3.10.4

根據文檔community.general和源代碼community.general/blob/main/plugins/modules/system/parted.py ,該模塊只是 Linux 工具parted的包裝。

查看其他類似報告,例如 Ubuntu Launchpad # 1270203 ,確認問題

Warning: Partition <part> is being used. Are you sure you want to continue?

如果嘗試在已安裝的分區上resizepart ,這似乎是正常和預期的行為。

Ansible 社區分開模塊詢問“您確定要繼續”

因此,不是社區模塊在詢問,而是parted工具自行分離。

是否有覆蓋

在社區模塊本身中,目前既沒有涵蓋這種極端情況,也沒有實現覆蓋。 因此會拋出錯誤消息。

你可以

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM