Ansible AWX 17.0.1 weird installation issues

 Jobs stuck in Pending state:

https://github.com/ansible/awx/issues/9865


Failed to download metadata for Repo 'Appstream'

# sed -i 's/mirrorlist/#mirrorlist/g' /etc/yum.repos.d/CentOS-*

# sed -i 's|#baseurl=http://mirror.centos.org|baseurl=http://vault.centos.org|g' /etc/yum.repos.d/CentOS-*

By penoi on Tuesday, September 6, 2022 | A comment?

Updating VirtualBox boxes using bash script

 Forgot where i got this script to update Virtualboxes. Worth sharing though


#!/bin/bash 

# Find all boxes which have updates

AVAILABLE_UPDATES=`vagrant box outdated --global | grep outdated | tr -d "*'" | cut -d ' ' -f 2`

if [ ! ${#AVAILABLE_UPDATES[@]} -eq 0 ]; then

  for box in $AVAILABLE_UPDATES ; do

    echo "Found an update for $box"

   # Find all current versions

    VERSIONS=`vagrant box list | grep $box | cut -d ',' -f 2 | tr -d ' )'`

    # Add latest version

    vagrant box add --clean $box

    BOX_UPDATED="TRUE"

    # Remove all old versions

    for version in $VERSIONS ; do

      vagrant box remove $box -f --box-version=$version

    done

  done

  echo "All boxes are now up to date!"

else

  echo "All boxes are already up to date!"

fi

vagrant box outdated --global



Sample run:

─cperez@mctoffer-2.local ~

╰─➤  vagrant-box-update-all.sh

Found an update for ubuntu/focal64

==> box: Loading metadata for box 'ubuntu/focal64'

    box: URL: https://vagrantcloud.com/ubuntu/focal64

==> box: Adding box 'ubuntu/focal64' (v20220208.0.0) for provider: virtualbox

    box: Downloading: https://vagrantcloud.com/ubuntu/boxes/focal64/versions/20220208.0.0/providers/virtualbox.box

Download redirected to host: cloud-images.ubuntu.com

==> box: Successfully added box 'ubuntu/focal64' (v20220208.0.0) for 'virtualbox'!


By penoi on Monday, February 14, 2022 | | A comment?

Bridged wifi Vmware fusion in MacOs Monterey

 Finally a working bridged network via wifi after MacOS Monterey 12.2.1 in VMware Fusion


By penoi on Sunday, February 13, 2022 | A comment?

Replace a file in Puppet only if the file exists


Replace file in Puppet only if the file exists. So i have this question from my colleague. It sounds simple right? but it is not.

Some says that use exec with onlyif but it produces warning/errors logs if the file doesn't exist. In which functionality, it will suffice your needs, but you will have this warning logs.

This is the workaround that i've done:


file { '/tmp/file01.txt':    source => "puppet:///modules/common/custommodule/file01.txt",    owner => 'root',    group => 'root',    mode => '0640',  }

  exec {"copy_file01":    command => "/usr/bin/diff /tmp/file01.txt /var/tmp/file01.txt; if [ $? -ne 0 ]; then /bin/cp /tmp/file01.txt /var/tmp/file01.txt; fi",     require=> File['/tmp/file01.txt'],    onlyif => "/usr/bin/test -e /var/tmp/file01.txt",
  }


two things that this will accomplish:

1. It will not replace or copy the file if the file doesn't exists. Where as if I use "file" type in puppet, it will create the file regardless if it exists or not.
2. If the file changes in puppet it will replace the existing file in the client. Test will be done by the diff command.

The only disadvantage of this, is that it will create a file under a directory. 

By penoi on Thursday, June 23, 2016 | | A comment?

My local vagrant config

Just leaving my local lab vagrant config here

# -*- mode: ruby -*-
# vi: set ft=ruby :

# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
  # The most common configuration options are documented and commented below.
  # For a complete reference, please see the online documentation at
  # https://docs.vagrantup.com.

  # Every Vagrant development environment requires a box. You can search for
  # boxes at https://atlas.hashicorp.com/search.
  config.vm.box = "centos66"

  # Disable automatic box update checking. If you disable this, then
  # boxes will only be checked for updates when the user runs
  # `vagrant box outdated`. This is not recommended.
  # config.vm.box_check_update = false

  # Create a forwarded port mapping which allows access to a specific port
  # within the machine from a port on the host machine. In the example below,
  # accessing "localhost:8080" will access port 80 on the guest machine.
  # config.vm.network "forwarded_port", guest: 80, host: 8080

  # Create a private network, which allows host-only access to the machine
  # using a specific IP.
  # config.vm.network "private_network", ip: "192.168.33.10"

  # Create a public network, which generally matched to bridged network.
  # Bridged networks make the machine appear as another physical device on
  # your network.
  # config.vm.network "public_network"
   config.vm.network :public_network, :public_network => "wlan0"

  # Share an additional folder to the guest VM. The first argument is
  # the path on the host to the actual folder. The second argument is
  # the path on the guest to mount the folder. And the optional third
  # argument is a set of non-required options.
  # config.vm.synced_folder "../data", "/vagrant_data"

  # Provider-specific configuration so you can fine-tune various
  # backing providers for Vagrant. These expose provider-specific options.
  # Example for VirtualBox:
  #
  # config.vm.provider "virtualbox" do |vb|
  #   # Display the VirtualBox GUI when booting the machine
  #   vb.gui = true
  #
  #   # Customize the amount of memory on the VM:
  #   vb.memory = "1024"
  # end
  #
  # View the documentation for the provider you are using for more
  # information on available options.

  # Define a Vagrant Push strategy for pushing to Atlas. Other push strategies
  # such as FTP and Heroku are also available. See the documentation at
  # https://docs.vagrantup.com/v2/push/atlas.html for more information.
  # config.push.define "atlas" do |push|
  #   push.app = "YOUR_ATLAS_USERNAME/YOUR_APPLICATION_NAME"
  # end

  # Enable provisioning with a shell script. Additional provisioners such as
  # Puppet, Chef, Ansible, Salt, and Docker are also available. Please see the
  # documentation for more information about their specific syntax and use.
  # config.vm.provision "shell", inline: <<-SHELL
  #   sudo apt-get update
  #   sudo apt-get install -y apache2
  # SHELL

config.vm.define "centos01" do |centos01|
centos01.vm.hostname = "centos01.lab.local"
#logstash.vm.network :private_network, ip: "192.168.56.15"
end
config.vm.define "centos02" do |centos02|
centos02.vm.hostname = "centos02.lab.local"
#logstash.vm.network :private_network, ip: "192.168.56.15"
end


By penoi on Thursday, May 26, 2016 | A comment?

Restore OSX Timemachine backup files in Linux

copy the script from

https://gist.github.com/magicoli/283785bdf21ebafd2202

chmod +x copy-from-time-machine.sh


 ~/Documents/copy-from-time-machine.sh /media/popoy/Seagate/Backups.backupdb/Popoy’s\ MacBook\ Pro/Latest/Macintosh\ HD/Users/popoy/Downloads ~/Documents/Downloads



By penoi on Wednesday, May 25, 2016 | | A comment?

Raspberry Pi 2 Unboxing

New toy!!!!








By penoi on Friday, February 13, 2015 | , | A comment?

OnePlus One

Matagal na akong IOS device user. Nagsimula sa Apple Iphone 4 then Iphone5. Although, my first smartphone device was a Sony Ericsson Xperia X10 android phone.

Siguro masyado lang ako na-bored sa user interface ng IOS kaya bumalik ulit ako sa Android. Matagal ko din pinagisipan kung Google Nexus 6 or OnePlus One... Nexus6 have superb up-to-date specs... but price-wise, I got OnePlus One. Since in my opinion(yung may mga budget), max lifespan lang ng isang phone ay 2 years.... magpapalit ka na agad(again, if you have the budget)

OnePlus One
My unit still has the Cyanogen logo at the back


OnePlus One with tempered glass and Diztronic casing




By penoi on Saturday, January 31, 2015 | , , | A comment?

How to get the last IP address on the Subnet using Ruby



>> require 'ipaddr'
>> ip=IPAddr.new("192.168.1.0/24")
=> #<IPAddr: IPv4:192.168.1.0/255.255.255.0>
>> gateway=IPAddr.new(ip.to_range.last.to_i-1,ip.family).to_s
=> "192.168.1.254"
>> ip=IPAddr.new("192.168.1.0/20")
=> #<IPAddr: IPv4:192.168.0.0/255.255.240.0>
>> gateway=IPAddr.new(ip.to_range.last.to_i-1,ip.family).to_s
=> "192.168.15.254"


to get the first ip of the subnet
 >> gateway=IPAddr.new(ip.to_range.first.to_i+1,ip.family).to_s

By penoi on Friday, January 23, 2015 | | A comment?

Posting from mobile

Post test from mobile

By penoi on Friday, January 9, 2015 | | A comment?

penoycentral.net dead

after years of maintaining penoycentral.net, i've decided to end it.

By penoi on Wednesday, January 7, 2015 | A comment?

Wordpress to blogger

This is my first post using blogger from smartphone. Yeah i've changed my blog hosting from wordpress to blogger after someone hacked my supposedly patched wordpress. Anyway, been contemplating to move to blogger anyway.. Free hosting and bandwidth without thinking of any security stuffs.

By penoi on Saturday, February 2, 2013 | | A comment?

RaspberryPi+raspbian+ratpoison

Setting up a web kiosk system using raspberrypi+raspbian+ratpoison

This instruction assumes that you already installed raspbian on your SD card

Installing required packages

sudo apt-get update
sudo apt-get ratpoison
sudo apt-get chromium
sudo apt-get x11vnc
sudo apt-get install x11-xserver-utils


=====

Start user pi at startup

pi@raspberrypi:~$ grep pi /etc/inittab 
1:2345:respawn:/bin/login -f pi tty1 
/dev/tty1 2>&1

pi@raspberrypi:~$ cat /home/pi/.bash_profile
if [ -z "$DISPLAY" ] && [ $(tty) == /dev/tty1 ]; then
startx
fi

=====

Set ratpoison's config file

pi@raspberrypi:~$ cat /home/pi/.xinitrc
exec ratpoison


pi@raspberrypi:~$ cat /home/pi/.ratpoisonrc
banish
exec xset s off
exec xset -dpms
exec unclutter -root
exec x11vnc -loop
exec /usr/bin/chromium --kiosk http://www.penoycentral.net


Remotely connec thru vnc
vncviewer raspberrypi.local

By penoi on Wednesday, November 21, 2012 | | A comment?

Enable DNS queries in BIND

# rndc querylog 


Query logs should be logged on /var/log/messages

To turn off

# rndc querylog


ref: http://www.cyberciti.biz/faq/howto-enable-dns-linux-unix-server-logging/

By penoi on Friday, November 2, 2012 | | A comment?

bash: scp: command not found

scp file.rar root@192.168.11.60:/var/tmp/
root@192.168.11.60's password:
bash: scp: command not found
lost connection


 

i forgot that i have done a minimal server install on the receiving end. installing openssh-clients solve the problem

By penoi on Thursday, November 1, 2012 | , , | A comment?

Vi/VIM

To insert characters on the beginning of a line. Example, insert // from line 1 to 10

 :1,10s!^!//! 


Sample in creating folding in vim. Insert #{{{ text here #}}} provided everything was properly setup on vimrc


~/workspace/puppetworks $ cat site.pp
node 'chrisp.lab.local' {#{{{




}#}}}



pressing zc will close the folded texts


+-- 6 lines: node 'chrisp.lab.local' {#----------------------------------------------------------------------------


ref: http://www.linux.com/learn/tutorials/442438-vim-tips-folding-fun

By penoi on Monday, October 1, 2012 | , | A comment?

Separating logs per hostname on a Central rsyslog server

Under /etc/rsyslog.conf append


$FileCreateMode 0655
$DirCreateMode 0755
$Umask 0022

$template default,"/srv/logs/%HOSTNAME%/%$now%.log"
*.* ?default


this will create directories under /srv/logs//*.logs with Directory permission of 755 and file permission of 655

By penoi on Sunday, September 30, 2012 | A comment?

Apology Accepted!!!

Vmware apologizes for technical difficulties on the recent webcast Technology Day Online. It looks like the webcast provider was caught off guard on the situation. To compensate, VMware will be sending me a USB memory stick containing all of the materials presented on the said event.

Well.. apology accepted!!!!! :)

By penoi on Thursday, September 20, 2012 | | A comment?

Our Samsung LCD TV retired

Our Samsung LCD TV retired after exactly 3 yrs of service. Bad thing is that it is already out of warranty. Yesterday the screen suddenly turns to white that you can barely see the images.

By penoi on Monday, August 6, 2012 | | A comment?

sed Galore

Find and replace string recursively

find /home/penoycentral/whichfolder -type f -print0| xargs -0 sed -i 's/oldstring/newstring/g'


If you want to make sure that you are changing which, use the old grep first
find /home/penoycentral/whichfolder -type f -print0| xargs -0 grep -i oldstring


Example Problem: Change /etc/bind to /var/named/master in named.conf

Just print what will be changed
 sed -n 's/\/etc\/bind/\/var\/named\/master/p' named.conf 


to change:
 sed -i 's/\/etc\/bind/\/var\/named\/masterr/g' named.conf 


Change double qoute to single qoute
sed -i "s/[\"]/\'/g" some-file.pp


Referrence:
http://stackoverflow.com/questions/1583219/awk-sed-how-to-do-a-recursive-find-replace-of-a-string

By penoi on Wednesday, June 27, 2012 | | A comment?