ansible-roles/mongodb/tasks/main_jessie.yml
Jérémy Lecour 7a0e0d81d6
All checks were successful
gitea/ansible-roles/pipeline/head This commit looks good
Proper jinja spacing
2022-12-28 09:03:37 +01:00

62 lines
1.5 KiB
YAML

---
- name: Look for legacy apt keyring
stat:
path: /etc/apt/trusted.gpg
register: _trusted_gpg_keyring
- name: MongoDB embedded GPG key is absent
apt_key:
id: "B8612B5D"
keyring: /etc/apt/trusted.gpg
state: absent
when: _trusted_gpg_keyring.stat.exists
- name: Add MongoDB GPG key
copy:
src: "server-{{ mongodb_version }}.asc"
dest: "/etc/apt/trusted.gpg.d/mongodb-server-{{ mongodb_version }}.asc"
force: yes
mode: "0644"
owner: root
group: root
- name: Enable APT sources list
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
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
apt:
name: mongodb-org
allow_unauthenticated: yes
state: present
- name: install dependency for monitoring
apt:
name: python-pymongo
state: present
- name: Custom configuration
template:
src: mongod_jessie.conf.j2
dest: "/etc/mongod.conf"
force: "{{ mongodb_force_config | bool | ternary('yes', 'no') }}"
notify: restart mongod
- name: Configure logrotate
template:
src: logrotate_jessie.j2
dest: /etc/logrotate.d/mongodb
force: yes
backup: no