2

Ansible version: ansible 2.9.6 Remote servers: "Debian GNU/Linux 10 (buster)" Ansible module: apt

I'm running a simple playbook on 2 debian 10 nodes. I install Debian 10 with an ansible playbook on both nodes.

After that, I run the next role on a playbook:

- name: First, check if any package needs to be reconfigured
  command: >-
    dpkg --configure -a
  ignore_errors: true

- import_tasks: remove_apt_repository.yml
  tags:
    - system
    - apt
    - remove-repo
  when: remove_apt_repository_opt == 'yes'

- import_tasks: update_apt_cache.yml
  tags:
    - system
    - update-cache 
    - apt 

- import_tasks: add_apt_repository.yml
  tags:
    - system
    - apt
    - add-repo
  when: add_apt_repository_opt == 'yes'

- import_tasks: upgrade_all_packages.yml
  tags:
    - system
    - upgrade-packages 
    - apt
  when: upgrade_packages_repository_opt == 'yes'

- import_tasks: install_apt_packages.yml
  tags:
    - system
    - install-packages 
    - apt
  when: install_apt_packages_opt == 'yes' 

- import_tasks: install_pip_packages.yml
  tags:
    - system
    - install-packages
    - pip 
  when: install_pip_packages_opt == 'yes'

However, sometimes it gets stuck on the task Upgrade all packages. This is the task upgrade all packages:

- name: Upgrade all packages to the latest version
  apt:
    name: "*"
    state: latest

I check on the node, and there's a task on S state, and maybe it hangs for 20 minutes or it justs timeout. This pictures shows both nodes, on one the task is completed on the other one just hangs.

enter image description here

Here I show the playbook execution where it hangs:

enter image description here

Thanks for your help.

VictorMJ
  • 108
  • 1
  • 5
  • There's no issue with connection between ansible-manager and nodes. – VictorMJ Jun 06 '20 at 15:16
  • you could try `strace -f -p ` to see what it's waiting on – Tom Jun 09 '20 at 20:50
  • Installing packages with apt module of ansible is horrible. It takes too long and sometimes just hangsout. I did some test with 4 or 5 packages and the task was running for more than 20 min. The process was sleeping just waiting to finish. The problem was that it took too long. Any one knows why? Thanks for your help. – VictorMJ Jun 11 '20 at 06:38
  • I would try and run the command that is sleeping from the command line, and see what the output is. It's possible some package has got stuck and needs attention. so 1) copy the command line from output of `ps aux` 2) kill the sleeping process 3) run the command line explicitly, 4) update answer with output – Tom Jun 11 '20 at 08:47

1 Answers1

1
  • add some -vvv to your playbook run
  • find the command launched by ansible for this task
  • launch it manually whith some verbosity
exeral
  • 1,787
  • 11
  • 21