設定ファイルの末尾に設定をゴリっと追加したい。
設定ファイル
cat example.conf
[example]
hogehoge = hoge
fugafuga = fuga
プレイブック
---
- hosts: 127.0.0.1
vars:
- fileName: example.conf
tasks:
- name: 設定ファイルに追記したい
ansible.builtin.blockinfile:
path: "{{ fileName }}"
block: |
[exampleAppend]
hogehoeg = hoge
fugafuga = fuga
insertafter: EOF
state: present
samba の設定ファイルっぽい example.conf がある。ファイル末尾に以下の行を追加
[exampleAppend]
hogehoeg = hoge
fugafuga = fuga