Command Line Flashcards

1
Q

Command to check to get the hostname of a group of machines: “multi”

A

ansible multi -a “hostname”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Command to check to get the hostname of a group of machines: “multi”, one node at a time.

A

ansible multi -a “hostname” -f 1

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Command to check to get the amout of memory of a group of machines: “multi”

A

ansible multi -a “free -m”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Command to install ntp on a group of machines: “multi”

A

ansible multi -b -m yum a “name=ntp state=present”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Command to add an “admin” group on a group of machines: “multi”

A

ansible multi -b -m group -a “state=present name=admin”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Add a user “john” on a group of machines: “multi” in the group admin

A

ansible multi -m user -b -a “state=present name=john group=admin createhome=yes”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Install git on “host” using the generic ansible module dedicated for this purpose

A

ansible host -m package -a “name=git state=present”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Check file permissions of a folder /etc/environment

A

ansible multi -m stat -a “path=/etc/environment”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Recursively copy folder /etc/hosts into /tmp/hosts

A

ansible multi -m copy -a “src=/etc/hosts dest=/tmp/hosts”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Copy content of folder /etc/hosts into /tmp/hosts

A

ansible multi -m copy -a “src=/etc/hosts/ dest=/tmp/hosts”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Create a directory /tmp/dest

A

ansible multi -m file -a “state=directory mode=644 dest=/tmp/dest”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Create a symlink from /tmp/dest to /etc/dest

A

ansible multi -m file -a “state=link dest=/etc/dest src=/tmp/dest”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Delete a directory /tmp/dest

A

ansible multi -m file -a “state=absent dest=/tmp/dest”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Set a cron job to run the script /etc/dc/script.sh every 4h

A

ansible hosts -m cron -a “hour=4 job=/etc/dc/script.sh name=every-four-hour-job”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Stp the cron job every-four-hour-job

A

ansible hosts -m cron -a “name=every-four-hour-job state=absent”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly