c8d8e9adaf
Add become: true to the tasks that need to be able to write to /etc/ Change-Id: I24b118220ce2371f651cad6b8dfbbf5d031ee118 Related-Bug: #1883609
27 lines
708 B
YAML
27 lines
708 B
YAML
---
|
|
- name: Check for hieradata file
|
|
become: true
|
|
stat:
|
|
path:
|
|
src: "{{ hieradata_ansible_file }}"
|
|
register: _hiera_file
|
|
- block:
|
|
- name: Get existing data
|
|
slurp: "{{ hieradata_ansible_file }}"
|
|
register: _file_data
|
|
become: true
|
|
- name: Set data fact
|
|
set_fact:
|
|
heradata_content: "{{ _file_data['content'] | b64decode }}"
|
|
when:
|
|
- _hiera_file.stat is defined
|
|
- _hiera_file.stat.exists
|
|
- name: Write ansible hieradata file
|
|
copy:
|
|
dest: "{{ hieradata_ansible_file }}"
|
|
content: "{{ hieradata_content | default({}) | combine(hieradata_ansible_data | default({})) | to_json }}"
|
|
owner: root
|
|
group: root
|
|
mode: '0644'
|
|
become: true
|