Last Cards Flashcards

(19 cards)

1
Q

Set up a GPT partition on sdb that’s 2 gigs
Create a second partition for use as an LVM phsysical volume
Set up an LVM volume group
add a task that creates a logical volume within the volume group
on top of the logical volume create an XFS file system
Mount the file system
Create and activate swap space
Ensure the sdb on target is empty via ad-hoc command

A

Page 369

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

Configure a playbook that creates more swapspace if swap is below 256 MiB

A

blcok:
- name: make swap
filesystem:
fstype: swap
dev: /dev/sdb1
- name: activate swap space
command: swapon /dev/sdb1
when: ansible_swaptotal_mb < 256

lineinfile:
path: /etc/fstab
regexp: “^/dev/sdb1” swap swap default 0 0

Don’t forget to add the entry in fstab

A computer made of files is in a room. Uncle FeSter is TPYing in code for a game. He thinks he’s a genius DEV

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

mount a file system

A

mount:
src: /dev/vgdata/lvdata
fstype: xfs
state: mounted
path: /mydir

At he mountain’s nadir there was a large SOURCE of water. A FiSh was near it TYPing on a computer about how beautiful this water that he found was.
He declard this land the STATE of fishland and made it home. He even built a little PATH that led from his old home to the new one.

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

Create an XFS file system

A

filesystem:
dev: /dev/vgdata/lvdata
fstype: xfs

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

Create a logical volume

A
  • name: this
    lvol:
    lv: lvdata
    size: 100%FREE
    vg: vgdata

In Louisville Little Pete had been shrunk. He Resized himself then measured his SIZE afterword. He wanted to be sure he wasn’t misreading the measurement and took a SNAPSHOT of himself. He believed this was due to the fact that he didn’t eat his vegetables.

size, by default is in mb

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

What is the module and its options you use for logical volumes

A

lvol

lv - name of lv
pvs: comma separated physical volumes, if this is a partition use the lvm option as set
resizefs - resize automatically
size: size of lv
snapshot - put the name of the lv you’re making a snap of here
vg - vg to use

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

Use a module to create a vg group

Explain PEs

A

lvg:
vg: vgdata
pesize: “8”
pvs: /dev/sdb1

PE - Physical Extents - Blocks of data that LVM uses.
If the size were in bits then it would take it longer to find the end of the disk than it would with bigger chunks.
So bigger chunks = better speed
smaller chunks = you can give the appropriate amount of data more often

On old lever sits in a mysterious room.
Mario pulls it to find it lowers a window where he sees Peach showing her stuff. This make Mario feel a certain way and he measures to see.
He turns around to see everyone peeing a V on his back

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

Create multiple partitions for sdb

A

parted:
name: files
label: gpt
device: /dev/sdb
number: 1
state: present
part_start: 1MiB
part_end: 2GiB

The next will go from 2GiB to 4GiB give it the lvm flag

PG 365

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

What are the options for parted?

A

name - name for part
label: mbr or gpt
device:
number: partition number
state: present to create absent to delete
part_start - starting part
part_end - end of part
flags - add LVM here if you’re making an LVM part

Moses PARTED the Red Sea
His followers chanted his NAME when he did
One of the followers scooped some water as he walked through it into a LADLE
In Moses’ staff there was actually a DEVICE that did the magic
After taking a sip of water, the follower counted the fish he saw.
After they had traversed the sea, they found that they were now in the STATE of indiana, they knew this because of the FLAG
Just as the PARTING STARTED, the PARTING ENDED

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

Set a fact under disk2name: sdb if sdb exists

Have the playbook make sure hosts without this disk not conitnue the playbook

A
  • ignore_errors: true
    set_fact:
    dsk2name: sdb
    when: ansible_facts[‘devices’][‘sdb’]

fail:
msg: no second disk
when: disk2name is not defined

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

What are some ansible facts you can use to find storage information for

A

ansible_devices
ansible_device_links
ansible_mounts

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

What storage modules can you use?

A

parted
lvg
lvol
filesystem
mount
vdo

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

Create a cron job to run upon a reboot

A

cron:
name: “reboot”
state: present
special_time: reboot
job: “echo rebooted at $(date)&raquo_space; /tmp/rebooted”

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

Reboot a host,
test if it’s back on with a command
print a message to show it was successful

A

reboot:
msg: reboot initiated by ansible
test_command: whoami

debug:
msg: “Successful reboot”

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

What options can you use with the reboot module and how do you use them?

give 5 seconds before rebooting
15 second wait before attempting to connect
Try logging in again if nothing for 10 seconds
Give an error 1 minute after reboot if you have nothing

A

connect_timeout - max secs to wait for successful connection before trying again

post_reboot_delay - secs to wait after reboot command tbefore trying to validate if available again

pre_reboot_delay - secs to wait before actually issuing the reboot

reboot_timeout - max seconds to wait for reboot matching to response to test command

pre_reboot_delay: 5
post_reboot_delay: 15
connect_timout:10
reboot_timeout: 30

The playbook will wait 5 seconds before issueing reboot

it will then wait for 15 seconds after reboot before trying to connect

It will try to connect and if nothing for 10 seconds it will try again

If at 30 seconds after the reboot it gets nothing it will give up

This is all input in seconds

The postman pre in the post office. The line was delayed because of this.

He ignored the line and went to go connect some legos. After he was finished he went back to the line and had to reboot his computers due to errors

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

Send the date once to /tmp/my-at-file in 5 minutes

A

at:
command: “date > /tmp/my-at-file”
count: 5
units: minutes
unique: true
state: present

17
Q

What do you use if you only want to run a job once?

What are it’s arguments?

A

at

command: specifies command to be used
units: minute, hour, day, week
count: specifies number of units to execute the task at
script_file: name of script
state: added or deleted
unique: set to yes to only run once/only runs job if similar job isn’t scheduled at same time

The COMMANDer tells his UNITS to COUNT to ten. The troop proceeds to count on their fingers. On the other end of the battlefield there are a group of CRIPS sharpening FILES. This is in the STATE of indiana.
A UNIversity studies what is happening on the battlefield

18
Q

Setup a cron job to run everyday at 4:05 and 19:05 as user ansible

A

cron:
name: “run fstrim”
minute: “5”
hour: “4,19”
job: “fstrim”
user: ansible

minute
hour
day = of the month
month
weekday

19
Q

Show an example of how you would send your pub keys without using the copy module

A
  • name: test
    hosts: ansible3
    tasks:
    • name: copy auth keys
      authorized_key:
      user: ansible
      state: present
      key: “{{ lookup(‘file’, ‘/home/danny/.ssh/id_rsa.pub’) }}”

Basically this means the user danny on YOUR server will be able to login as ansible on the REMOTE server

Always Use Some Keys