diff --git a/examples/playbook/connection_local.yml b/examples/playbook/connection_local.yml index 4bea032b..4518dba5 100644 --- a/examples/playbook/connection_local.yml +++ b/examples/playbook/connection_local.yml @@ -2,5 +2,8 @@ - hosts: all gather_facts: false - roles: - - connection_local + tasks: + - name: "Run hostname" + connection: local + command: hostname + with_sequence: start=1 end=100 diff --git a/examples/playbook/roles/connection_local/tasks/main.yml b/examples/playbook/roles/connection_local/tasks/main.yml deleted file mode 100644 index d9a977f2..00000000 --- a/examples/playbook/roles/connection_local/tasks/main.yml +++ /dev/null @@ -1,101 +0,0 @@ ---- - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname - -- name: "My Role" - connection: local - command: hostname diff --git a/examples/playbook/roles/run_hostname_100_times/tasks/main.yml b/examples/playbook/roles/run_hostname_100_times/tasks/main.yml deleted file mode 100644 index 918bd120..00000000 --- a/examples/playbook/roles/run_hostname_100_times/tasks/main.yml +++ /dev/null @@ -1,202 +0,0 @@ ---- - -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname -- name: "My Role" - command: hostname diff --git a/examples/playbook/roles/whoami/tasks/main.yml b/examples/playbook/roles/whoami/tasks/main.yml deleted file mode 100644 index 7555946f..00000000 --- a/examples/playbook/roles/whoami/tasks/main.yml +++ /dev/null @@ -1,8 +0,0 @@ ---- - -- name: "This command should run as the SSH user" - command: whoami - -- name: "This command should run as root" - become: true - command: whoami diff --git a/examples/playbook/run_hostname_100_times.yml b/examples/playbook/run_hostname_100_times.yml index f02bd678..22c74138 100644 --- a/examples/playbook/run_hostname_100_times.yml +++ b/examples/playbook/run_hostname_100_times.yml @@ -2,5 +2,7 @@ - hosts: all gather_facts: false - roles: - - run_hostname_100_times + tasks: + - name: "Run hostname" + command: hostname + with_sequence: start=1 end=100 diff --git a/examples/playbook/whoami.yml b/examples/playbook/whoami.yml index 133941f8..1495e044 100644 --- a/examples/playbook/whoami.yml +++ b/examples/playbook/whoami.yml @@ -1,6 +1,21 @@ --- - - hosts: all - roles: - - whoami + tasks: + - name: "This command should run as the SSH user" + command: whoami + register: whoami + + - name: "Verify non-become user is correct" + assert: + that: "whoami.stdout == '{{ansible_user_id}}'" + + - name: "This command should run as root" + become: true + command: whoami + register: whoami + + - name: "Verify become user is correct" + assert: + that: "whoami.stdout == 'root'" +