Modules Flashcards

1
Q

Create task to install ntpd on CentOS

A
  • yum: name=ntp state=present
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Create task to start ntpd on CentOS

A
  • service: name=ntpd state=started enabled=yes
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

Create a task to install httpd and httpd-devel on CentOS

A
-yum:
   name:
       -httpd
       -httpd-devel
    state: present
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Create task to copy following files, setting permissions to 644 and group to root and user to root:
httpd.conf to /etc/httpd/conf/httpd.conf
httpd-vhosts.conf to /etc/httpd/conf/httpd-vhosts.conf

A

-copy:
src: {{item}}
dest: “/etc/httpd/conf/”{{item}}
owner: root
group: root
mode: 644
with_items:
- httpd.conf
- httpd-vhosts.conf

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

How do you specify the user a playbook should be run as?

A

ansible-playbook playbook.yml –remote-user=johndoe

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

How do you define variables when running the play book?

A

ansible-playbook playbook.yml –extra-vars=”key=value,key=value”

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

A complete playbook that defines a variable “index.html” and installs nginx

A
  • hosts: all
    become: yes
    vars:
    • index_file: “index.html”
      tasks:
    • yum: name=nginx state=present
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Task to ensure firewalld is stoped

A

-yum: name=firewalld state=stopped

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

Create a playbook that logs in as root and installs haproxy using role haproxy.

A
  • name: Installs haxproxy using role
    remote_user: root
    roles:
    - haproxy
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Create a playbook that logs in as root and installs mysql and mysqladmin using roles with same names.

A
  • hosts: db
    name: install mysql and mysql admin
    remote_user: root
    roles:
    - mysql
    - mysqladmin
How well did you know this?
1
Not at all
2
3
4
5
Perfectly