Skip to content

Linux Setup Console File Permissions #119

@Syko80

Description

@Syko80

Describe the bug
Only tested on Linux The /var/mqm/web/installations/Installation1/servers/mqweb/mqwebuser.xml file is copied with the root group instead of mqm, this then means that the setmqweb command fails.

To Reproduce
Run the installation including the setupconsole role

Expected behaviour
The file should be copied or permissions set with the mqm owner and mqm group

Screenshots

Currently deploys as root group

{3160A537-352A-424B-B33A-5B4E4CF7652F}

Tell us the platform and version of the machine that ansible is being run on:
Ansible Automation Platform Controller 4.5.12

Tell us the version of ansible being used:
ansible [core 2.18.1]

Tell us the platforms and versions of the machines that the playbook is targetting (Usually supplied in an inventory file):
Linux jcs-mq-001 6.8.0-1017-azure #20-Ubuntu SMP Tue Oct 22 03:43:13 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Additional context
With permissions I could branch and code the fix....!!?

However this is the update required

roles/setupconsole/tasks/Linux_setupconsole.yml

Current

---
- name: Check if basic registry exists in the install folder
  ansible.builtin.stat:
    path: /opt/mqm/web/mq/samp/configuration/basic_registry.xml
  register: basic_registry_result

- name: Check if mqwebuser already exists in target folder
  ansible.builtin.stat:
    path: /var/mqm/web/installations/Installation1/servers/mqweb/mqwebuser.xml
  register: target_mqwebuser_result

- name: Set permissions to allow overwrite of target mqwebuser.xml if it already exists
  become: true
  ansible.builtin.file:
    path: /var/mqm/web/installations/Installation1/servers/mqweb/mqwebuser.xml
    mode: "0640"
  when: target_mqwebuser_result.stat.exists

- name: Copying basic registry
  become: true
  ansible.builtin.copy:
    src: /opt/mqm/web/mq/samp/configuration/basic_registry.xml
    dest: /var/mqm/web/installations/Installation1/servers/mqweb/mqwebuser.xml
    remote_src: true
    mode: "0644"
  when: basic_registry_result.stat.exists

- name: Ensure correct permissions for mqwebuser.xml to allow setmqweb commands
  become: true
  ansible.builtin.file:
    path: /var/mqm/web/installations/Installation1/servers/mqweb/mqwebuser.xml
    mode: "0640"

Fix

---
- name: Check if basic registry exists in the install folder
  ansible.builtin.stat:
    path: /opt/mqm/web/mq/samp/configuration/basic_registry.xml
  register: basic_registry_result

- name: Check if mqwebuser already exists in target folder
  ansible.builtin.stat:
    path: /var/mqm/web/installations/Installation1/servers/mqweb/mqwebuser.xml
  register: target_mqwebuser_result

- name: Set permissions to allow overwrite of target mqwebuser.xml if it already exists
  become: true
  ansible.builtin.file:
    path: /var/mqm/web/installations/Installation1/servers/mqweb/mqwebuser.xml
    mode: "0640"
    owner: mqm
    group: mqm
  when: target_mqwebuser_result.stat.exists

- name: Copying basic registry
  become: true
  ansible.builtin.copy:
    src: /opt/mqm/web/mq/samp/configuration/basic_registry.xml
    dest: /var/mqm/web/installations/Installation1/servers/mqweb/mqwebuser.xml
    remote_src: true
    mode: "0644"
  when: basic_registry_result.stat.exists

- name: Ensure correct permissions for mqwebuser.xml to allow setmqweb commands
  become: true
  ansible.builtin.file:
    path: /var/mqm/web/installations/Installation1/servers/mqweb/mqwebuser.xml
    mode: "0640"
    owner: mqm
    group: mqm

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions