Hello again!
I tried tom make a playbook to install a fusioninventroy agent and dependecies.
Copy the config from a git and reboot the service in the end, but it fails with this error:
"msg": "'/usr/bin/apt-get -y -o \\"Dpkg::Options::=--force-confdef\\" -o \\"Dpkg::Options::=--force-confold\\" install 'dmidecode=3.3-3ubuntu0.1' 'dmidecode=3.3-3ubuntu0.1' 'hwdata=0.357-1' 'hdparm=9.60+ds-1build3' 'libuniversal-require-perl=0.19-1' 'libwww-perl=6.61-1' 'libparse-edid-perl=1.0.7-1.1' 'libproc-daemon-perl=0.23-1' 'libfile-which-perl=1.23-1' 'libhttp-daemon-perl=6.13-1ubuntu0.1' 'libxml-treepp-perl=0.43-1' 'libyaml-perl=1.30-1' 'libnet-cups-perl=0.64-1build4' 'libnet-ip-perl=1.26-2' 'libdigest-sha-perl=6.02-1build4' 'libsocket-getaddrinfo-perl=0.22-3' 'libtext-template-perl=1.60-1' 'libxml-xpath-perl=1.44-1' 'libyaml-tiny-perl=1.73-1' 'fusioninventory-agent=1:2.6-2'' failed: E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 141145 (apt)\\nE: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?\\n",
"rc": 100,
"stderr": "E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 141145 (apt)\\nE: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?\\n",
"stderr_lines": [
"E: Could not get lock /var/lib/dpkg/lock-frontend. It is held by process 141145 (apt)",
"E: Unable to acquire the dpkg frontend lock (/var/lib/dpkg/lock-frontend), is another process using it?"
Playbook:
---
- name: list of fusininventory agent + dependencies
hosts: all
become: true
vars:
packages:
- dmidecode
- dmidecode
- hwdata
- ucf
- hdparm
- perl
- libuniversal-require-perl
- libwww-perl
- libparse-edid-perl
- libproc-daemon-perl
- libfile-which-perl
- libhttp-daemon-perl
- libxml-treepp-perl
- libyaml-perl
- libnet-cups-perl
- libnet-ip-perl
- libdigest-sha-perl
- libsocket-getaddrinfo-perl
- libtext-template-perl
- libxml-xpath-perl
- libyaml-tiny-perl
- fusioninventory-agent
- git
state: latest
tasks:
- name: Install applications now
ansible.builtin.apt:
name: "{{ packages }}"
state: present
update_cache: yes
- name: Set values for config
hosts: all
gather_facts: false
vars:
fusioninventory__agent_conf_src: "gsg-git/awx_pub/linux_playbooks/fusion_inventory/agent.cfg"
configpath: '/etc/fusioninventory/agent.cfg'
tasks:
- name: addconfig
copy:
src: "{{ fusioninventory__agent_conf_src }}"
dest: "{{ configpath }}"
owner: root
group: root
mode: '0644'
- name: fusioninv service reboot
service:
name: fusioninventory-agent
state: restarted
The installation ogf the Agent seems to be stuck so is there:
root@nagivis:~# ps aux | grep -i apt
root 141145 0.0 3.7 79012 73060 pts/0 S+ 11:12 0:00 apt install fusioninventory-agent
root 142222 0.0 0.1 4024 2132 pts/1 S+ 13:10 0:00 grep --color=auto -i apt
maybe a failsafe mode?
Thank you again for your input!