Skip to content

Commit f7aeb06

Browse files
Merge pull request #8 from ibm-messaging/enhancements-r2
Enhancements r2 and fixing issues.
2 parents e10fd81 + 97c2ff7 commit f7aeb06

File tree

12 files changed

+42
-77
lines changed

12 files changed

+42
-77
lines changed

README.md

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -148,18 +148,18 @@ The sample playbook [`ibmmq.yml`](ansible_collections/ibm/ibmmq/ibmmq.yml) insta
148148
- On Mac:
149149

150150
```shell
151-
export ANSIBLE_LIBRARY=${ANSIBLE_LIBRARY}:<PATH-TO>/ansible_mq/ansible_collections/ibm/ibmmq/library
151+
export ANSIBLE_LIBRARY=${ANSIBLE_LIBRARY}:<PATH-TO>/mq-ansible/ansible_collections/ibm/ibmmq/library
152152
```
153153

154154
- On Windows:
155155

156156
```shell
157-
set ANSIBLE_LIBRARY=%ANSIBLE_LIBRARY%;<PATH-TO>/ansible_mq/ansible_collections/ibm/ibmmq/library
157+
set ANSIBLE_LIBRARY=%ANSIBLE_LIBRARY%;<PATH-TO>/mq-ansible/ansible_collections/ibm/ibmmq/library
158158
```
159159

160160
2. Run the following command to execute the tasks within the playbook:
161161
```shell
162-
ansible-playbook ./ibmmq.yml -i inventory.ini
162+
ansible-playbook ./ibmmq.yml -i inventory.ini -e 'ibmMqLicence=accept'
163163
```
164164
- ##### *Note*: you can optionally add `-K` (uppercase) to the command, this will prompt the user to enter the sudo password for [YOUR_SSH_USER] on the target machine, you can omit if you have setup SSH keys
165165

@@ -201,16 +201,20 @@ These playbooks test the functionality and performance of our roles and the queu
201201

202202
To run the test playbooks first:
203203

204-
1. make sure you are in the right directory
204+
1. copy your `inventory.ini` file to the `tests/playbooks` directory
205+
```shell
206+
cp invenotry.ini tests/playbooks
207+
```
208+
2. go to the `tests/playbooks` directory
205209
```shell
206210
cd tests/playbooks
207211
```
208-
2. export the modules to your Ansible library
212+
3. export the modules to your Ansible library
209213
```shell
210214
export ANSIBLE_LIBRARY=${ANSIBLE_LIBRARY}:<PATH-TO>/ansible_mq/ansible_collections/ibm/ibmmq/library
211215
```
212216
- ##### *Note*: change `<PATH-TO>` to your local directory path:
213-
3. run all test playbooks with `python3 main.py`
217+
4. run all test playbooks with `python3 main.py`
214218

215219
## License
216220

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
- hosts: "{{ ansible_play_batch }}"
22
serial: 1
3-
become: false
3+
become: yes
44
environment:
55
PATH: /opt/mqm/bin:{{ ansible_env.PATH }}
66

@@ -9,5 +9,7 @@
99
vars:
1010
appUid: 909
1111
appGid: 909
12+
mqmHome: /home/mqm
13+
mqmProfile: .profile
1214
- downloadmq
1315
- installmq
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
---
2+
3+
ibmMqLicence: "not accepted"

ansible_collections/ibm/ibmmq/roles/installmq/tasks/main.yml

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,8 @@
66
register: license_status
77

88
- name: Accept MQ license
9-
become: true
109
shell: |
11-
/tmp/MQServer/mqlicense.sh -accept > /tmp/MQServer/licensestatus.txt
10+
/tmp/MQServer/mqlicense.sh -{{ ibmMqLicence}} > /tmp/MQServer/licensestatus.txt
1211
changed_when: not license_status.stat.exists
1312

1413
- name: Check if MQ is installed
@@ -18,32 +17,30 @@
1817
- "'FAIL' in installed_mq_packages.stderr"
1918

2019
- name: Create list file and run apt update again to update the apt cache
21-
become: true
2220
shell: |
2321
MQ_PACKAGES_LOCATION=/tmp/MQServer
2422
echo "deb [trusted=yes] file:$MQ_PACKAGES_LOCATION /" > /etc/apt/sources.list.d/mq-install.list
2523
apt-get update
2624
changed_when: 'installed_mq_packages.stdout_lines | string is not search("ibmmq")'
2725

2826
- name: Install MQ Server
29-
become: true
3027
shell: apt-get install -y "ibmmq-*"
3128
changed_when: 'installed_mq_packages.stdout_lines | string is not search("ibmmq")'
3229

33-
- name: Set MQ environment variables through profile
34-
become: yes
35-
lineinfile:
36-
dest: /etc/profile
37-
state: present
38-
line: '. /opt/mqm/bin/setmqenv -s'
39-
4030
- name: Delete .list file and run apt update again to clear the apt cache
41-
become: true
4231
shell: |
4332
rm /etc/apt/sources.list.d/mq-install.list
4433
apt-get update
4534
changed_when: 'installed_mq_packages.stdout_lines | string is not search("ibmmq")'
4635

36+
- name: Install acl
37+
apt:
38+
state: latest
39+
update_cache: true
40+
pkg:
41+
- acl
42+
when: ansible_facts['distribution']=="Ubuntu"
43+
4744
- name: reset ssh connection
4845
meta: reset_connection
4946

ansible_collections/ibm/ibmmq/roles/setupusers/defaults/main.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@
33
appUid: 909
44
appGid: 909
55
mqmUid: 2001
6-
mqmGid: 2001
6+
mqmGid: 2001
7+
mqmHome: /home/mqm
8+
mqmProfile: .profile
9+
mqmShell: /bin/bash

ansible_collections/ibm/ibmmq/roles/setupusers/tasks/main.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,22 @@
1010
name: mqm
1111
uid: "{{ mqmUid }}"
1212
group: mqm
13+
home: "{{ mqmHome }}"
14+
shell: "{{ mqmShell }}"
15+
16+
- name: Set MQ environment variables through profile
17+
lineinfile:
18+
dest: "{{ mqmHome }}/{{mqmProfile}}"
19+
state: present
20+
line: '. /opt/mqm/bin/setmqenv -s'
1321

1422
- name: Create an admin user
1523
user:
1624
name: mqadm
1725
groups: mqm
1826
append: yes
27+
home: "{{ mqmHome }}"
28+
shell: "{{ mqmShell }}"
1929

2030
- name: Add 'mqclient' group
2131
become: true

ansible_collections/ibm/ibmmq/tests/playbooks/ibmmq_travis.yml

Lines changed: 0 additions & 39 deletions
This file was deleted.

ansible_collections/ibm/ibmmq/tests/playbooks/inventory_root.ini

Lines changed: 0 additions & 8 deletions
This file was deleted.

ansible_collections/ibm/ibmmq/tests/playbooks/inventory_tester.ini

Lines changed: 0 additions & 8 deletions
This file was deleted.

ansible_collections/ibm/ibmmq/tests/playbooks/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
import subprocess
66
subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'test_install.yml'])
7+
subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'setup_test.yml'])
78
subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'test_absent_qmgr.yml'])
89
subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'test_present_qmgr.yml'])
910
subprocess.run(['ansible-playbook', '--inventory', 'inventory.ini', 'test_running_qmgr.yml'])

ansible_collections/ibm/ibmmq/tests/playbooks/test_install.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- name: test downloading and installing MQ
2-
hosts: docker
2+
hosts: all
33
become: true
44
environment:
55
PATH: /opt/mqm/bin:{{ ansible_env.PATH }}

ansible_collections/ibm/ibmmq/tests/playbooks/test_web_console.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
- name: test downloading and installing MQ
2-
hosts: docker
2+
hosts: all
33
become: false
44
environment:
55
PATH: /opt/mqm/bin:{{ ansible_env.PATH }}

0 commit comments

Comments
 (0)