Skip to content

Commit 3b2c7c1

Browse files
committed
dos2unix
1 parent b09abcb commit 3b2c7c1

File tree

258 files changed

+42513
-42513
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

258 files changed

+42513
-42513
lines changed

.gitignore

100644100755
File mode changed.

ansible/Tower

100644100755
Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,27 @@
1-
1 git clone http://github.com/lerndevops/labs
2-
2 cd labs/ansible/install/
3-
3 ./installAnsible.sh
4-
5 apt-get install software-properties-common
5-
6 add-apt-repository ppa:deadsnakes/ppa
6-
7 apt-get update
7-
8 apt-get install python3.6
8-
9 apt-get remove python2.7
9-
10 cd ..
10-
11 cd docker/
11-
12 ./install/installDocker.sh
12-
13 cd
13-
14 git clone https://github.com/ansible/awx
14-
15 cd awx/installer/
15-
16 ls
16-
17 ansible --version
17-
18 cd
18-
19 cd labs/ansible/install/
19-
20 ./installAnsible.sh
20-
21 cd
21-
22 cd awx/
22-
23 cd installer/
23-
32 apt install python3-docker
24-
38 apt-get install python3-pip
25-
39 pip3 install docker-compose
26-
40 ansible-playbook -i inventory install.yml
27-
docker ps
1+
1 git clone http://github.com/lerndevops/labs
2+
2 cd labs/ansible/install/
3+
3 ./installAnsible.sh
4+
5 apt-get install software-properties-common
5+
6 add-apt-repository ppa:deadsnakes/ppa
6+
7 apt-get update
7+
8 apt-get install python3.6
8+
9 apt-get remove python2.7
9+
10 cd ..
10+
11 cd docker/
11+
12 ./install/installDocker.sh
12+
13 cd
13+
14 git clone https://github.com/ansible/awx
14+
15 cd awx/installer/
15+
16 ls
16+
17 ansible --version
17+
18 cd
18+
19 cd labs/ansible/install/
19+
20 ./installAnsible.sh
20+
21 cd
21+
22 cd awx/
22+
23 cd installer/
23+
32 apt install python3-docker
24+
38 apt-get install python3-pip
25+
39 pip3 install docker-compose
26+
40 ansible-playbook -i inventory install.yml
27+
docker ps

ansible/ad-hoc/readme.md

Lines changed: 46 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,46 +1,46 @@
1-
`Ad-Hoc commands are one-liner ansible commands that performs one task on the target host.`
2-
`It allows you to execute simpleone-line task against one or group of hosts defined on the inventory file configuration.`
3-
4-
## Ansible Ad-Hoc Commands to use when SSH Keys configured with target hosts
5-
6-
```
7-
how to run ansible ad-hoc commands ( default inventory )
8-
9-
ansible all -m setup
10-
ansible qa -m ping
11-
ansible dev -m shell -a "free -m"
12-
ansible iat -m copy -a "src=/tmp/naresh.txt dest=/tmp"
13-
ansible prod -m file -a "path=/tmp/helousername.txt state=touch"
14-
15-
how to run ansible ad-hoc with custom inventory
16-
17-
ansible all -i /path/to/inventory ping
18-
ansible dev -i /path/to/inventory -m copy -a "src=/tmp/new.txt dest=/tmp"
19-
20-
how to run ansible ad-hoc with super user (root)
21-
22-
ansible all -i /path/to/inventory -b ping
23-
ansible dev -i /path/to/inventory -m copy -a "src=/tmp/new.txt dest=/tmp" -b
24-
```
25-
26-
## Ansible Ad-Hoc Commands to use when No SSH Keys configured with target hosts
27-
28-
```
29-
how to run ansible ad-hoc commands ( default inventory ) with uid/pwd
30-
31-
ansible all -m setup -u username -k
32-
ansible qa -m ping -u username -k
33-
ansible dev -m shell -a "free -m" -u username -k
34-
ansible iat -m copy -a "src=/tmp/naresh.txt dest=/tmp" -u username -k
35-
ansible prod -m file -a "path=/tmp/helousername.txt state=touch" -u username -k
36-
37-
how to run ansible ad-hoc with custom inventory & uid/pwd
38-
39-
ansible all -i /path/to/inventory -u username -k
40-
ansible dev -i /path/to/inventory -m copy -a "src=/tmp/new.txt dest=/tmp" -u username -k
41-
42-
how to run ansible ad-hoc with super user (root) with uid/pwd
43-
44-
ansible all -i /path/to/inventory -b -u username -k -K
45-
ansible dev -i /path/to/inventory -m copy -a "src=/tmp/new.txt dest=/tmp" -b -u username -k -K
46-
```
1+
`Ad-Hoc commands are one-liner ansible commands that performs one task on the target host.`
2+
`It allows you to execute simpleone-line task against one or group of hosts defined on the inventory file configuration.`
3+
4+
## Ansible Ad-Hoc Commands to use when SSH Keys configured with target hosts
5+
6+
```
7+
how to run ansible ad-hoc commands ( default inventory )
8+
9+
ansible all -m setup
10+
ansible qa -m ping
11+
ansible dev -m shell -a "free -m"
12+
ansible iat -m copy -a "src=/tmp/naresh.txt dest=/tmp"
13+
ansible prod -m file -a "path=/tmp/helousername.txt state=touch"
14+
15+
how to run ansible ad-hoc with custom inventory
16+
17+
ansible all -i /path/to/inventory ping
18+
ansible dev -i /path/to/inventory -m copy -a "src=/tmp/new.txt dest=/tmp"
19+
20+
how to run ansible ad-hoc with super user (root)
21+
22+
ansible all -i /path/to/inventory -b ping
23+
ansible dev -i /path/to/inventory -m copy -a "src=/tmp/new.txt dest=/tmp" -b
24+
```
25+
26+
## Ansible Ad-Hoc Commands to use when No SSH Keys configured with target hosts
27+
28+
```
29+
how to run ansible ad-hoc commands ( default inventory ) with uid/pwd
30+
31+
ansible all -m setup -u username -k
32+
ansible qa -m ping -u username -k
33+
ansible dev -m shell -a "free -m" -u username -k
34+
ansible iat -m copy -a "src=/tmp/naresh.txt dest=/tmp" -u username -k
35+
ansible prod -m file -a "path=/tmp/helousername.txt state=touch" -u username -k
36+
37+
how to run ansible ad-hoc with custom inventory & uid/pwd
38+
39+
ansible all -i /path/to/inventory -u username -k
40+
ansible dev -i /path/to/inventory -m copy -a "src=/tmp/new.txt dest=/tmp" -u username -k
41+
42+
how to run ansible ad-hoc with super user (root) with uid/pwd
43+
44+
ansible all -i /path/to/inventory -b -u username -k -K
45+
ansible dev -i /path/to/inventory -m copy -a "src=/tmp/new.txt dest=/tmp" -b -u username -k -K
46+
```

ansible/ansible-commands.txt

100644100755
File mode changed.

ansible/dockerrole.yml

100644100755
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
- hosts: all
2-
become: yes
3-
roles:
4-
- docker
1+
- hosts: all
2+
become: yes
3+
roles:
4+
- docker

ansible/install/InsallAnsible.txt

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
Installation Steps for Ubuntu
2-
====================================================================
3-
sudo apt-get update
4-
sudo apt-get install software-properties-common
5-
sudo apt-add-repository --yes --update ppa:ansible/ansible
6-
sudo apt-get install ansible
7-
8-
9-
Installation Steps for centos
10-
=====================================================================
11-
1+
Installation Steps for Ubuntu
2+
====================================================================
3+
sudo apt-get update
4+
sudo apt-get install software-properties-common
5+
sudo apt-add-repository --yes --update ppa:ansible/ansible
6+
sudo apt-get install ansible
7+
8+
9+
Installation Steps for centos
10+
=====================================================================
11+
1212
devops/devops

ansible/install/TowerSetup

100644100755
Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
1 git clone https://github.com/ansible/awx
2-
2 git clone https://github.com/lerndevops/labs
3-
3 cd labs/
4-
4 cd ansible/
5-
5 ./installAnsible.sh
6-
6 apt-get update
7-
9 apt install python3-pip
8-
10 apt-get update
9-
11 sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
10-
12 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
11-
13 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
12-
$(lsb_release -cs) \
13-
stable"
14-
14 sudo apt-get update
15-
15 apt-get install docker-ce docker-ce-cli containerd.io
16-
16 docker -v
17-
18 apt install python-pip
18-
19 pip install docker-compose
19-
22 cd ../..
20-
23 cd awx/
21-
24 ls
22-
25 cd installer/
23-
26 ls
24-
28 ansible-playbook -i inventory install.yml
25-
29 docker ps
26-
1+
1 git clone https://github.com/ansible/awx
2+
2 git clone https://github.com/lerndevops/labs
3+
3 cd labs/
4+
4 cd ansible/
5+
5 ./installAnsible.sh
6+
6 apt-get update
7+
9 apt install python3-pip
8+
10 apt-get update
9+
11 sudo apt-get install apt-transport-https ca-certificates curl gnupg-agent software-properties-common
10+
12 curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add -
11+
13 sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
12+
$(lsb_release -cs) \
13+
stable"
14+
14 sudo apt-get update
15+
15 apt-get install docker-ce docker-ce-cli containerd.io
16+
16 docker -v
17+
18 apt install python-pip
18+
19 pip install docker-compose
19+
22 cd ../..
20+
23 cd awx/
21+
24 ls
22+
25 cd installer/
23+
26 ls
24+
28 ansible-playbook -i inventory install.yml
25+
29 docker ps
26+

ansible/install/ssh-keys-setup.md

100644100755
Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,31 @@
1-
### create a user on all machines ( controller & all targets )
2-
3-
useradd naresh -m -d /home/naresh -s /bin/bash
4-
5-
### add user to sudoers for root previliges on all machines ( all targets )
6-
7-
echo -e 'naresh ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/naresh
8-
9-
### genereate ssh keys for above user on contrller machine
10-
11-
```
12-
1) switch to user ( su - naresh )
13-
2) run "ssh-keygen" command as user ( this will genereate ssh keys for the user )
14-
```
15-
```
16-
on ansible controller machine
17-
cd /home/naresh/.ssh
18-
cat id_rsa.pub (copy the content)
19-
```
20-
### copy user ssh keys from ansible contrller to all target hosts
21-
22-
```
23-
1) on all target machines
24-
swith to the user ( su - naresh )
25-
mkdir -p /home/naresh/.ssh
26-
touch /home/naresh/.ssh/authorized_keys
27-
chmod -R 700 /home/naresh/.ssh
28-
vi /home/naresh/.ssh/authorized_keys (enter the copied contet of id_rsa.pub from controller & save the file)
29-
```
30-
31-
1+
### create a user on all machines ( controller & all targets )
2+
3+
useradd naresh -m -d /home/naresh -s /bin/bash
4+
5+
### add user to sudoers for root previliges on all machines ( all targets )
6+
7+
echo -e 'naresh ALL=(ALL) NOPASSWD: ALL' > /etc/sudoers.d/naresh
8+
9+
### genereate ssh keys for above user on contrller machine
10+
11+
```
12+
1) switch to user ( su - naresh )
13+
2) run "ssh-keygen" command as user ( this will genereate ssh keys for the user )
14+
```
15+
```
16+
on ansible controller machine
17+
cd /home/naresh/.ssh
18+
cat id_rsa.pub (copy the content)
19+
```
20+
### copy user ssh keys from ansible contrller to all target hosts
21+
22+
```
23+
1) on all target machines
24+
swith to the user ( su - naresh )
25+
mkdir -p /home/naresh/.ssh
26+
touch /home/naresh/.ssh/authorized_keys
27+
chmod -R 700 /home/naresh/.ssh
28+
vi /home/naresh/.ssh/authorized_keys (enter the copied contet of id_rsa.pub from controller & save the file)
29+
```
30+
31+

ansible/playbooks/06copy.yml

100644100755
Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
---
2-
- hosts: all
3-
become: true
4-
tasks:
5-
- name: Copy ansible inventory file to all hostmachines
6-
copy: src=/etc/ansible/ansible.cfg
7-
dest=/tmp/
8-
owner=root
9-
group=root
10-
mode=0666
11-
...
1+
---
2+
- hosts: all
3+
become: true
4+
tasks:
5+
- name: Copy ansible inventory file to all hostmachines
6+
copy: src=/etc/ansible/ansible.cfg
7+
dest=/tmp/
8+
owner=root
9+
group=root
10+
mode=0666
11+
...

ansible/playbooks/07loops1.yml

100644100755
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
#This playbbok will install HTTP server,wget and vim package using loops.
2-
3-
---
4-
- hosts: localhost
5-
become: true
6-
tasks:
7-
- name: Install list of packages
8-
yum: name='{{item}}' state=present
9-
with_items:
10-
- httpd
11-
- wget
12-
- vim
13-
- zip
14-
- unzip
15-
...
1+
#This playbbok will install HTTP server,wget and vim package using loops.
2+
3+
---
4+
- hosts: localhost
5+
become: true
6+
tasks:
7+
- name: Install list of packages
8+
yum: name='{{item}}' state=present
9+
with_items:
10+
- httpd
11+
- wget
12+
- vim
13+
- zip
14+
- unzip
15+
...

0 commit comments

Comments
 (0)