Ad Hoc Commands Flashcards

(11 cards)

1
Q

Learn about your environment

A

ansible [group] -a “hostname”
ansible [group] -a “date”
ansible [group] -a “ free -m”
(-a MODULE_ARGS, –args=MODULE_ARGS module arguments)

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

Make changes using Ansible modules

A

ansible [group] -s -m yum -a “name=ntp state=present”
-m MODULE_NAME, –module-name=MODULE_NAME
-s, –sudo run operations with sudo (nopasswd)
ansible [group] -s -m service -a “name=ntpd state=started\
enabled=yes”
ansible [group] -s -a “service ntpd start”

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

Configure Application Servers

A

ansible app -s -m yum -a “name=MySQL-python state=present”
ansible app -s -m yum -a “name=python-setuptools state=present”
ansible app -s -m easy_install -a “name=django state=present”

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

Configure Database Server

A

ansible db -s -m yum -a “name=mariadb-server state=present”
ansible db -s -m service -a “name=mariadb state=started enabled=yes”
ansible db -s -a “firewall-cmd –permanent –add-port=3306/tcp”

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

Manage Groups and Users

A

ansible app -s -m group -a “name=admin state=present”
ansible app -s -m user -a “name=johndoe group=admin createhome=yes”
ansible app -s -m user -a “name=johndoe state=absent remove=yes”

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

Manage packages

A

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

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

Get information on file

A

ansible app -m stat -a “path=/etc/hosts”

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

Copy a file

A

ansible app -m copy -a “scr=/etc/hosts dest=/tmp/hosts”

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

Receive file from server

A

ansible app -s -m fetch -a “scr=/etc/hosts dest=/tmp”

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

Create directory and symlink

A

ansible app -m file -a “dest=/tmp/dir mode=644 state=directory”
ansible app -m file -a “scr=/tmp/dir dest=/dest/symlink owner=root group=root state=link”

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

Delete file

A

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

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