diff --git a/playbooks/test_playbook.yml b/playbooks/test_playbook.yml index a055c59..fe5b14f 100644 --- a/playbooks/test_playbook.yml +++ b/playbooks/test_playbook.yml @@ -3,3 +3,5 @@ roles: - name: Test Role role: test_role + vars: + lorem_ipsum_string: Lorem Ipsum is simply dummy text diff --git a/roles/test_role/README.md b/roles/test_role/README.md new file mode 100644 index 0000000..1fce1ba --- /dev/null +++ b/roles/test_role/README.md @@ -0,0 +1,10 @@ +# Test Role + +A brief description about the role... + +## Variables + +| Name | Is Required? | Default | +|:--------------------:|:------------:|:-------------:| +| `hello_world_string` | ✔️ | Hello, World! | +| `lorem_ipsum_string` | ❌ | | diff --git a/roles/test_role/defaults/main.yml b/roles/test_role/defaults/main.yml new file mode 100644 index 0000000..05d43ab --- /dev/null +++ b/roles/test_role/defaults/main.yml @@ -0,0 +1 @@ +hello_world_string: Hello, World! diff --git a/roles/test_role/tasks/main.yml b/roles/test_role/tasks/main.yml index a281ff4..a623356 100644 --- a/roles/test_role/tasks/main.yml +++ b/roles/test_role/tasks/main.yml @@ -3,7 +3,7 @@ - name: Print an "Hello, World!" ansible.builtin.debug: - msg: Hello, World! + msg: "{{ hello_world_string }}" - name: Test the `ansible_managed` variable ansible.builtin.template: diff --git a/roles/test_role/templates/ansible.txt.j2 b/roles/test_role/templates/ansible.txt.j2 index e2bb153..81d6aab 100644 --- a/roles/test_role/templates/ansible.txt.j2 +++ b/roles/test_role/templates/ansible.txt.j2 @@ -1 +1,3 @@ # {{ ansible_managed }} + +{{ lorem_ipsum_string }}