Monday, December 24, 2018

Permission denied error during "git push"


I was trying to push a new commit a brand new repo.
But faced this error:

remote: Permission to /  denied to .
fatal: unable to access '': The requested URL returned error: 403

The problem here , I cloned a read-only repo.


ok, now, try
git config -l

Check  remote.origin.url  in the above output.



Now, Change it something like
git remote set-url origin https://USERNAME@github.com/USERNAME/YOURREPO

So, we are making it read-write.



Now, carry out the "git push". it should work.




Sunday, December 16, 2018

Creating new objects from existing objects in OpenShift


---------
To create a new object from a existing object make use of
# oc get --export    -o yaml 

you can create new template out of this and can be used to create new objects.


Using "export " removes unnecessary info. from the template.

---------

To simply view a resource you can use

# oc get -o yaml

---------

failed_when directive in ansible



failed_when directive in ansible:

1.
You can mention something specific in failed_when directive which mentions what output(stdout) causes the failure.

Or

2.
you can altogether ignore the failure using failed_when set as "False".

============================================

1.
While creating users you can use something like:

failed_when: "'Password missing' in result.stdout"




2.
failed_when: False

Even if the command fails, do not exit and proceed further.


p1.yml
===================
---
- hosts: webservers
  tasks:
  - name: install tftp
    yum: pkg=tftp state=installed
    failed_when: False

===================


# cat inventory_simple
[webservers]
gant



#ansible-playbook -i inventory_simple       -s  p1.yml


So, even if tftp installation fails(for some reason) proceed further. Do not error out.
--

When the rc value is not 0 not 1 and something else, then fail 
    failed_when: ( results.rc not in [ 0, 1 ] )
--