Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
217 commits
Select commit Hold shift + click to select a range
8703edd
Adding docker role for Debian and RedHat
keithquinnpercona Aug 27, 2025
119dc16
Removing uneeded runc installation and cleanup
keithquinnpercona Aug 27, 2025
1b38a98
Readding accidently deleted tasks
keithquinnpercona Aug 27, 2025
9e20695
Cleanup
keithquinnpercona Aug 27, 2025
c98afd4
Adding blank lines to the bottom of the file
keithquinnpercona Aug 27, 2025
7edf5d6
Adding blank lines to the bottom of the file
keithquinnpercona Aug 27, 2025
0ea9fe5
Merge branch 'PSMDB-1771' of github.com:Percona-QA/psmdb-testing into…
keithquinnpercona Aug 27, 2025
6149a16
Adding Easyrsa role
keithquinnpercona Aug 28, 2025
d52fdcc
Merge branch 'main' of github.com:Percona-QA/psmdb-testing into PSMDB…
keithquinnpercona Aug 28, 2025
80a6a9f
Cleanup
keithquinnpercona Aug 28, 2025
a90b853
Adding Easy-rsa ansible tasks
keithquinnpercona Aug 28, 2025
e16ebba
Cleanup
keithquinnpercona Aug 28, 2025
baa79a5
Cleanup
keithquinnpercona Aug 28, 2025
28aa855
Updating roles for psmdb tests
keithquinnpercona Aug 29, 2025
42f87e7
Removing task to move binary
keithquinnpercona Aug 29, 2025
9d4671b
Updating the docker APT repo to accomodate Ubuntu
keithquinnpercona Aug 29, 2025
636c4b8
Updating Docker to work with Ubuntu
keithquinnpercona Aug 29, 2025
3924afa
Cleanup and testing a fix for broken RHEL9
keithquinnpercona Aug 29, 2025
2916f2f
Cleanup
keithquinnpercona Aug 29, 2025
7018426
Adding initial openldap changes
keithquinnpercona Sep 2, 2025
a119632
Testing
keithquinnpercona Sep 2, 2025
1c58a37
Adding change to test openldap
keithquinnpercona Sep 2, 2025
a938b5b
Adding change to test openldap
keithquinnpercona Sep 2, 2025
d0f91af
Adding change to test openldap
keithquinnpercona Sep 2, 2025
bad4c75
Adding change to test openldap
keithquinnpercona Sep 2, 2025
eb1a788
Changing python3 dependencies to be installed by apt instead of pip
keithquinnpercona Sep 2, 2025
d35262c
Running tests
keithquinnpercona Sep 2, 2025
6d38055
Running tests
keithquinnpercona Sep 2, 2025
fdc0f6d
Fixing port
keithquinnpercona Sep 2, 2025
1e99842
Adding the rest of the openldap steps
keithquinnpercona Sep 3, 2025
204ea45
Changing port
keithquinnpercona Sep 3, 2025
b651637
Fixing port issue
keithquinnpercona Sep 4, 2025
0132b39
Cleanup
keithquinnpercona Sep 4, 2025
33e5e10
Fixing encrypted password task
keithquinnpercona Sep 4, 2025
c0d837f
Updating psmdb playbook to use new openldap role
keithquinnpercona Sep 4, 2025
11b2635
adding python installs for RedHat
keithquinnpercona Sep 4, 2025
c28ee43
Fixing package install issues on RedHat and Amazon Linux
keithquinnpercona Sep 4, 2025
379a415
Testing RedHat package install
keithquinnpercona Sep 4, 2025
0a7977c
Test
keithquinnpercona Sep 5, 2025
22572db
Testing changes
keithquinnpercona Sep 8, 2025
85f8865
Fixing task
keithquinnpercona Sep 8, 2025
7c866bf
Fixing auth issue
keithquinnpercona Sep 8, 2025
59aaa04
Fixing port
keithquinnpercona Sep 8, 2025
d041a09
Test
keithquinnpercona Sep 8, 2025
9f53c6a
TEst
keithquinnpercona Sep 8, 2025
fa60c75
TEst
keithquinnpercona Sep 8, 2025
2b54b00
Test
keithquinnpercona Sep 8, 2025
1f31676
Test
keithquinnpercona Sep 8, 2025
7712547
Test
keithquinnpercona Sep 9, 2025
e076285
Test
keithquinnpercona Sep 9, 2025
d31d8ad
Updating branch for test
keithquinnpercona Sep 9, 2025
6d0c409
Updating branch for test
keithquinnpercona Sep 9, 2025
212c95c
Removing SSH debugging
keithquinnpercona Sep 9, 2025
74d4816
Removing uneeded task files
keithquinnpercona Sep 9, 2025
8c929f1
Removing uneeded task files
keithquinnpercona Sep 9, 2025
79b4f2a
Updating file
keithquinnpercona Sep 9, 2025
eb86e6f
Cleanup
keithquinnpercona Sep 9, 2025
53db2c8
Pull from main
keithquinnpercona Sep 9, 2025
8c25139
Cleanup
keithquinnpercona Sep 9, 2025
223d52f
Cleanup
keithquinnpercona Sep 9, 2025
429a67d
Updating ldap query user
keithquinnpercona Sep 9, 2025
50b808b
Changing for test
keithquinnpercona Sep 9, 2025
b8c0b56
Changing for test
keithquinnpercona Sep 9, 2025
0cb113a
Adding task to install Readelf command on RHEL8
keithquinnpercona Sep 10, 2025
fd299a4
Merge branch 'main' of github.com:Percona-QA/psmdb-testing into PSMDB…
keithquinnpercona Sep 10, 2025
fcbebe5
Minor changes and README
keithquinnpercona Sep 10, 2025
ab2f722
Tidying up ansible role variables
keithquinnpercona Sep 10, 2025
85385e3
Deleting original ldap folder and renaming openldap-docker folder to …
keithquinnpercona Sep 10, 2025
d8ea263
Updating playbooks
keithquinnpercona Sep 10, 2025
2b9c7f0
Changing cloning task to use env var
keithquinnpercona Sep 10, 2025
8e47305
Cleanup
keithquinnpercona Sep 10, 2025
b92895d
Fixing broken variable
keithquinnpercona Sep 10, 2025
0261637
Fixing broke variable
keithquinnpercona Sep 10, 2025
99b6332
Fixing env var
keithquinnpercona Sep 11, 2025
31be51f
Merge branch 'main' of github.com:Percona-QA/psmdb-testing into PSMDB…
keithquinnpercona Sep 11, 2025
56c8236
Adding retry to Docker download task
keithquinnpercona Sep 11, 2025
1c6eae7
Updating failing task for retries
keithquinnpercona Sep 11, 2025
e0527f0
Merge branch 'main' of github.com:Percona-QA/psmdb-testing into PSMDB…
keithquinnpercona Sep 11, 2025
c73a743
Merge branch 'main' of github.com:Percona-QA/psmdb-testing into PSMDB…
keithquinnpercona Sep 11, 2025
4108c5d
Cleanup
keithquinnpercona Sep 11, 2025
40e4546
Initial commit
keithquinnpercona Sep 15, 2025
cc1a95b
Updating playbooks
keithquinnpercona Sep 15, 2025
77bedb9
Fixing task
keithquinnpercona Sep 15, 2025
43ede4a
Test
keithquinnpercona Sep 15, 2025
37eb0af
Changing how to install dependencies
keithquinnpercona Sep 15, 2025
b8679e3
Test
keithquinnpercona Sep 15, 2025
e7c70ff
Test
keithquinnpercona Sep 15, 2025
ce4b594
Test
keithquinnpercona Sep 15, 2025
9ed16ed
Test
keithquinnpercona Sep 15, 2025
555ebf2
Test
keithquinnpercona Sep 15, 2025
6f39bff
Fixing file name
keithquinnpercona Sep 15, 2025
670d962
Fixing file name
keithquinnpercona Sep 15, 2025
bfe8b82
Fixing task
keithquinnpercona Sep 15, 2025
80a1b4d
Updating test
keithquinnpercona Sep 15, 2025
03f8281
Fixing test
keithquinnpercona Sep 15, 2025
0f67a8a
Fixing test
keithquinnpercona Sep 15, 2025
d84a6c5
Fixing test
keithquinnpercona Sep 15, 2025
9c81905
Fixing cert locations
keithquinnpercona Sep 15, 2025
eeeedcd
Updating test
keithquinnpercona Sep 30, 2025
2e7a15b
Updating server name
keithquinnpercona Sep 30, 2025
df20879
Undoing change
keithquinnpercona Sep 30, 2025
7b70c7a
Updating to use docker container directly
keithquinnpercona Sep 30, 2025
621c6c0
Changing logging level of pykmip
keithquinnpercona Sep 30, 2025
ec99789
Updating server config for kmip
keithquinnpercona Sep 30, 2025
ee640b4
Testing playbook order
keithquinnpercona Sep 30, 2025
e6c9cd9
Testing change
keithquinnpercona Sep 30, 2025
6839cf1
Test
keithquinnpercona Sep 30, 2025
908415f
Test
keithquinnpercona Oct 1, 2025
70fcea0
Test
keithquinnpercona Oct 1, 2025
078a19a
Test
keithquinnpercona Oct 1, 2025
e0016b9
test
keithquinnpercona Oct 1, 2025
66dce5d
Test
keithquinnpercona Oct 1, 2025
7e5d966
Cleanup
keithquinnpercona Oct 1, 2025
e023108
Pulling from main
keithquinnpercona Oct 2, 2025
95941cf
updating /etc/hosts to try container ID
keithquinnpercona Oct 3, 2025
d47d373
updating /etc/hosts to try container ID
keithquinnpercona Oct 3, 2025
c8f0f9f
Test
keithquinnpercona Oct 6, 2025
04ae60d
Test
keithquinnpercona Oct 8, 2025
8ea3475
Updating latest kmip/vault changes
keithquinnpercona Oct 15, 2025
77413ee
Merge branch 'main' of github.com:Percona-QA/psmdb-testing into PSMDB…
keithquinnpercona Oct 15, 2025
db66e46
Updating role name and files using it
keithquinnpercona Oct 15, 2025
fc2a123
updating test with correct config
keithquinnpercona Oct 15, 2025
4c41ce8
Updating test
keithquinnpercona Oct 15, 2025
36cb365
Updating moving variable declaration to vars folder
keithquinnpercona Oct 15, 2025
e0d0ad5
Adding vault license variabel
keithquinnpercona Oct 16, 2025
8ccc030
Updating file permissions
keithquinnpercona Oct 16, 2025
b3a0c64
Updating playbooks for debugging
keithquinnpercona Oct 16, 2025
7a7061b
Fixing task without quotes
keithquinnpercona Oct 16, 2025
6dba4bd
Updating tests with new filepaths
keithquinnpercona Oct 16, 2025
1fd3388
Fixing intermittent connection issue to vault container
keithquinnpercona Oct 16, 2025
dbf5845
Adding a wait for the vault container
keithquinnpercona Oct 16, 2025
9943b41
Updating test server name
keithquinnpercona Oct 16, 2025
0d9e828
Testing test change
keithquinnpercona Oct 16, 2025
97c5d45
Testing test change
keithquinnpercona Oct 16, 2025
24653b7
Testing test change
keithquinnpercona Oct 16, 2025
f6a063a
Udpating telemetry test
keithquinnpercona Oct 16, 2025
e40bca5
Updating test server name
keithquinnpercona Oct 16, 2025
2bd4bad
Pre-creating mongod user
keithquinnpercona Oct 17, 2025
c19416d
Adding tests back in for psmdb functional
keithquinnpercona Oct 17, 2025
120bcf0
Updating Vault test
keithquinnpercona Oct 17, 2025
cd48d7a
Updating file permissions on vault token
keithquinnpercona Oct 17, 2025
0dba81f
Cleanup
keithquinnpercona Oct 17, 2025
adae318
Cleanup
keithquinnpercona Oct 17, 2025
efa3ae6
Updating install dependencies for different OS's
keithquinnpercona Oct 17, 2025
256d0ee
Updating install dependencies for different OS's
keithquinnpercona Oct 17, 2025
420b24c
Updating tasks to handle RedHat OS
keithquinnpercona Oct 17, 2025
f9bbce3
Test
keithquinnpercona Oct 17, 2025
84ab048
Testing fix
keithquinnpercona Oct 17, 2025
c3d7d54
Testing
keithquinnpercona Oct 17, 2025
d267563
Testing
keithquinnpercona Oct 17, 2025
f0eea0a
Testing
keithquinnpercona Oct 17, 2025
0f4b1d0
Testing
keithquinnpercona Oct 17, 2025
8d0ee4d
Testing
keithquinnpercona Oct 17, 2025
2c78077
Updating package installation for Redhat
keithquinnpercona Oct 20, 2025
281e3da
Merge branch 'main' of github.com:Percona-QA/psmdb-testing into PSMDB…
keithquinnpercona Oct 20, 2025
c2a0ebc
Adding initial files
keithquinnpercona Oct 20, 2025
5ca14fa
Updating scripts
keithquinnpercona Oct 21, 2025
f8c525f
Update from master
keithquinnpercona Oct 21, 2025
0dd3b21
Adding kerberos-docker role scripts
keithquinnpercona Oct 27, 2025
06cf9e1
Merge branch 'main' of github.com:Percona-QA/psmdb-testing into PSMDB…
keithquinnpercona Oct 27, 2025
da3a80a
Adding kerberos-docker role scripts
keithquinnpercona Oct 27, 2025
d002c71
Fixing script
keithquinnpercona Oct 28, 2025
39016f1
Updating for testing
keithquinnpercona Oct 28, 2025
298a6c1
testing
keithquinnpercona Oct 28, 2025
ecaae0a
testing
keithquinnpercona Oct 28, 2025
48e9729
test
keithquinnpercona Oct 28, 2025
10027e8
Upping the time limit for the kmip container
keithquinnpercona Oct 28, 2025
1ce66fa
Updating task to suit the package install vs tarball
keithquinnpercona Oct 28, 2025
a087827
Debugging
keithquinnpercona Oct 28, 2025
6003a49
Debugging
keithquinnpercona Oct 28, 2025
71029c3
Updating scripts for test
keithquinnpercona Oct 28, 2025
0873e36
Updating test
keithquinnpercona Oct 29, 2025
d5dcad7
Readding removed task
keithquinnpercona Oct 29, 2025
7d44463
Updating where KRB5_KTNAME lives
keithquinnpercona Oct 29, 2025
cbd534a
Removing psmdb breaking task
keithquinnpercona Oct 29, 2025
479f370
Debugging
keithquinnpercona Oct 29, 2025
d189546
Fixing hostname in tasks
keithquinnpercona Oct 29, 2025
3ff027f
Debugging tests
keithquinnpercona Oct 29, 2025
04ff681
Fixing vault breaking task
keithquinnpercona Oct 29, 2025
99afef7
Running all tests
keithquinnpercona Oct 29, 2025
f200c6a
Adding changes to work with redhat based
keithquinnpercona Oct 30, 2025
8299b08
Debugging
keithquinnpercona Oct 30, 2025
7ed66e7
Test debugging
keithquinnpercona Oct 30, 2025
5f48f74
Fixing hostname issue
keithquinnpercona Oct 30, 2025
c12e6c7
Adding back tests
keithquinnpercona Oct 30, 2025
d5c4ea8
Fixing task for Debian
keithquinnpercona Oct 30, 2025
c009235
Debugging tests
keithquinnpercona Oct 30, 2025
48583c1
Debugging ubuntu test failure
keithquinnpercona Oct 30, 2025
7d64569
Updating variable
keithquinnpercona Oct 31, 2025
4637ab4
Fixing hostname task
keithquinnpercona Oct 31, 2025
2e3ef3f
Fixing hostname task
keithquinnpercona Oct 31, 2025
022662d
Debugging debian 11
keithquinnpercona Oct 31, 2025
79e672b
Adding fix for debian 11 hostname
keithquinnpercona Oct 31, 2025
0cc358e
Adding fix for debian 11 hostname
keithquinnpercona Oct 31, 2025
072ea7c
Adding to krb5.conf
keithquinnpercona Oct 31, 2025
79e5cd2
Undoing changes
keithquinnpercona Oct 31, 2025
0f5f5fc
Updating task to fix Debian 11 issue
keithquinnpercona Oct 31, 2025
293906a
Testing fix
keithquinnpercona Oct 31, 2025
2193223
Testing fix
keithquinnpercona Oct 31, 2025
21a2fb6
Readding task
keithquinnpercona Nov 3, 2025
f45192e
Fixing non mongod package install issue
keithquinnpercona Nov 3, 2025
52bfee1
Fixing task
keithquinnpercona Nov 3, 2025
384cc8d
Fixing test
keithquinnpercona Nov 3, 2025
ada3158
Debugging tests
keithquinnpercona Nov 3, 2025
a1cc051
Cleanup
keithquinnpercona Nov 3, 2025
e2b1bc7
Cleanup
keithquinnpercona Nov 3, 2025
39cd413
Cleanup
keithquinnpercona Nov 3, 2025
fffc5c4
Cleanup
keithquinnpercona Nov 3, 2025
c4bf0fe
Cleanup
keithquinnpercona Nov 3, 2025
cb6e972
Cleanup
keithquinnpercona Nov 3, 2025
dd66610
Cleanup
keithquinnpercona Nov 3, 2025
e7be4e7
Cleanup
keithquinnpercona Nov 3, 2025
4b737d9
Cleanup
keithquinnpercona Nov 3, 2025
bfa994e
Cleanup
keithquinnpercona Nov 3, 2025
f306ff1
Merge branch 'main' of github.com:Percona-QA/psmdb-testing into PSMDB…
keithquinnpercona Nov 3, 2025
76c6659
Cleanup
keithquinnpercona Nov 3, 2025
48eb28c
Cleanup
keithquinnpercona Nov 3, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion jstests/test_kerberos_simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
}

//add principal
_runCmd("kadmin.local -q 'addprinc -pw exttestrw exttestrw'");
_runCmd('docker exec kerberos sh -lc "kadmin.local -q \'addprinc -pw exttestrw exttestrw@PERCONATEST.COM\'"');
_runCmd("kinit exttestrw <<<'exttestrw'");

//check connection
Expand Down
2 changes: 1 addition & 1 deletion psmdb-tarball/psmdb-tarball/playbooks/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@
- role: '../../../roles/docker'
- role: '../../../roles/openldap'
- role: '../../../roles/kmip-vault'
- role: '../../../roles/kerberos'
- role: '../../../roles/kerberos-docker'
1 change: 0 additions & 1 deletion psmdb-tarball/psmdb-tarball/playbooks/prepare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,3 @@
virtualenv: /opt/venv
virtualenv_command: /opt/python/bin/virtualenv
virtualenv_python: /opt/python/bin/python3

2 changes: 1 addition & 1 deletion psmdb/psmdb/playbooks/playbook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
- role: '../../../roles/easyrsa'
- role: '../../../roles/openldap'
- role: '../../../roles/kmip-vault'
- role: '../../../roles/kerberos'
- role: '../../../roles/kerberos-docker'
4 changes: 2 additions & 2 deletions psmdb/psmdb/tests/test_psmdb_install.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ def test_auth(host,auth):
if auth == 'GSSAPI':
with host.sudo():
hostname = host.check_output('hostname')
host.check_output('kadmin.local -q "addprinc -pw exttestrw exttestrw"')
host.check_output('docker exec kerberos sh -c "kadmin.local -q \'addprinc -pw exttestrw exttestrw\'"')
host.check_output('bash -c "kinit exttestrw <<<\'exttestrw\'"')
result = host.check_output('mongo -u [email protected] --host '+ hostname +' --authenticationMechanism=GSSAPI --authenticationDatabase \'$external\' --quiet --eval "db.runCommand({connectionStatus : 1})"')
print(result)
Expand Down Expand Up @@ -378,7 +378,7 @@ def test_encryption(host,encryption,cipher):
conf['security']['kmip']['clientCertificateFile'] = MONGO_PEM_FILE
conf['security']['kmip']['serverCAFile'] = CA_KMIP_FILE

#erase data and setup config
#erase data and setup config
apply_conf(host,conf,True)

#check startup with encryption
Expand Down
9 changes: 9 additions & 0 deletions roles/kerberos-docker/tasks/Debian.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
- name: Install dependencies (Debian)
apt:
update_cache: yes
name:
- krb5-user
- python3-docker
state: present
become: yes
when: ansible_os_family == "Debian"
37 changes: 37 additions & 0 deletions roles/kerberos-docker/tasks/RedHat.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
- name: Install pip (RedHat)
become: true
package:
name: python3-pip
state: present
when: ansible_os_family == "RedHat"

- name: Create venv (RedHat)
become: true
command: /usr/bin/python3 -m venv /opt/ansible-venv
args:
creates: /opt/ansible-venv/bin/python
when: ansible_os_family == "RedHat"

- name: Upgrade pip in venv (RedHat)
become: true
command: /opt/ansible-venv/bin/python -m pip install --upgrade pip
when: ansible_os_family == "RedHat"

- name: Install packages in venv (RedHat)
become: true
command: /opt/ansible-venv/bin/python -m pip install --upgrade --ignore-installed docker requests
when: ansible_os_family == "RedHat"

- name: Use venv interpreter (RedHat)
set_fact:
ansible_python_interpreter: /opt/ansible-venv/bin/python
when: ansible_os_family == "RedHat"

- name: Install dependencies (Redhat)
yum:
update_cache: yes
name:
- krb5-workstation
state: present
become: yes
when: ansible_os_family == "RedHat"
139 changes: 139 additions & 0 deletions roles/kerberos-docker/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
- include_tasks: "RedHat.yml"
- include_tasks: "Debian.yml"

- name: Get system hostname
ansible.builtin.shell: hostname
register: hostname_raw
changed_when: false

- name: Set hostname variable
ansible.builtin.set_fact:
hostname: "{{ hostname_raw.stdout }}"

- name: Remove pre-existing kerberos container
docker_container:
name: kerberos
state: absent
keep_volumes: false

- name: Create required folders
become: true
ansible.builtin.file:
path: "{{ item }}"
state: directory
owner: root
group: root
mode: '0750'
loop:
- /var/lib/krb5kdc
- /keytabs

- name: Copy KDC configuration file to host
template:
src: krb5.conf
dest: "/etc/krb5.conf"

- name: Start Kerberos container
community.docker.docker_container:
name: kerberos
image: "alpine"
command: >
sh -c '
apk add --no-cache bash krb5 krb5-server krb5-pkinit &&
if [ ! -f /var/lib/krb5kdc/principal ]; then
kdb5_util -P password create &&
kadmin.local -q "addprinc -pw password root/admin";
fi &&
/usr/sbin/krb5kdc -n
'
restart_policy: unless-stopped
published_ports:
- "88:88/udp"
- "88:88/tcp"
volumes:
- "/etc/krb5.conf:/etc/krb5.conf"
- "/var/lib/krb5kdc:/var/lib/krb5kdc"
- "/keytabs:/keytabs"

- name: Waiting for Kerberos container to be ready
ansible.builtin.command:
cmd: >
docker exec kerberos sh -c 'test -x /usr/sbin/kadmin.local'
register: kadmin_check
retries: 10
delay: 2
until: kadmin_check.rc == 0
changed_when: false

- name: Create MongoDB service principal for mongod
ansible.builtin.command:
cmd: >
docker exec kerberos sh -c 'kadmin.local -q "addprinc -randkey mongodb/{{ hostname }}@PERCONATEST.COM"'
register: add_service_princ
failed_when: >
add_service_princ.rc != 0 and
("already exists" not in (add_service_princ.stderr | default(''))) and
("already exists" not in (add_service_princ.stdout | default('')))

- name: Create Service Key and store it in the Keytab
ansible.builtin.command:
cmd: >
docker exec kerberos sh -c 'kadmin.local -q "ktadd -k /keytabs/mongodb.keytab mongodb/{{ hostname }}@PERCONATEST.COM"'

- name: Copy mongodb.keytab from container to host
ansible.builtin.command:
cmd: >
docker cp kerberos:/keytabs/mongodb.keytab /etc/mongodb.keytab
register: docker_cp_keytab
changed_when: docker_cp_keytab.rc == 0

- name: Give /etc/mongodb.keytab mongod permissions
ansible.builtin.file:
path: /etc/mongodb.keytab
owner: mongod
group: mongod
mode: '0600'

- name: Add KRB5_KTNAME variable for PSMDB (Debian)
lineinfile:
path: /etc/default/mongod
line: KRB5_KTNAME=/etc/mongodb.keytab
create: yes
when: ansible_os_family == "Debian"

- name: Add KRB5_KTNAME variable for PSMDB (RedHat)
lineinfile:
path: /etc/sysconfig/mongod
line: KRB5_KTNAME=/etc/mongodb.keytab
create: yes
when: ansible_os_family == "RedHat"

- name: Check if Percona directory exists
ansible.builtin.stat:
path: /percona-server-mongodb
register: percona_dir

- name: Restart mongod to pick up Kerberos keytab env
ansible.builtin.service:
name: mongod
state: restarted
enabled: yes
when: not percona_dir.stat.isdir | default(false)

- name: Adding short form of hostname to /etc/hosts (Debian 11)
become: true
ansible.builtin.replace:
path: /etc/hosts
regexp: '^\s*(127\.0\.1\.1)\s+.*$'
replace: '\1 {{ hostname }}'
unsafe_writes: true
when:
- ansible_distribution == "Debian"
- ansible_distribution_major_version | int == 11

- name: Add kerberos user to /etc/hosts
lineinfile:
state: present
dest: /etc/hosts
line: '127.0.0.1 {{ hostname }}'
unsafe_writes: yes
19 changes: 19 additions & 0 deletions roles/kerberos-docker/templates/krb5.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

[libdefaults]
default_realm = PERCONATEST.COM
forwardable = true
dns_lookup_realm = false
dns_lookup_kdc = false
ignore_acceptor_hostname = true
rdns = false
ticket_lifetime = 10m
renew_lifetime = 10m
[realms]
PERCONATEST.COM = {
kdc_ports = 88
kdc = 127.0.0.1
}
[domain_realm]
.perconatest.com = PERCONATEST.COM
perconatest.com = PERCONATEST.COM
kerberos = PERCONATEST.COM
24 changes: 13 additions & 11 deletions roles/kmip-vault/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
"max_lease_ttl": "720h",
"ui": true,
"log_level": "debug",
"log_format": "json"
"log_format": "json",
"api_addr": "https://127.0.0.1:8200"
}
VAULT_ADDR: https://127.0.0.1:8200
VAULT_CACERT: /etc/vault/ca.crt
Expand All @@ -49,16 +50,17 @@
capabilities:
- "IPC_LOCK"

- name: Wait for Vault TCP port to open
wait_for:
host: 127.0.0.1
port: 8200
delay: 1
timeout: 60

- name: Wait for 5 seconds
ansible.builtin.wait_for:
timeout: 5
- name: Poll Vault health endpoint until API is responding
ansible.builtin.uri:
url: "https://127.0.0.1:8200/v1/sys/health"
method: GET
status_code: [200, 429, 472, 473, 501]
return_content: yes
validate_certs: no
register: vault_health
retries: 10
delay: 2
until: vault_health.status in [200, 429, 472, 473, 501]

- name: Initiate Vault
community.docker.docker_container_exec:
Expand Down