library/roles/mongodb-org-3.2: Change the playbook so that it's possibile to install the client package only.
This commit is contained in:
parent
3d90cbede5
commit
63a49cc27d
|
@ -1,10 +1,21 @@
|
||||||
---
|
---
|
||||||
mongodb_install_from_external_repo: True
|
mongodb_install_from_external_repo: True
|
||||||
mongodb_install_packages: True
|
mongodb_install_packages: True
|
||||||
|
mongodb_install_server: True
|
||||||
mongodb_install_conf: True
|
mongodb_install_conf: True
|
||||||
mongodb_upgrade_from_older_version: False
|
mongodb_upgrade_from_older_version: False
|
||||||
# Set to 'latest' if you want to get the latest available package
|
# Set to 'latest' if you want to get the latest available package
|
||||||
mongodb_pkg_state: present
|
mongodb_pkg_state: present
|
||||||
|
mongodb_server_pkgs:
|
||||||
|
- mongodb-org
|
||||||
|
- mongodb-org-mongos
|
||||||
|
- mongodb-org-server
|
||||||
|
- mongodb-org-shell
|
||||||
|
- mongodb-org-tools
|
||||||
|
|
||||||
|
mongodb_client_pkgs:
|
||||||
|
- mongodb-org-shell
|
||||||
|
|
||||||
mongodb_start_server: 'yes'
|
mongodb_start_server: 'yes'
|
||||||
mongodb_tcp_port: 27017
|
mongodb_tcp_port: 27017
|
||||||
mongo_bind_ip: 0.0.0.0
|
mongo_bind_ip: 0.0.0.0
|
||||||
|
|
|
@ -1,94 +1,89 @@
|
||||||
---
|
---
|
||||||
- name: Check if Service mongod Exists
|
- block:
|
||||||
stat: path=/etc/init/mongod
|
- name: Check if Service mongod Exists
|
||||||
register: service_mongod_status
|
stat: path=/etc/init/mongod
|
||||||
|
register: service_mongod_status
|
||||||
|
tags: mongodb
|
||||||
|
|
||||||
|
- name: Ensure mongod is stopped and disabled
|
||||||
|
service: name=mongod state=stopped enabled=no
|
||||||
|
when:
|
||||||
|
- service_mongod_status.stat.exists
|
||||||
|
- mongodb_start_server is defined
|
||||||
|
- mongodb_start_server == 'no'
|
||||||
|
- mongodb_install_conf
|
||||||
|
|
||||||
|
when: mongodb_install_server
|
||||||
tags: mongodb
|
tags: mongodb
|
||||||
|
|
||||||
- name: Ensure mongod is stopped and disabled
|
- block:
|
||||||
service: name=mongod state=stopped enabled=no
|
- name: Install the mongodb apt key
|
||||||
when:
|
#apt_key: id=7F0CEB10 state=present
|
||||||
- service_mongod_status.stat.exists
|
raw: apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
|
||||||
- mongodb_start_server is defined
|
when: mongodb_install_from_external_repo
|
||||||
- mongodb_start_server == 'no'
|
|
||||||
- mongodb_install_conf
|
- name: Remove the old mongo apt repositories
|
||||||
tags: mongodb
|
apt_repository: repo="{{ item }}" state=absent
|
||||||
|
with_items:
|
||||||
|
- "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.0 multiverse"
|
||||||
|
- "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen"
|
||||||
|
when: mongodb_upgrade_from_older_version
|
||||||
|
|
||||||
|
- name: Install the mongodb repository
|
||||||
|
apt_repository: repo="deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.2 multiverse" update_cache=yes state=present
|
||||||
|
|
||||||
- name: Install the mongodb apt key
|
|
||||||
#apt_key: id=7F0CEB10 state=present
|
|
||||||
raw: apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927
|
|
||||||
when: mongodb_install_from_external_repo
|
when: mongodb_install_from_external_repo
|
||||||
|
tags: [ 'mongodb', 'mongodb_client', 'mongodb_repo' ]
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: Install the mongodb 3.2 configuration
|
||||||
|
template: src=mongod-3.2.conf.j2 dest=/etc/mongod.conf owner=root group=root mode=0444
|
||||||
|
when: mongodb_install_conf
|
||||||
|
notify: Restart mongodb
|
||||||
|
|
||||||
|
- name: We are upgrading, install the latest version of the mongodb packages
|
||||||
|
apt: pkg={{ item }} state=latest
|
||||||
|
with_items: '{{ mongodb_server_pkgs }}'
|
||||||
|
when:
|
||||||
|
- mongodb_install_from_external_repo
|
||||||
|
- mongodb_install_packages
|
||||||
|
- mongodb_upgrade_from_older_version
|
||||||
|
|
||||||
|
- name: Install the mongodb packages
|
||||||
|
apt: pkg={{ item }} state={{ mongodb_pkg_state }}
|
||||||
|
with_items: '{{ mongodb_server_pkgs }}'
|
||||||
|
when:
|
||||||
|
- mongodb_install_from_external_repo
|
||||||
|
- mongodb_install_packages
|
||||||
|
|
||||||
|
- name: Create the mongodb log directory
|
||||||
|
file: dest={{ mongodb_logdir }} state=directory owner={{ mongodb_user }} group={{ mongodb_group }} mode=0755
|
||||||
|
when: mongodb_install_conf
|
||||||
|
|
||||||
|
- name: Create the mongodb db directory
|
||||||
|
file: dest={{ mongodb_dbpath }} state=directory owner={{ mongodb_user }} group={{ mongodb_group }} mode=0755
|
||||||
|
when: mongodb_install_conf
|
||||||
|
|
||||||
|
- name: Install the mongodb defaults file
|
||||||
|
template: src=mongod-default.j2 dest=/etc/default/mongod owner=root group=root mode=0444
|
||||||
|
when: mongodb_install_conf
|
||||||
|
notify: Restart mongodb
|
||||||
|
|
||||||
|
- name: Install the cron job that manages log files rotation
|
||||||
|
template: src=mongo_log_rotate.sh.j2 dest=/etc/cron.daily/mongo_log_rotate owner=root group=root mode=0555
|
||||||
|
when: not mongodb_systemlog_external_logrotate
|
||||||
|
|
||||||
|
- name: Ensure mongodb is started and enabled
|
||||||
|
service: name=mongod state=started enabled=yes
|
||||||
|
when: ( mongodb_start_server is defined ) and ( mongodb_start_server == 'yes' ) and ( mongodb_install_conf )
|
||||||
|
|
||||||
|
when: mongodb_install_server
|
||||||
tags: mongodb
|
tags: mongodb
|
||||||
|
|
||||||
- name: Remove the old mongo apt repositories
|
- block:
|
||||||
apt_repository: repo="{{ item }}" state=absent
|
- name: Install the mongodb client packages
|
||||||
with_items:
|
apt: pkg={{ item }} state={{ mongodb_pkg_state }}
|
||||||
- "deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.0 multiverse"
|
with_items: '{{ mongodb_client_pkgs }}'
|
||||||
- "deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen"
|
|
||||||
when:
|
|
||||||
- mongodb_upgrade_from_older_version
|
|
||||||
tags: mongodb
|
|
||||||
|
|
||||||
- name: Install the mongodb repository
|
|
||||||
apt_repository: repo="deb http://repo.mongodb.org/apt/ubuntu {{ ansible_distribution_release }}/mongodb-org/3.2 multiverse" update_cache=yes state=present
|
|
||||||
when: mongodb_install_from_external_repo
|
|
||||||
tags: mongodb
|
|
||||||
|
|
||||||
- name: Install the mongodb 3.2 configuration
|
|
||||||
template: src=mongod-3.2.conf.j2 dest=/etc/mongod.conf owner=root group=root mode=0444
|
|
||||||
when: mongodb_install_conf
|
|
||||||
notify: Restart mongodb
|
|
||||||
tags: mongodb
|
|
||||||
|
|
||||||
- name: We are upgrading, install the latest version of the mongo packages
|
|
||||||
apt: pkg={{ item }} state=latest
|
|
||||||
with_items:
|
|
||||||
- mongodb-org
|
|
||||||
- mongodb-org-mongos
|
|
||||||
- mongodb-org-server
|
|
||||||
- mongodb-org-shell
|
|
||||||
- mongodb-org-tools
|
|
||||||
when:
|
|
||||||
- mongodb_install_from_external_repo
|
|
||||||
- mongodb_install_packages
|
|
||||||
- mongodb_upgrade_from_older_version
|
|
||||||
tags: mongodb
|
|
||||||
|
|
||||||
- name: Install the mongodb mongodb packages
|
|
||||||
apt: pkg={{ item }} state={{ mongodb_pkg_state }}
|
|
||||||
with_items:
|
|
||||||
- mongodb-org
|
|
||||||
- mongodb-org-mongos
|
|
||||||
- mongodb-org-server
|
|
||||||
- mongodb-org-shell
|
|
||||||
- mongodb-org-tools
|
|
||||||
when:
|
|
||||||
- mongodb_install_from_external_repo
|
|
||||||
- mongodb_install_packages
|
|
||||||
tags: mongodb
|
|
||||||
|
|
||||||
- name: Create the mongodb log directory
|
|
||||||
file: dest={{ mongodb_logdir }} state=directory owner={{ mongodb_user }} group={{ mongodb_group }} mode=0755
|
|
||||||
when: mongodb_install_conf
|
|
||||||
tags: mongodb
|
|
||||||
|
|
||||||
- name: Create the mongodb db directory
|
|
||||||
file: dest={{ mongodb_dbpath }} state=directory owner={{ mongodb_user }} group={{ mongodb_group }} mode=0755
|
|
||||||
when: mongodb_install_conf
|
|
||||||
tags: mongodb
|
|
||||||
|
|
||||||
- name: Install the mongodb defaults file
|
|
||||||
template: src=mongod-default.j2 dest=/etc/default/mongod owner=root group=root mode=0444
|
|
||||||
when: mongodb_install_conf
|
|
||||||
notify: Restart mongodb
|
|
||||||
tags: mongodb
|
|
||||||
|
|
||||||
- name: Install the cron job that manages log files rotation
|
|
||||||
template: src=mongo_log_rotate.sh.j2 dest=/etc/cron.daily/mongo_log_rotate owner=root group=root mode=0555
|
|
||||||
when: not mongodb_systemlog_external_logrotate
|
|
||||||
tags: [ 'mongodb', 'mongo_logrotate' ]
|
|
||||||
|
|
||||||
- name: Ensure mongodb is started and enabled
|
|
||||||
service: name=mongod state=started enabled=yes
|
|
||||||
when: ( mongodb_start_server is defined ) and ( mongodb_start_server == 'yes' ) and ( mongodb_install_conf )
|
|
||||||
tags: mongodb
|
|
||||||
|
|
||||||
|
when: not mongodb_install_server
|
||||||
|
tags: [ 'mongodb', 'mongodb_client' ]
|
||||||
|
|
Loading…
Reference in New Issue