-
Notifications
You must be signed in to change notification settings - Fork 2
Update monogo 7.0.21 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
718f6ce
3cfe215
b11f67d
e1084cb
8600d2e
5ed5b07
bfc7d27
2f4d520
d5b2424
4d5182d
ac22954
9aac931
73efe32
4079807
adba942
a0127da
3db59fe
07f6193
5995d5d
7b270cf
5f51afd
35f79b8
09346fa
dfa5394
a8b7980
055c594
6c735a8
c8ace8f
93359ef
45fa7eb
a1cc74c
4af3395
911a51b
8c4a4ea
bff18b7
c2f5116
64f93ea
db4c565
1652845
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,78 +1,113 @@ | ||
| --- | ||
|
|
||
| - name: Use different mongod.conf for auth initialization | ||
| - name: Use mongod.conf for auth initialization | ||
| template: | ||
| src: mongo_init_conf.j2 | ||
| dest: /etc/mongod.conf | ||
| owner: root | ||
| group: root | ||
| mode: 0644 | ||
| mode: '0644' | ||
| notify: | ||
| - mongodb_restart | ||
| - wait_till_mongodb_started_on_localhost | ||
| # - wait_till_mongodb_started_on_localhost | ||
|
|
||
| - name: Flush all handlers at this point | ||
| - name: Flush handlers after initial config | ||
| meta: flush_handlers | ||
|
|
||
| - name: Check if MongoDB is already listening on {{ mongo_port }} | ||
| shell: ss -ltnp | grep {{ mongo_port }} | ||
| register: mongo_port_check | ||
| changed_when: false | ||
| ignore_errors: true | ||
|
|
||
| - name: Wait for MongoDB to be ready on this host | ||
| wait_for: | ||
| host: "{{ ansible_default_ipv4.address }}" | ||
| port: "{{ mongo_port }}" | ||
| delay: 5 | ||
| timeout: 180 | ||
| when: mongo_port_check.rc != 0 | ||
|
|
||
| - name: Debug root user credentials | ||
| debug: | ||
| msg: "Creating root user: {{ mongo_root_admin_name }}" | ||
|
|
||
| # Create root admin user | ||
| - name: Create root admin user | ||
| mongodb_user: | ||
| login_host: localhost | ||
| database: admin | ||
| name: "{{ mongo_root_admin_name }}" | ||
| password: "{{ mongo_root_admin_pwd }}" | ||
| update_password: on_create | ||
| roles: root | ||
| roles: ["root"] | ||
| state: present | ||
| update_password: on_create | ||
| when: inventory_hostname in groups['mongo_master'] | ||
| run_once: true | ||
| no_log: true | ||
| no_log: false | ||
|
|
||
| - name: Create admin user | ||
| # Create admin user | ||
| - name: Create userAdminAnyDatabase user | ||
| mongodb_user: | ||
| login_host: localhost | ||
| database: admin | ||
| name: "{{ mongo_user_admin_name }}" | ||
| password: "{{ mongo_user_admin_pwd }}" | ||
| update_password: on_create | ||
| roles: userAdminAnyDatabase | ||
| roles: ["userAdminAnyDatabase"] | ||
| state: present | ||
| update_password: on_create | ||
| login_user: "{{ mongo_root_admin_name }}" | ||
| login_password: "{{ mongo_root_admin_pwd }}" | ||
| auth_source: admin | ||
| when: inventory_hostname in groups['mongo_master'] | ||
| run_once: true | ||
| no_log: true | ||
| no_log: false | ||
|
|
||
| # Create backup user | ||
| - name: Create backup root user | ||
| mongodb_user: | ||
| login_host: localhost | ||
| database: admin | ||
| name: "{{ mongo_root_backup_name }}" | ||
| password: "{{ mongo_root_backup_pwd }}" | ||
| update_password: on_create | ||
| roles: backup,clusterMonitor | ||
| roles: ["backup", "clusterMonitor"] | ||
| state: present | ||
| update_password: on_create | ||
| login_user: "{{ mongo_root_admin_name }}" | ||
| login_password: "{{ mongo_root_admin_pwd }}" | ||
| auth_source: admin | ||
| when: inventory_hostname in groups['mongo_master'] | ||
| run_once: true | ||
| no_log: true | ||
| no_log: false | ||
|
|
||
| - name: Create user defined users | ||
| # Create custom users | ||
| - name: Create user-defined MongoDB users | ||
| mongodb_user: | ||
| login_host: localhost | ||
| database: admin | ||
| name: "{{ item.name }}" | ||
| password: "{{ item.password }}" | ||
| update_password: on_create | ||
| roles: "{{ item.roles }}" | ||
| with_items: | ||
| - "{{ mongo_custom_users }}" | ||
| state: present | ||
| update_password: on_create | ||
| login_user: "{{ mongo_root_admin_name }}" | ||
| login_password: "{{ mongo_root_admin_pwd }}" | ||
| auth_source: admin | ||
| loop: "{{ mongo_custom_users }}" | ||
| when: inventory_hostname in groups['mongo_master'] and mongo_custom_users | length > 0 | ||
| run_once: true | ||
| no_log: true | ||
| when: inventory_hostname in groups['mongo_master'] and mongo_custom_users != "None" | ||
| no_log: false | ||
|
|
||
| # Restore actual mongod.conf after user setup | ||
| - name: Move back mongod.conf | ||
| template: | ||
| src: mongo_conf.j2 | ||
| dest: /etc/mongod.conf | ||
| owner: root | ||
| group: root | ||
| mode: 0644 | ||
| mode: '0644' | ||
| notify: | ||
| - mongodb_restart | ||
| - "{{ 'wait_till_mongodb_started' if replication_enabled == 'true' else 'wait_till_mongodb_started_on_localhost' }}" | ||
| # - wait_till_mongodb_started | ||
|
|
||
| - name: Flush all handlers at this point | ||
| meta: flush_handlers |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,22 +1,6 @@ | ||
| # mongod.conf | ||
|
|
||
| # for documentation of all options, see: | ||
| # http://docs.mongodb.org/manual/reference/configuration-options/ | ||
|
|
||
| # where to write logging data. | ||
| systemLog: | ||
| destination: file | ||
| logAppend: true | ||
| path: {{ mongo_systemlog_path }} | ||
|
|
||
| # Where and how to store data. | ||
| storage: | ||
| dbPath: {{ mongo_db_path }} | ||
| {% if mongo_major_version is version('7.0', '<') %} | ||
| journal: | ||
| enabled: true | ||
|
|
||
| # network interfaces | ||
| net: | ||
| port: {{ mongo_port }} | ||
| bindIp: localhost | ||
|
|
||
| {% endif %} |
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prefer downloading key directly.
use secret for password
perform ansible lint