serverapps:configmgmt:ansible:module:lineinfile_module
文書の過去の版を表示しています。
lineinfile - ファイルの行を編集
configの置換などで使用
Options
| パラメータ | default | 選択肢 | コメント |
|---|---|---|---|
| backrefs | no | yes/no | state=presentとともに使用 |
| yesの場合 backreferences (ポジションと名前付きの両方)を利用できる | |||
| insertbefore/insertafterは無視されます | |||
| backup | no | yes/no | タイムスタンプ1)を含むファイル名でバックアップ |
| create | no | yes/no | yes:ファイルが存在しない場合に作成 |
| dest* | - | - | 編集するファイルパス |
| present:他のオプションによる。基本的に置換または挿入 | |||
| insertafter | - | EOF/regex | regexpにマッチすれば置換 |
| マッチしなかった場合、この値にマッチした行の次の行としてlineを挿入 | |||
| EOF:ファイル末尾に挿入 | |||
| insertbefore | - | EOF/regex | insertafter とほぼ同じ動作 |
| 次の行ではなく前の行として挿入 | |||
| line | - | - | 挿入、置換する行 |
| backrefs=yesの場合、正規表現の backreference が使える | |||
| regexp | - | - | 対象の行を探す正規表現 |
| state | present | present/absent | absent:regexp にマッチする行を削除 |
| validate | None | - | ファイルを入れ替える前に任意のコマンドを実行 |
| Syntaxチェックなどに使用2) | |||
| その他 | - | - | fileモジュールで指定可能なオプション |
Exsamples
単に1行追加
- lineinfile: dest=/path/to/any.conf line='canfiguration = YES'
参考
serverapps/configmgmt/ansible/module/lineinfile_module.1492147294.txt.gz · 最終更新: by 127.0.0.1
