Skip to content

Commit eee92a0

Browse files
committed
Ensure the verify-permissions playbook executes
Add pre_tasks section to the playbook to load variables via the set-vars role. All playbooks should do this. Eliminate specification of owner/group in the test for cache writing by meza-ansible: - owner: "{{ ansible_user | default(ansible_env.USER) }}" - group: "{{ group_apache }}" because those cause a chmod which is not allowed even though meza-ansible can write to the cache directory. Note: although we could get a full shell with become_flags: '-i' this is not necessary for testing write permissions in the cache directory Ensure message display by filtering items to integer with the 'int' jinja filter Final work following on b3badfc Fixes Issue #186
1 parent 138d109 commit eee92a0

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

src/playbooks/verify-permissions.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@
77
gather_facts: true
88
become: true
99

10+
# All playbooks should load critical Meza variables first
11+
pre_tasks:
12+
- name: Load critical Meza variables
13+
ansible.builtin.include_role:
14+
name: set-vars
15+
1016
tasks:
1117
- name: Include permission verification role
1218
ansible.builtin.include_role:

src/roles/verify-permissions/tasks/main.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
- name: Display directory permissions
2424
ansible.builtin.debug:
25-
msg: "{{ item.item }}: owner={{ item.stat.pw_name }}, group={{ item.stat.gr_name }}, mode={{ '%04o' | format(item.stat.mode) }}"
25+
msg: "{{ item.item }}: owner={{ item.stat.pw_name }}, group={{ item.stat.gr_name }}, mode={{ '%04o' | format(item.stat.mode | int) }}"
2626
loop: "{{ dir_perms.results }}"
2727
when: item.stat.exists
2828

@@ -42,13 +42,15 @@
4242
ansible.builtin.file:
4343
path: "{{ m_cache_directory }}/test-write"
4444
state: touch
45-
owner: "{{ ansible_user | default(ansible_env.USER) }}"
46-
group: "{{ group_apache }}"
4745
mode: '0664'
4846
become: true
4947
become_user: meza-ansible
5048
register: cache_write_test
5149

50+
- name: Debug cache write test
51+
ansible.builtin.debug:
52+
msg: "cache write test: {{ cache_write_test }}"
53+
5254
- name: Remove test file
5355
ansible.builtin.file:
5456
path: "{{ m_cache_directory }}/test-write"

0 commit comments

Comments
 (0)