Debian Codegraph @

ansible_collections/community/mongodb/roles/mongodb_selinux/tasks/main.yml

raw
1 ---
2 # tasks file for mongodb_selinux
3 - name: Include OS-specific vars
4 include_vars:
5 file: "{{ lookup('first_found', params) }}"
6 vars:
7 params:
8 paths:
9 - "vars"
10 files:
11 - "{{ ansible_facts.distribution }}-{{ ansible_facts.distribution_version }}.yml"
12 - "{{ ansible_facts.os_family }}-{{ ansible_facts.distribution_major_version }}.yml"
13 - "{{ ansible_facts.distribution }}.yml"
14 - "{{ ansible_facts.os_family }}.yml"
15 - default.yml
16 tags:
17 - "vars"
18
19 - name: Install required packages
20 ansible.builtin.package:
21 name: "{{ required_packages }}"
22 register: _pkg
23 until: _pkg is succeeded
24 retries: 5
25 tags:
26 - "pkg"
27 - "setup"
28
29 - name: Copy custom MongoDB SeLinux Policy to Host
30 ansible.builtin.copy:
31 content: |
32 module mongodb_cgroup_memory 1.0;
33
34 require {
35 type cgroup_t;
36 type mongod_t;
37 class dir search;
38 class file { getattr open read };
39 }
40
41 #============= mongod_t ==============
42 allow mongod_t cgroup_t:dir search;
43 allow mongod_t cgroup_t:file { getattr open read };
44 dest: /root/mongodb_cgroup_memory.te
45 register: mongodb_policy
46 tags:
47 - "setup"
48 - "mongodb"
49 - "linux"
50
51 - name: Compile & Install MongoDB Policy
52 ansible.builtin.script: files/compile_mongodb_selinux.sh
53 when: mongodb_policy.changed
54 tags:
55 - "setup"
56 - "mongodb"
57 - "linux"