Execution
Date 25 Mar 2024 12:57:38 +0000
Duration 00:00:02.41
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.4
ara 1.7.1 / 1.7.2.dev2
Python 3.10.10
Summary
1 Hosts
3 Tasks
3 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/RM9498.yaml

---
- name: Playbook to remove the line from file if matched regexp
  hosts: all
  vars:
    folder: /home/ssh-gateway/ansible/playbook_output
    ara_playbook_name: RM9498
    ara_playbook_labels:
      - RM9498
      - agent360
  tasks:
    - name: Check file existence
      ansible.builtin.stat:
        path: "/etc/agent360-custom.ini"
      register: cust
    - name: Remove line in file if exists
      when: cust.stat.exists
      ansible.builtin.lineinfile:
        path: "/etc/agent360-custom.ini"
        backup: true
        state: absent
        regexp: '^interval\s*=\s*100$'
      register: line_removed
    - name: Restart if the line was removed
      ansible.builtin.service:
        name: agent360
        state: restarted
      when: line_removed.changed