Execution
Date 26 Jan 2026 08:53:43 +0000
Duration 00:00:20.55
Controller ssh-gw-4.layershift.com
User root
Versions
Ansible 2.16.11
ara 1.7.4 / 1.7.4
Python 3.10.10
Summary
26 Hosts
5 Tasks
116 Results
1 Plays
1 Files
0 Records

File: /home/ssh-gateway/ansible/kuly/RM10278-goss.yaml

---
- name: 10278 redmine tasks - Validate files with Goss
  hosts: all
  gather_facts: false
  vars:
    need_exists:
      - /usr/local/cron_backup/flock_pva_backups.sh
      - /usr/local/cron_backup/verify.sh
    obsoleted:
      - /usr/local/cron_backup/conf/flock.conf
      - /usr/local/cron_backup/conf/verify.conf

    goss_spec_path: /tmp/goss-files-validation.yaml
    goss_binary: /usr/local/bin/goss  # adjust if installed elsewhere

  tasks:
    - name: Ensure Goss is available (optional safety check)
      ansible.builtin.command: "{{ goss_binary }} --version"
      register: goss_check
      changed_when: false
      failed_when: false

    - name: Fail if Goss is not installed
      ansible.builtin.fail:
        msg: "Goss binary not found at {{ goss_binary }}"
      when: goss_check.rc != 0

    - name: Build Goss spec content for file checks
      ansible.builtin.set_fact:
        goss_content: |
          {% for path in need_exists %}
          file: {{ path | quote }}
            exists: true
          {% endfor %}
          {% for path in obsoleted %}
          file: {{ path | quote }}
            exists: false
          {% endfor %}

    - name: Write Goss spec to remote host
      ansible.builtin.copy:
        content: "{{ goss_content }}"
        dest: "{{ goss_spec_path }}"
        mode: '0644'

    - name: Run Goss validation
      ansible.builtin.command: "{{ goss_binary }} -g {{ goss_spec_path }} validate --format documentation"
      register: goss_result
      changed_when: false
      failed_when: goss_result.rc != 0

    - name: Show Goss output (optional, for visibility)
      ansible.builtin.debug:
        msg: "{{ goss_result.stdout_lines }}"
      when: goss_result.stdout_lines is defined