Ansible shellモジュールで存在ファイルやディレクトリをスキップするサンプル

環境
Ansible

構文

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
- shell: シェル
args:
chdir: 実行ディレクトリ(省略可)
creates: ファイルやフォルダ
- shell: シェル args: chdir: 実行ディレクトリ(省略可) creates: ファイルやフォルダ
- shell: シェル
  args:
    chdir: 実行ディレクトリ(省略可)
    creates: ファイルやフォルダ

使用例
ディレクトリ「/usr/local/data」とファイル「test.conf」が存在する場合スキップする

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
- shell: シェル
args:
chdir: /usr/local/data
creates: test.conf
- shell: シェル args: chdir: /usr/local/data creates: test.conf
- shell: シェル
  args:
    chdir: /usr/local/data
    creates: test.conf

 

Ansible

Posted by arkgame