Steps:
Create directory myplays
[root@srv1 ~]# mkdir myplays
Navigate to this directory
[root@srv1
~]# cd myplays
[root@srv1 myplays]#
At this moment we don’t have any file under this directory.
[root@srv1 myplays]# ll
total 0
[root@srv1 myplays]#git init
[root@srv1 myplays]#ls -lrta
Let’s configure one user whore create the files in the repository.
[root@srv1 myplays]#git config --global user.name
"Myionic1409"
[root@srv1 myplays]#git config --global user.email
"oracleforensics4u@gmail.com"
[root@srv1 myplays]#git config --global -l
Let’s create one playbook under below directory.
[root@srv1 myplays]#pwd
[root@srv1 myplays]#/root/myplays
[root@srv1 myplays]# cat first_pb.yml
---
- name: First Basic PB
hosts: localhost
tasks:
- name: Test
Connectivity
ping:
Check the status using below command. It will show nothing added to commit.
[root@srv1 myplays]# git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use
"git add <file>..." to include in what will be committed)
#
# first_pb.yml
nothing added to commit but untracked files present (use "git add" to track)
Let’s add all these file present in this directory.
[root@srv1 myplays]# git add -A
Or:
We can also use below command to add specific file.
[root@srv1 myplays]# git add first_pb.yml
Check the status now
[root@srv1 myplays]# git status
# On branch master
#
# Initial commit
#
# Changes to be committed:
# (use
"git rm --cached <file>..." to unstage)
#
# new
file: first_pb.yml
#
Take the snapshot using below commit command:
[root@srv1 myplays]# git commit -m "firstplaybook-30Dec24-ver1"
Create the links (where you want to copy the file):
[root@srv1 myplays]# git remote add origin https://github.com/myionic1409/ansiblerepo.git
Push the file:
[root@srv1 myplays]# git push -u origin main
Username for 'https://github.com':
oracleforensics4u@gmail.com
Password for
'https://oracleforensics4u@gmail.com@github.com':
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xxx
Counting objects: 7, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (5/5), done.
Writing objects: 100% (7/7), 719 bytes | 0 bytes/s,
done.
Total 7 (delta 1), reused 0 (delta 0)
remote: Resolving deltas: 100% (1/1), done.
To https://github.com/myionic1409/ansiblerepo.git
* [new
branch] main -> main
Branch main set up to track remote branch main from origin.
To Generate the Token (Password) from github account.
No comments:
Post a Comment