-
-
Notifications
You must be signed in to change notification settings - Fork 146
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ansible: add second role to sample_project (#259)
- Loading branch information
Showing
5 changed files
with
33 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,23 @@ | ||
# Sample project looks like: | ||
``` | ||
my_ansible_project/ | ||
├── roles/ | ||
│ ├── role1/ | ||
│ │ ├── tasks/ | ||
│ │ │ └── main.yml | ||
│ │ ├── handlers/ | ||
│ │ │ └── main.yml | ||
│ │ ├── templates/ | ||
│ │ ├── defaults/ | ||
│ │ └── meta/ | ||
│ └── role2/ | ||
│ ├── tasks/ | ||
│ ├── handlers/ | ||
│ ├── templates/ | ||
│ ├── defaults/ | ||
│ └── meta/ | ||
├── main.yml (your main playbook file) | ||
``` | ||
|
||
# How to run | ||
- Execute this command: `ansible-playbook -i inventory.ini main.yml` (tested on WSL2 Ubuntu) | ||
- Execute this command: `ansible-playbook -i inventory.ini -v main.yml` (tested on WSL2 Ubuntu) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 changes: 3 additions & 0 deletions
3
topics/ansible/projects/sample_project/roles/check_up_time/tasks/main.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
--- | ||
- name: Execute uptime command | ||
command: uptime |
2 changes: 2 additions & 0 deletions
2
topics/ansible/projects/sample_project/roles/ping-google/handlers/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# What is Handlers? | ||
- In Ansible, handlers are a way to define a list of tasks that should be executed only if certain conditions are met, typically triggered by a notify directive in other tasks. Handlers are often used for actions that need to be taken only when specific changes occur during the playbook run, such as restarting services after configuration changes. |
3 changes: 3 additions & 0 deletions
3
topics/ansible/projects/sample_project/roles/ping-google/templates/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Template? | ||
- In Ansible, templates are used to dynamically generate configuration files by inserting variable values and other dynamic content into a template file. | ||
- Templates are a powerful way to manage configuration files for various services and applications across different hosts. |