ansible-roles/mongodb/tasks/main_jessie.yml
Jérémy Lecour 00fe225a3c
All checks were successful
Ansible Lint |Total|New|Outstanding|Fixed|Trend |:-:|:-:|:-:|:-:|:-: |2615|7|2608|177|:+1: Reference build: <a href="https://jenkins.evolix.org/job/gitea/job/ansible-roles/job/unstable/278//ansiblelint">Evolix » ansible-roles » unstable #278</a>
gitea/ansible-roles/pipeline/head This commit looks good
force: [yes,no] → force [true,false]
2023-06-28 13:25:30 +02:00

62 lines
1.6 KiB
YAML

---
- name: Look for legacy apt keyring
ansible.builtin.stat:
path: /etc/apt/trusted.gpg
register: _trusted_gpg_keyring
- name: MongoDB embedded GPG key is absent
ansible.builtin.apt_key:
id: "B8612B5D"
keyring: /etc/apt/trusted.gpg
state: absent
when: _trusted_gpg_keyring.stat.exists
- name: Add MongoDB GPG key
ansible.builtin.copy:
src: "server-{{ mongodb_version }}.asc"
dest: "/etc/apt/trusted.gpg.d/mongodb-server-{{ mongodb_version }}.asc"
force: true
mode: "0644"
owner: root
group: root
- name: Enable APT sources list
ansible.builtin.apt_repository:
repo: "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/{{ mongodb_version }} main"
state: present
filename: "mongodb-org-{{ mongodb_version }}"
update_cache: yes
- name: Disable APT sources list
ansible.builtin.apt_repository:
repo: "deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/{{ mongodb_version }} main"
state: absent
filename: "mongodb-org-{{ mongodb_version }}"
update_cache: yes
- name: Install packages
ansible.builtin.apt:
name: mongodb-org
allow_unauthenticated: yes
state: present
- name: install dependency for monitoring
ansible.builtin.apt:
name: python-pymongo
state: present
- name: Custom configuration
ansible.builtin.template:
src: mongod_jessie.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_jessie.j2
dest: /etc/logrotate.d/mongodb
force: true
backup: no