Playbook ファイルやディレクトリを削除するサンプル

環境
Ansible
Playbook

操作例
ファイル /etc/ctn.conf をファイルを削除する
サンプルコード

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
- hosts: testhss
gather_facts: no
become: yes
tasks:
- file:
path: /etc/ctn.conf
state: absent
- hosts: testhss gather_facts: no become: yes tasks: - file: path: /etc/ctn.conf state: absent
- hosts: testhss
  gather_facts: no
  become: yes

  tasks:
    - file:
        path: /etc/ctn.conf
        state: absent

説明
path オプション
ファイル名のパスを指定します。
state オプション
state: absent を指定します。

Ansible

Posted by arkgame