From cd0c7245f717379a98ae9988acd0a6d540f29021 Mon Sep 17 00:00:00 2001 From: ionutboangiu Date: Mon, 11 Aug 2025 20:13:38 +0300 Subject: [PATCH] ansible: add TP directory permissions setup --- data/ansible/cgrates_deb_install/inventory.ini | 3 +++ data/ansible/cgrates_deb_install/main.yaml | 18 +++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/data/ansible/cgrates_deb_install/inventory.ini b/data/ansible/cgrates_deb_install/inventory.ini index e518f0a1e..30aab4f71 100644 --- a/data/ansible/cgrates_deb_install/inventory.ini +++ b/data/ansible/cgrates_deb_install/inventory.ini @@ -12,6 +12,9 @@ vault_github_repo_name=your_private_config_repo_name # Configuration source path in repository vault_cgrates_config_source_path=node_test/etc/cgrates +# TP directory path where CGRates creates lock files when loading TP data (optional) +vault_cgrates_tp_path=node_test/tp + # SSH key configuration (optional) # github_ssh_use_deploy_keys=false # github_ssh_deploy_key_read_only=false diff --git a/data/ansible/cgrates_deb_install/main.yaml b/data/ansible/cgrates_deb_install/main.yaml index 6eccb99e6..74157b9de 100644 --- a/data/ansible/cgrates_deb_install/main.yaml +++ b/data/ansible/cgrates_deb_install/main.yaml @@ -24,7 +24,7 @@ github_ssh_token: "{{ vault_github_token }}" github_ssh_repo_owner: "{{ vault_github_repo_owner }}" github_ssh_repo_name: "{{ vault_github_repo_name }}" - when: + when: - vault_github_token is defined - vault_github_repo_owner is defined - vault_github_repo_name is defined @@ -84,6 +84,22 @@ msg: "Source path '{{ cgrates_config_source_path }}' not found in repository, skipping configuration" when: not config_source_stat.stat.exists + - name: Setup TP directory permissions needed for cgrates to create lock files when loading TP data + block: + - name: Add cgrates user to ansible user's group for shared access + ansible.builtin.user: + name: cgrates + groups: "{{ ansible_user }}" + append: true + + - name: Set group write permission on TP directory for cgrates lock file creation + ansible.builtin.file: + path: "{{ cgrates_repo_dir }}/{{ vault_cgrates_tp_path }}" + mode: '0775' + when: + - config_source_stat.stat.exists + - vault_cgrates_tp_path is defined + handlers: - name: restart cgrates ansible.builtin.systemd: