From 492db4d0087709e0f58bed2e9be4138026764f63 Mon Sep 17 00:00:00 2001 From: Frank Brehm Date: Wed, 18 Dec 2024 17:35:47 +0100 Subject: [PATCH] Parametrizing puppet_agent_lockfile --- group_vars/all/main.yaml | 2 ++ playbooks/disable-ldap-server.yaml | 2 +- playbooks/enable-ldap-server-replication.yaml | 2 +- playbooks/offline-backup-ldap-server.yaml | 6 +++--- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/group_vars/all/main.yaml b/group_vars/all/main.yaml index b1f11d4..91e7bdc 100644 --- a/group_vars/all/main.yaml +++ b/group_vars/all/main.yaml @@ -6,4 +6,6 @@ # ds389_plugin_attr_uniq_config: true # ds389_plugin_account_policy_config: true +puppet_agent_lockfile: '/opt/puppetlabs/puppet/cache/state/agent_disabled.lock' + # vim: filetype=yaml diff --git a/playbooks/disable-ldap-server.yaml b/playbooks/disable-ldap-server.yaml index 459101d..7b37be8 100644 --- a/playbooks/disable-ldap-server.yaml +++ b/playbooks/disable-ldap-server.yaml @@ -121,7 +121,7 @@ ansible.builtin.shell: | puppet agent --disable "[$( date +'%Y-%m-%d' )]: Disabled by Ansible playbook 'disable-ldap-server.yaml'." args: - creates: '/opt/puppetlabs/puppet/cache/state/agent_disabled.lock' + creates: "{{ puppet_agent_lockfile }}" - name: "Disabling Puppet service on {{ ldapserver_to_disable | quote }}." ansible.builtin.service: diff --git a/playbooks/enable-ldap-server-replication.yaml b/playbooks/enable-ldap-server-replication.yaml index 108aaaf..9a21863 100644 --- a/playbooks/enable-ldap-server-replication.yaml +++ b/playbooks/enable-ldap-server-replication.yaml @@ -171,6 +171,6 @@ ansible.builtin.shell: | puppet agent --enable args: - removes: '/opt/puppetlabs/puppet/cache/state/agent_disabled.lock' + removes: "{{ puppet_agent_lockfile }}" # vim: filetype=yaml diff --git a/playbooks/offline-backup-ldap-server.yaml b/playbooks/offline-backup-ldap-server.yaml index acfc6bb..c775a8b 100644 --- a/playbooks/offline-backup-ldap-server.yaml +++ b/playbooks/offline-backup-ldap-server.yaml @@ -72,7 +72,7 @@ - name: "Get active status of Puppet lockfile." ansible.builtin.stat: - path: '/opt/puppetlabs/puppet/cache/state/agent_disabled.lock' + path: "{{ puppet_agent_lockfile }}" register: stat_puppet_lockfile - name: "File stat of Puppet Puppet lockfile." @@ -93,7 +93,7 @@ ansible.builtin.shell: | puppet agent --disable "[{{ cur_timestamp }}]: Disabled by Ansible playbook 'disable-ldap-server.yaml'." args: - creates: '/opt/puppetlabs/puppet/cache/state/agent_disabled.lock' + creates: "{{ puppet_agent_lockfile }}" - name: "Get status of Wazuh service." ansible.builtin.systemd: @@ -136,7 +136,7 @@ - name: "Enabling Puppet agent." ansible.builtin.shell: puppet agent --enable args: - removes: '/opt/puppetlabs/puppet/cache/state/agent_disabled.lock' + removes: "{{ puppet_agent_lockfile }}" when: puppet_already_locked != true -- 2.39.5