From dbd81b1cf6547d5055cfe6371477f3c67cd576ab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Torjus=20H=C3=A5kestad?= Date: Tue, 11 Jan 2022 10:52:38 +0100 Subject: [PATCH] Add testrole --- project/ping.yml | 7 ++++++- project/roles/testrole/tasks/main.yml | 4 ++++ project/roles/testrole/templates/testfile.j2 | 1 + 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 project/roles/testrole/tasks/main.yml create mode 100644 project/roles/testrole/templates/testfile.j2 diff --git a/project/ping.yml b/project/ping.yml index e191458..61ca2bf 100644 --- a/project/ping.yml +++ b/project/ping.yml @@ -2,4 +2,9 @@ - hosts: all tasks: - name: Ping hosts - ansible.builtin.ping: \ No newline at end of file + ansible.builtin.ping: + +- hosts: all + roles: + - testrole + \ No newline at end of file diff --git a/project/roles/testrole/tasks/main.yml b/project/roles/testrole/tasks/main.yml new file mode 100644 index 0000000..f495e39 --- /dev/null +++ b/project/roles/testrole/tasks/main.yml @@ -0,0 +1,4 @@ +- name: create test file + ansible.builtin.template: + src: testfile.j2 + dest: /tmp/testfile.txt \ No newline at end of file diff --git a/project/roles/testrole/templates/testfile.j2 b/project/roles/testrole/templates/testfile.j2 new file mode 100644 index 0000000..a24ed45 --- /dev/null +++ b/project/roles/testrole/templates/testfile.j2 @@ -0,0 +1 @@ +this is testfile.txt on {{ inventory_hostname }} \ No newline at end of file