SSH login 'background check' interfering with Ansible fwconsole updates

Hi all,

I’m running into an issue trying to manage updates to my FreePBX systems with Ansible, including not only system updates via yum but also FreePBX updates using fwconsole.

I found this post which is the exact problem I am running into. Fwconsole ma upgradeall - the command is already running?

According to @lgaetz, the issue is occurring because of a “background check that determines if there are any pending system or PBX updates.” However sometimes I get this result as part of the second part of my playbook, described below.

Unfortunately this is exactly what I am trying to accomplish – updating FreePBX. And because of the way Ansible works, I get this ‘The command is already running in another process.’ error unless I spam my playbook a few times after the initial playbook is run. The playbook currently runs the command “fwconsole ma showupgrades”, checks the output to see if there are updates, and if there are, it runs ‘fwconsole ma upgradeall’, followed by ‘fwconsole r’.

Is there a way I can disable the background check from running? Or possibly can you provide more specific information about how this background check works so I can accommodate it better?

Thanks in advance - love the work you all do.

Maybe check that fwconsole (nor yum) is not running any process, pseudo code

while
pidof fwconsole || pidof yum
sleep 20
.
.
.

I would defer until . . because they are probably more adept than you with their distro.

Just to update on this - I was able to work around the issue I was having.

The command that runs on login is:

 bash -c /usr/sbin/fwconsole ma listonline > /var/cache/listonline.new 2>&1; ??rm -f /var/cache/listonline; ??mv /var/cache/listonline.new /var/cache/listonline; ??chmod  644 /var/cache/listonline; ??if [  ]; then yum makecache > /dev/null 2>/dev/null; fi; ??yum -q check-update | awk 'NF' > /var/cache/check-update.new; ??rm -f /var/cache/check-update; ??mv /var/cache/check-update.new /var/cache/check-update; ??chmod  644 /var/cache/check-update

I found that this runs fairly quickly and while my first instinct was to kill the process, after seeing how it ran and finished fairly quickly, I decided instead to add a short 10-second sleep command to my Ansible playbook before running fwconsole. Note that I am testing on a system where updates are already applied, so that may have something to do with the time it takes for the command above to run. In that case, a sleep command longer than 10s may be necessary.

So instead of:

  tasks:
  - name: check packages for updates
    shell: fwconsole ma showupgrades
    changed_when: "'Upgradable' in check.stdout"
    args:
      warn: false
    register: check

I updated my playbook to:

  tasks:
  - name: check packages for updates
    shell: |
      sleep 10s
      fwconsole ma showupgrades
    changed_when: "'Upgradable' in check.stdout"
    args:
      warn: false
    register: check

This change seems to result in the playbook running successfully.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.