Ansible templateモジュールの使い方のサンプル
環境
Ansible
RHEL8.6
構文
– template: src="ローカル側のテンプレートのファイルパス"
dest="リモート側の配置先"
テンプレートのファイルを置きます
使用例
- set_fact:
TS:
- { src: 'test.conf.xxx' , dest: 'test.conf' }
- name: test.confを配置
template:
src: "/data/back"
dest: "/etc/tt"
owner: testuser
group: testuser
mode: 0644
with_items: "{{ TS }}"
- set_fact:
TS:
- { src: 'test.conf.xxx' , dest: 'test.conf' }
- name: test.confを配置
template:
src: "/data/back"
dest: "/etc/tt"
owner: testuser
group: testuser
mode: 0644
with_items: "{{ TS }}"
- set_fact: TS: - { src: 'test.conf.xxx' , dest: 'test.conf' } - name: test.confを配置 template: src: "/data/back" dest: "/etc/tt" owner: testuser group: testuser mode: 0644 with_items: "{{ TS }}"