Add 57 new questions and exercises
This commit is contained in:
6
exercises/ansible/my_first_playbook.md
Normal file
6
exercises/ansible/my_first_playbook.md
Normal file
@ -0,0 +1,6 @@
|
||||
## Ansible - My First Playbook
|
||||
|
||||
1. Write a playbook that will:
|
||||
a. Install the package zlib
|
||||
b. Create the file `/tmp/some_file`
|
||||
2. Run the playbook on a remote host
|
3
exercises/ansible/my_first_task.md
Normal file
3
exercises/ansible/my_first_task.md
Normal file
@ -0,0 +1,3 @@
|
||||
## Ansible - My First Task
|
||||
|
||||
1. Write a task to create the directory ‘/tmp/new_directory’
|
28
exercises/ansible/solutions/my_first_playbook.md
Normal file
28
exercises/ansible/solutions/my_first_playbook.md
Normal file
@ -0,0 +1,28 @@
|
||||
## My first playbook - Solution
|
||||
|
||||
1. `vi first_playbook.yml`
|
||||
|
||||
```
|
||||
- name: Install zlib and create a file
|
||||
hosts: some_remote_host
|
||||
tasks:
|
||||
- name: Install zlib
|
||||
package:
|
||||
name: zlib
|
||||
state: present
|
||||
become: yes
|
||||
- name: Create the file /tmp/some_file
|
||||
path: '/tmp/some_file'
|
||||
state: touch
|
||||
```
|
||||
|
||||
2. First, edit the inventory file: `vi /etc/ansible/hosts`
|
||||
|
||||
```
|
||||
[some_remote_host]
|
||||
some.remoted.host.com
|
||||
```
|
||||
|
||||
Run the playbook
|
||||
|
||||
`ansible-playbook first_playbook.yml`
|
8
exercises/ansible/solutions/my_first_task.md
Normal file
8
exercises/ansible/solutions/my_first_task.md
Normal file
@ -0,0 +1,8 @@
|
||||
## My First Task - Solution
|
||||
|
||||
```
|
||||
- name: Create a new directory
|
||||
file:
|
||||
path: "/tmp/new_directory"
|
||||
state: directory
|
||||
```
|
Reference in New Issue
Block a user