You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
mitogen/tests/ansible/integration/playbook_semantics/delegate_to.yml

98 lines
2.2 KiB
YAML

- name: integration/playbook_semantics/delegate_to.yml
hosts: test-targets
tasks:
#
# delegate_to, no sudo
#
- name: "delegate_to, no sudo"
copy:
dest: /tmp/delegate_to.yml.txt
content: "Hello, world."
register: out
delegate_to: localhost
- name: "delegate_to, no sudo"
assert:
that: "lookup('file', '/tmp/delegate_to.yml.txt') == 'Hello, world.'"
- name: "delegate_to, no sudo"
file:
path: /tmp/delegate_to.yml.txt
state: absent
delegate_to: localhost
#
# connection:local, no sudo
#
- name: "connection:local, no sudo"
copy:
dest: /tmp/delegate_to.yml.txt
content: "Hello, world."
register: out
connection: local
- name: "connection:local, no sudo"
assert:
that: "lookup('file', '/tmp/delegate_to.yml.txt') == 'Hello, world.'"
- name: "connection:local, no sudo"
file:
path: /tmp/delegate_to.yml.txt
state: absent
connection: local
#
# delegate_to, sudo
#
- name: "delegate_to, sudo"
shell: whoami > /tmp/delegate_to.yml.txt
delegate_to: localhost
become: true
tags:
- requires_local_sudo
- name: "delegate_to, sudo"
assert:
that: "lookup('file', '/tmp/delegate_to.yml.txt') == 'root'"
tags:
- requires_local_sudo
- name: "delegate_to, sudo"
file:
path: /tmp/delegate_to.yml.txt
state: absent
delegate_to: localhost
become: true
tags:
- requires_local_sudo
#
# connection:local, sudo
#
- name: "connection:local, sudo"
shell: whoami > /tmp/delegate_to.yml.txt
connection: local
become: true
tags:
- requires_local_sudo
- name: "connection:local, sudo"
assert:
that: "lookup('file', '/tmp/delegate_to.yml.txt') == 'root'"
tags:
- requires_local_sudo
- name: "connection:local, sudo"
file:
path: /tmp/delegate_to.yml.txt
state: absent
connection: local
become: true
tags:
- requires_local_sudo
tags:
- delegate_to