Playbook ファイルやディレクトリを削除するサンプル
環境
Ansible
Playbook
操作例
ファイル /etc/ctn.conf をファイルを削除する
サンプルコード
- 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 を指定します。