About bentech4u

Sep.21

Dec.03

Ansible: Creating multiple user, Generating Password(sha512), expiring password(force user to change)

  tasks:
  - name: multiple
    user:
      name: "{{ item.name }}"
      shell: /bin/bash
      createhome: yes
      password: "{{ item.password | password_hash('sha512') }}"
      comment: "{{ item.comment }}"
      state: present
      update_password: on_create
    register: changes
    with_items:
     - { name: testuser1, password: testuser1@123, comment: "test user1" }
     - { name: testuser2, password: testuser2@123, comment: "test user2" }

  - name: Expire password
    shell: chage -d 0 {{ item.name }}
    with_items: "{{ changes.results }}"
    when: "{{ item.changed == true }}"

 



Nov.27

Ansible: Creating user, adding to group,Generating Password(sha512), expiring password(force user to change)

As the subject says, here is the yml

tasks:
- name: Creating crm group
  group:
    name: crm
    state: present

- name: Add user testuser
  user:
    name: testuser
    comment: crm test user
    shell: /bin/bash
    home: /home/testuser
    state: present
    createhome: yes
    groups: crm
    password: "{{ 'crm@123' | password_hash('sha512') }}"
    update_password: on_create
  register: testuser

- name: Force testuser change password
  shell: chage -d 0 testuser
  when: testuser.changed

 

Sep.10

Fix rpmdb: Thread died in Berkeley DB library – Error: rpmdb open failed

If you see rpmdb errors during package management (during yum/rpm operations), like this:

error: rpmdb: BDB0113 Thread/process 24360/139705672034368 failed: BDB1507 Thread died in Berkeley DB library
error: db5 error(-30973) from dbenv->failchk: BDB0087 DB_RUNRECOVERY: Fatal error, run database recovery
error: cannot open Packages index using db5 – (-30973)
error: cannot open Packages database in /var/lib/rpm
CRITICAL:yum.main:Error: rpmdb open failed

Solution:

Please follow these steps to backup and rebuild rpmdb database:

mkdir /var/lib/rpm/backup
cp -a /var/lib/rpm/__db* /var/lib/rpm/backup/
rm -f /var/lib/rpm/__db.[0-9][0-9]*
rpm –quiet -qa
rpm –rebuilddb
yum clean all

Raspberry PI – How to install the drivers for a WiFi dongle with the RealTek ( All in one Script)

The best and easiest way to handle this problem is as following

  1. sudo wget http://www.fars-robotics.net/install-wifi -O /usr/bin/install-wifi
    • Downloads the installation file
  2. sudo chmod +x /usr/bin/install-wifi
    • makes it executable
  3. Installation process
    • sudo install-wifi -c rpi-update
      – check for driver if rpi-update is run.
    • sudo rpi-update
      – if a driver is available you can run rpi-update to update firmware.
    • sudo install-wifi -u rpi-update
      – then update the driver for the new kernel installed by rpi-update.
    • sudo reboot
      – now reboot to update the kernel with the new wifi driver.

Fix Waveshare 7″ touch screen Raspberry Pi

 

I have been working on a project which requires a 7 inch LCD screen, I brought this display from Amazon. It was working fine with windows.

But when i connect to raspberry pi, i am not getting display and some gray/colored lines moving from random side. Even though connected to HDMI, with some settings in config.txt which is suggested by the company Waveshare

And here is the final configuration that worked for me.

# set current over USB to 1.2A
max_usb_current=1

# overscan to adjust image position
overscan_left=0
overscan_right=0
overscan_top=0
overscan_bottom=0

# HDMI config
hdmi_drive=1
hdmi_ignore_edid=0xa5000080
hdmi_group=2
hdmi_mode=87

# 1024×600 display
hdmi_cvt=1024 600 60 3 0 0 0

 

Nov.21

[Satellite 6] Candlepin and pulp are not starting

Issue

  • Satellite is not starting – candlepin and pulp end in FAIL status
candlepin   FAIL    404 Resource Not Found
candlepin_auth  FAIL    Katello::Resources::Candlepin::CandlepinPing: 404 Resource Not Found (GET /candlepin/status)
foreman_tasks   OK  
pulp    FAIL    500 Internal Server Error
pulp_auth   FAIL    Skipped pulp_auth check after failed pulp check

Resolution

  • Re-run the update based on the documentation with the “–scenario satellite”
# katello-service stop
# satellite-installer --scenario satellite --upgrade

Root Cause

  • Satellite server was updated to latest version with wrong option. Instead of –scenario satellite, –scenario capsule was used.
  • Satellite was updated using yum update, but upgrade script with option –scenario satellite –upgrade was not executed after running yum.