4b4b34e849
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend
|:-:|:-:|:-:|:-:|:-:
|2612|29|2583|13|:-1:
Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/305//ansiblelint">Evolix » ansible-roles » unstable #305</a>
gitea/ansible-roles/pipeline/head This commit looks good
110 lines
2.7 KiB
YAML
110 lines
2.7 KiB
YAML
---
|
|
|
|
- ansible.builtin.fail:
|
|
msg: MongoDB versions <4.2 are not compatible with Debian 11 (Bullseye)
|
|
when:
|
|
- ansible_distribution_release == "bullseye"
|
|
- mongodb_version is version('5.2', '<')
|
|
|
|
- name: "Ensure {{ apt_keyring_dir }} directory exists"
|
|
file:
|
|
path: "{{ apt_keyring_dir }}"
|
|
state: directory
|
|
mode: "755"
|
|
owner: root
|
|
group: root
|
|
|
|
- name: Add MongoDB GPG key
|
|
ansible.builtin.copy:
|
|
src: "server-{{ mongodb_version }}.asc"
|
|
dest: "{{ apt_keyring_dir }}/mongodb-server-{{ mongodb_version }}.asc"
|
|
force: true
|
|
mode: "0644"
|
|
owner: root
|
|
group: root
|
|
|
|
- name: Add MongoDB repository
|
|
ansible.builtin.apt_repository:
|
|
repo: "deb [signed-by={{ apt_keyring_dir }}/mongodb-server-{{ mongodb_version }}.asc] http://repo.mongodb.org/apt/debian bullseye/mongodb-org/{{ mongodb_version }} main"
|
|
state: present
|
|
filename: "mongodb-org-{{ mongodb_version }}"
|
|
|
|
- name: Install packages
|
|
ansible.builtin.apt:
|
|
name: mongodb-org
|
|
update_cache: yes
|
|
state: present
|
|
register: _mongodb_install_package
|
|
|
|
- name: MongoDB service in enabled and started
|
|
ansible.builtin.systemd:
|
|
name: mongod
|
|
enabled: yes
|
|
state: started
|
|
when: _mongodb_install_package is changed
|
|
|
|
- name: install dependency for monitoring
|
|
ansible.builtin.apt:
|
|
name: python3-pymongo
|
|
state: present
|
|
|
|
- name: Custom configuration
|
|
ansible.builtin.template:
|
|
src: mongodb_bullseye.conf.j2
|
|
dest: "/etc/mongod.conf"
|
|
force: "{{ mongodb_force_config | bool | ternary('yes', 'no') }}"
|
|
notify: restart mongod
|
|
|
|
- name: Configure logrotate
|
|
ansible.builtin.template:
|
|
src: logrotate_bullseye.j2
|
|
dest: /etc/logrotate.d/mongodb
|
|
force: true
|
|
backup: no
|
|
|
|
- ansible.builtin.include_role:
|
|
name: evolix/remount-usr
|
|
|
|
- name: Create plugin directory
|
|
ansible.builtin.file:
|
|
name: /usr/local/share/munin/
|
|
state: directory
|
|
mode: "0755"
|
|
|
|
- name: Create plugin directory
|
|
ansible.builtin.file:
|
|
name: /usr/local/share/munin/plugins/
|
|
state: directory
|
|
mode: "0755"
|
|
|
|
- name: Munin plugins are present
|
|
ansible.builtin.copy:
|
|
src: "munin/{{ item }}"
|
|
dest: '/usr/local/share/munin/plugins/{{ item }}'
|
|
force: true
|
|
loop:
|
|
- mongo_btree
|
|
- mongo_collections
|
|
- mongo_conn
|
|
- mongo_docs
|
|
- mongo_lock
|
|
- mongo_mem
|
|
- mongo_ops
|
|
- mongo_page_faults
|
|
notify: restart munin-node
|
|
|
|
- name: Enable core Munin plugins
|
|
ansible.builtin.file:
|
|
src: '/usr/local/share/munin/plugins/{{ item }}'
|
|
dest: /etc/munin/plugins/{{ item }}
|
|
state: link
|
|
loop:
|
|
- mongo_btree
|
|
- mongo_collections
|
|
- mongo_conn
|
|
- mongo_docs
|
|
- mongo_lock
|
|
- mongo_mem
|
|
- mongo_ops
|
|
- mongo_page_faults
|
|
notify: restart munin-node
|