0

I'm using Ubuntu 18 on GCP and I'm trying to install the chromium browser on my worker from my master node. The playbook that I wrote successfully installed java, and git, on my worker node but I get an error when trying to execute the installation of chrome browser. Here's the playbook

---
- hosts: Hosts
  become: yes
  become_user: root
  tasks:
  - name: install git
    package:
     name: git
     state: present
  - name: install java
    package:
     name: openjdk-8-jdk
     state: present
  - name: copy chromedriver
    copy:
     src: /root
     dest: /root
     remote_src: yes
  - name: install chromium browser

Here's the reult of running the playbook

root@mastervm-project:~# ansible-playbook project.yml

PLAY [Hosts] *******************************************************************

TASK [Gathering Facts] *********************************************************
ok: [10.128.0.11]

TASK [install git] *************************************************************
ok: [10.128.0.11]

TASK [install java] ************************************************************
ok: [10.128.0.11]

TASK [copy chromedriver] *******************************************************
changed: [10.128.0.11]

TASK [install chromium browser] ************************************************
fatal: [10.128.0.11]: FAILED! => {"cache_update_time": 1595897202, "cache_updated": false, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"      install 'chromium-browser'' failed: E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. \n", "rc": 100, "stderr": "E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. \n", "stderr_lines": ["E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. "], "stdout": "", "stdout_lines": []}

PLAY RECAP *********************************************************************
10.128.0.11                : ok=4    changed=1    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

I tried running sudo dpkg --configure -a like it says then running the playbook again, but I get thesame error.

Here's another playbook that I wrote following the format from the link that Brian shared. This one is just for installing chromium.

---
- hosts: Hosts
  tasks:
  - name: install chromium
    package:
     name: chromium-browser
     state: present
    become: yes
    become_user: root

It gives me a similar error

root@mastervm-project:~# ansible-playbook  project_chromium.yml

PLAY [Hosts] *******************************************************************

TASK [Gathering Facts] *********************************************************
ok: [10.128.0.11]

TASK [install chromium] ********************************************************
fatal: [10.128.0.11]: FAILED! => {"cache_update_time": 1595897202, "cache_updated": false, "changed": false, "msg": "'/usr/bin/apt-get -y -o \"Dpkg::Options::=--force-confdef\" -o \"Dpkg::Options::=--force-confold\"      install 'chromium-browser'' failed: E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. \n", "rc": 100, "stderr": "E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. \n", "stderr_lines": ["E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem. "], "stdout": "", "stdout_lines": []}

PLAY RECAP *********************************************************************
10.128.0.11                : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
frank din
  • 1
  • 1
  • 3
  • Should that be `name: install chromium-browser`, with a hyphen? – Brian Z Jul 28 '20 at 18:24
  • Here's what is says when I remove the hyphen ```fatal: [10.128.0.11]: FAILED! => {"changed": false, "msg": "No package matching 'chromium browser' is available"} ``` – frank din Jul 28 '20 at 18:27
  • Try following this example: https://github.com/silvavlis/ansible-chromium/blob/master/tasks/main.yml – Brian Z Jul 28 '20 at 18:27

1 Answers1

1

Q: fatal: [10.128.0.11]: FAILED! => ... "rc": 100, "stderr": "E: dpkg was interrupted, you must manually run 'sudo dpkg --configure -a' to correct the problem.

A: Fix broken packages. See E: dpkg was interrupted… run 'sudo dpkg --configure -a'. The task shall be working as expected then

- name: install chromium
  become: yes
  become_user: root
  package:
    name: chromium-browser
    state: present
Vladimir Botka
  • 283
  • 1
  • 8