Skip to content
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

Linux Setup Console File Permissions #119

Open
Syko80 opened this issue Jan 8, 2025 · 1 comment
Open

Linux Setup Console File Permissions #119

Syko80 opened this issue Jan 8, 2025 · 1 comment
Labels
bug Something isn't working

Comments

@Syko80
Copy link

Syko80 commented Jan 8, 2025

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
@Syko80 Syko80 added the bug Something isn't working label Jan 8, 2025
@stewmcl
Copy link
Contributor

stewmcl commented Jan 22, 2025

Hi, we'll take a look at the issue however if you do have a solution you would like to contribute, we have a
contributors guide that you can use to provide improvements or bug fixes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants