You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+86-49Lines changed: 86 additions & 49 deletions
Original file line number
Diff line number
Diff line change
@@ -3,7 +3,7 @@
3
3
|:memo:| Interested in contributing to this project? Please read our [IBM Contributor License Agreement](CLA.md) and our [Contributing Guide](CONTRIBUTING.md). |
4
4
|---------------|:------------------------|
5
5
6
-
A collection for automating the installation and configuration of IBM MQ using Ansible on Ubuntu machines. Our aim is to make MQ-Ansible extensible for further and more detailed IBM MQ configuration.
6
+
A collection for automating the installation and configuration of IBM MQ using Ansible on Ubuntu machines. Our aim is to make MQ-Ansible extensible for other platforms and more detailed IBM MQ configuration.
7
7
8
8
This directory contains:
9
9
- ansible [`roles`](https://github.com/ibm-messaging/mq-ansible/tree/main/ansible_collections/ibm/ibmmq/roles) for the installation and configuration of IBM MQ.
@@ -14,46 +14,81 @@ For a detailed explanation and documentation on how MQ-Ansible works, click [her
14
14
15
15
## Requirements
16
16
17
-
-`ansible` and `ansible-lint` are required on your local machine to run playbooks implementing this collection.
17
+
-`ansible`, `passlib` and `ansible-lint` are required on your local machine to run playbooks implementing this collection.
The roles in this collection carry out an installation of IBM MQ Advanced on an Ubuntu target machine with ansible roles as yaml files. The roles have been implemented to set up the required users on the machine, download the software, install and configure IBM MQ, copy over a configurable `dev-config.mqsc` file ready to be run on the target machine, and set and start the web console. Developers can change this file to allow better configuration of their queue managers.
22
+
## Playbooks and Roles for IBM MQ installation
23
23
24
+
The playbooks and roles in this collection carryout an installation of IBM MQ Advanced on an Ubuntu target machine. The roles have been implemented to set up the required users on the machine, download the software, install and configure IBM MQ, copy over a configurable `dev-config.mqsc` file ready to be run on the target machine, and setup and start the web console. Developers can change this file to customise the configuration of their queue managers. Here we use a playbook that calls other playbooks but you can run the roles in playbooks to suit your requirements.
24
25
25
-
### Example
26
+
### Example Playbooks
27
+
28
+
ibmmq.yml - this playbook calls the mq-install and mq-setup playbooks, host names are passed into the imported playbook variable as {{ ansible_play_batch }}
29
+
30
+
```yaml
31
+
- name: Install and setup IBM MQ
32
+
hosts: ['servers']
33
+
34
+
- name: Run the install playbook
35
+
import_playbook: mq-install.yml
36
+
37
+
- name: Run the setup playbook
38
+
import_playbook: mq-setup.yml
39
+
```
40
+
41
+
mq-install.yml - this playbook installs IBM MQ with the SSH user specified in the inventory
26
42
27
43
```yaml
28
-
- hosts: [YOUR_TARGET_MACHINES]
44
+
- hosts: "{{ ansible_play_batch }}"
45
+
serial: 1
29
46
become: false
30
47
environment:
31
48
PATH: /opt/mqm/bin:{{ ansible_env.PATH }}
32
49
33
-
roles:
50
+
roles:
34
51
- role: setupusers
35
52
vars:
36
-
gid: 989
53
+
gid: 909
37
54
- downloadmq
38
55
- installmq
56
+
```
57
+
mq-setup.yml - this playbook sets up IBM MQ using the 'mqm' user
58
+
59
+
```yaml
60
+
- hosts: "{{ ansible_play_hosts }}"
61
+
serial: 1
62
+
become: yes
63
+
become_user: mqm
64
+
environment:
65
+
PATH: /opt/mqm/bin:{{ ansible_env.PATH }}
66
+
67
+
roles:
39
68
- getconfig
40
69
- setupconsole
41
70
- startconsole
42
-
```
43
71
72
+
tasks:
73
+
74
+
- name: Create a queue manager
75
+
queue_manager:
76
+
qmname:
77
+
- 'QM1'
78
+
- 'QM2'
79
+
state: 'present'
80
+
```
44
81
## Modules for IBM MQ resources' configuration
45
82
46
83
- `queue_manager.py`- Creates, starts, deletes an IBM MQ queue manager and runs an MQSC file. See the documentation [here.](QUEUE_MANAGER.md)
47
84
48
85
# Run our sample playbook
49
86
50
-
### Setup (inventory.ini)
87
+
##### *Note*: *Ansible* must be installed on the local machine ([Installation guide](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html))
51
88
52
-
##### Note: *Ansible* must be installed on the local machine. ([Installation guide](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html))
89
+
Before running the playbook and implementing our modules and roles for IBM MQ:
53
90
54
-
Before running the playbook implementing our modules and roles for IBM MQ:
55
-
56
-
1. Check if you have an *ssh* key pair in order to access the target machines via Ansible. Go to the `~/.ssh` directory in your machine and look for the `id_rsa` and `id_rsa.pub` files.
91
+
1. Check if you have an *ssh* key pair in order to access the target machines via SSH. Go to the `~/.ssh` directory in your machine and look for the public and private key files e.g. `id_rsa` and `id_rsa.pub`.
57
92
58
93
```shell
59
94
cd ~/.ssh
@@ -65,68 +100,70 @@ Before running the playbook implementing our modules and roles for IBM MQ:
65
100
ssh-keygen
66
101
```
67
102
68
-
3. Once the keys have been generated, these need to be copied to the target machine's user `ssh` directory.
103
+
3. Once the keys have been generated, you need to copy the public key to the target machine's user `ssh` directory.
- Change `YOUR_TARGET_MACHINES` to your machines' group name, for example `fyre`.
97
-
- Change `YOUR_MACHINE_IP` to your target machine's public IP
98
-
- Change `YOUR_USER` to your target machine's user.
99
-
##### *NOTE* : user on the target machine MUST NOT be root but MUST have `sudo` privileges.
133
+
```
134
+
##### *Note*: you can specify one or more hosts
135
+
- Change `YOUR_HOST_ALIAS` to an alias name that you wish to use e.g. `mq-host-1` , you can omit aliases if you prefer
136
+
- Change `YOUR_HOSTNAME` to your server/hostname, e.g. `myserver-1.fyre.com`
137
+
- Change `YOUR_SSH_USER` to your target machine's SSH user
138
+
##### *Note*: the user on the target machine MUST have `root` or `sudo` privileges
100
139
101
140
### ibmmq.yml
102
141
103
142
The sample playbook [`ibmmq.yml`](ansible_collections/ibm/ibmmq/ibmmq.yml) installs IBM MQ Advanced with our roles and configures a queue manager with the `queue_manager.py` module.
104
143
105
-
1. Before running the playbook, ensure that you have added the directory path to the PATH environment variable.
144
+
1. Before running the playbook, ensure that you have added the following directory path to the ANSIBLE_LIBRARY environment variable.
106
145
107
-
##### *NOTE* : change `<PATH-TO>` to your local directory path:
146
+
##### *Note*: change `<PATH-TO>` to your local directory path:
set ANSIBLE_LIBRARY=<PATH-TO>/ansible_mq/ansible_collections/ibm/ibmmq/library
119
-
```
120
-
121
-
2. Make sure you update the hosts in `ibmmq.yml` name to `YOUR_TARGET_MACHINES` group from your inventory file.
154
+
- On Windows:
155
+
156
+
```shell
157
+
set ANSIBLE_LIBRARY=%ANSIBLE_LIBRARY%;<PATH-TO>/ansible_mq/ansible_collections/ibm/ibmmq/library
158
+
```
122
159
123
-
3. Run the following command to execute the tasks within the playbook:
160
+
2. Run the following command to execute the tasks within the playbook:
124
161
```shell
125
-
ansible-playbook ./ibmmq.yml -i inventory.ini -K
162
+
ansible-playbook ./ibmmq.yml -i inventory.ini
126
163
```
127
-
- ##### *NOTE* : `-K` will prompt the user to enter the sudo password for [YOUR_USER] on the target machine.
164
+
- ##### *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
128
165
129
-
4. The playbook should return the result of `dspmq` with the queue manager created listed. Log into your target machine and check it manually:
166
+
3. The playbook should return the result of `dspmq` with the queue manager created listed. Log into your target machine and check it manually:
130
167
131
168
```shell
132
169
dspmq
@@ -139,9 +176,9 @@ If one of the following errors appears during the run of the playbook, run the f
139
176
- `Please add this host's fingerprint to your known_hosts file to manage this host.`- Indicates that an SSH password cannot be used instead of a key.
140
177
141
178
Fix:
142
-
##### *NOTE* : change `[YOUR_MACHINE_IP]` to the target machine's public IP address
179
+
##### *Note*: change `[YOUR_HOST]` to the target machine's network address
0 commit comments