2017-04-19 10:58:48 +02:00
|
|
|
---
|
|
|
|
# tasks file for mongodb
|
2017-07-12 12:17:33 +02:00
|
|
|
- name: Find squid config whitelist
|
|
|
|
shell: find /etc/squid/whitelist-custom.conf /etc/squid3/whitelist-custom.conf /etc/squid/whitelist.conf /etc/squid3/whitelist.conf 2> /dev/null
|
|
|
|
failed_when: false
|
|
|
|
changed_when: false
|
2017-04-19 10:58:48 +02:00
|
|
|
check_mode: no
|
2017-07-12 12:17:33 +02:00
|
|
|
register: squid_whitelist_files
|
2017-04-19 10:58:48 +02:00
|
|
|
|
2017-07-12 12:17:33 +02:00
|
|
|
- name: set squid_service_name=squid3 for Debian < 9
|
|
|
|
set_fact:
|
|
|
|
squid_service_name: squid3
|
|
|
|
when:
|
|
|
|
- ansible_distribution == "Debian"
|
|
|
|
- ansible_distribution_major_version | version_compare('9', '<')
|
|
|
|
|
|
|
|
- name: Append packages.dotdeb.org to Squid whitelist
|
2017-04-19 10:58:48 +02:00
|
|
|
lineinfile:
|
2017-07-12 12:17:33 +02:00
|
|
|
dest: "{{ squid_whitelist_files.stdout_lines | first }}"
|
2017-04-19 10:58:48 +02:00
|
|
|
line: "{{ item }}"
|
2017-07-12 12:17:33 +02:00
|
|
|
state: present
|
2017-04-19 10:58:48 +02:00
|
|
|
with_items:
|
|
|
|
- "http://keyserver.ubuntu.com/.*"
|
|
|
|
- "hkp://keyserver.ubuntu.com/.*"
|
|
|
|
- "http://repo.mongodb.org/.*"
|
2017-07-12 12:17:33 +02:00
|
|
|
notify: "reload {{ squid_service_name | default('squid') }}"
|
|
|
|
when: squid_whitelist_files.stdout != ""
|
2017-04-19 10:58:48 +02:00
|
|
|
|
|
|
|
- meta: flush_handlers
|
|
|
|
|
|
|
|
# Attention à bien indiquer le protocole et le port, sinon le firewall ne laisse pas passer
|
|
|
|
- name: MongoDB public GPG Key
|
|
|
|
apt_key:
|
|
|
|
keyserver: "hkp://keyserver.ubuntu.com:80"
|
|
|
|
id: "0C49F3730359A14518585931BC711F9BA15703C6"
|
|
|
|
|
|
|
|
- name: enable APT sources list
|
|
|
|
apt_repository:
|
|
|
|
repo: deb http://repo.mongodb.org/apt/debian jessie/mongodb-org/3.4 main
|
|
|
|
state: present
|
|
|
|
filename: mongodb
|
|
|
|
update_cache: yes
|
|
|
|
|
|
|
|
- name: Install packages
|
|
|
|
apt:
|
|
|
|
name: mongodb-org
|
|
|
|
state: installed
|
|
|
|
|
|
|
|
- name: Custom configuration
|
|
|
|
template:
|
|
|
|
src: mongod.conf.j2
|
|
|
|
dest: /etc/mongod.conf
|
|
|
|
force: yes
|
|
|
|
backup: no
|
|
|
|
notify: restart mongodb
|
|
|
|
|
|
|
|
- name: Configure logrotate
|
|
|
|
template:
|
|
|
|
src: logrotate.j2
|
|
|
|
dest: /etc/logrotate.d/mongodb
|
|
|
|
force: yes
|
|
|
|
backup: no
|