|
|
@ -1,23 +1,27 @@
|
|
|
|
- name: integration/playbook_semantics/delegate_to.yml
|
|
|
|
- name: integration/playbook_semantics/delegate_to.yml
|
|
|
|
hosts: test-targets
|
|
|
|
hosts: test-targets
|
|
|
|
|
|
|
|
vars:
|
|
|
|
|
|
|
|
local_path: "/tmp/delegate_to.{{ inventory_hostname }}.txt"
|
|
|
|
tasks:
|
|
|
|
tasks:
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# delegate_to, no sudo
|
|
|
|
# delegate_to, no sudo
|
|
|
|
#
|
|
|
|
#
|
|
|
|
- name: "delegate_to, no sudo"
|
|
|
|
- name: "delegate_to, no sudo"
|
|
|
|
copy:
|
|
|
|
copy:
|
|
|
|
dest: /tmp/delegate_to.yml.txt
|
|
|
|
dest: "{{ local_path }}"
|
|
|
|
content: "Hello, world."
|
|
|
|
content: "Hello, world."
|
|
|
|
register: out
|
|
|
|
mode: u=rw,go=r
|
|
|
|
delegate_to: localhost
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
|
- name: "delegate_to, no sudo"
|
|
|
|
- name: "delegate_to, no sudo"
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
|
that: "lookup('file', '/tmp/delegate_to.yml.txt') == 'Hello, world.'"
|
|
|
|
that:
|
|
|
|
|
|
|
|
- lookup('file', local_path) == 'Hello, world.'
|
|
|
|
|
|
|
|
fail_msg: "{{ lookup('file', local_path) }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: "delegate_to, no sudo"
|
|
|
|
- name: "delegate_to, no sudo"
|
|
|
|
file:
|
|
|
|
file:
|
|
|
|
path: /tmp/delegate_to.yml.txt
|
|
|
|
path: "{{ local_path }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
delegate_to: localhost
|
|
|
|
delegate_to: localhost
|
|
|
|
|
|
|
|
|
|
|
@ -27,18 +31,20 @@
|
|
|
|
#
|
|
|
|
#
|
|
|
|
- name: "connection:local, no sudo"
|
|
|
|
- name: "connection:local, no sudo"
|
|
|
|
copy:
|
|
|
|
copy:
|
|
|
|
dest: /tmp/delegate_to.yml.txt
|
|
|
|
dest: "{{ local_path }}"
|
|
|
|
content: "Hello, world."
|
|
|
|
content: "Hello, world."
|
|
|
|
register: out
|
|
|
|
mode: u=rw,go=r
|
|
|
|
connection: local
|
|
|
|
connection: local
|
|
|
|
|
|
|
|
|
|
|
|
- name: "connection:local, no sudo"
|
|
|
|
- name: "connection:local, no sudo"
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
|
that: "lookup('file', '/tmp/delegate_to.yml.txt') == 'Hello, world.'"
|
|
|
|
that:
|
|
|
|
|
|
|
|
- lookup('file', local_path) == 'Hello, world.'
|
|
|
|
|
|
|
|
fail_msg: "{{ lookup('file', local_path) }}"
|
|
|
|
|
|
|
|
|
|
|
|
- name: "connection:local, no sudo"
|
|
|
|
- name: "connection:local, no sudo"
|
|
|
|
file:
|
|
|
|
file:
|
|
|
|
path: /tmp/delegate_to.yml.txt
|
|
|
|
path: "{{ local_path }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
connection: local
|
|
|
|
connection: local
|
|
|
|
|
|
|
|
|
|
|
@ -47,7 +53,10 @@
|
|
|
|
# delegate_to, sudo
|
|
|
|
# delegate_to, sudo
|
|
|
|
#
|
|
|
|
#
|
|
|
|
- name: "delegate_to, sudo"
|
|
|
|
- name: "delegate_to, sudo"
|
|
|
|
shell: whoami > /tmp/delegate_to.yml.txt
|
|
|
|
shell: |
|
|
|
|
|
|
|
|
whoami > "{{ local_path }}"
|
|
|
|
|
|
|
|
args:
|
|
|
|
|
|
|
|
creates: "{{ local_path }}"
|
|
|
|
delegate_to: localhost
|
|
|
|
delegate_to: localhost
|
|
|
|
become: true
|
|
|
|
become: true
|
|
|
|
tags:
|
|
|
|
tags:
|
|
|
@ -55,13 +64,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: "delegate_to, sudo"
|
|
|
|
- name: "delegate_to, sudo"
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
|
that: "lookup('file', '/tmp/delegate_to.yml.txt') == 'root'"
|
|
|
|
that:
|
|
|
|
|
|
|
|
- lookup('file', local_path) == 'root'
|
|
|
|
|
|
|
|
fail_msg: "{{ lookup('file', local_path) }}"
|
|
|
|
tags:
|
|
|
|
tags:
|
|
|
|
- requires_local_sudo
|
|
|
|
- requires_local_sudo
|
|
|
|
|
|
|
|
|
|
|
|
- name: "delegate_to, sudo"
|
|
|
|
- name: "delegate_to, sudo"
|
|
|
|
file:
|
|
|
|
file:
|
|
|
|
path: /tmp/delegate_to.yml.txt
|
|
|
|
path: "{{ local_path }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
delegate_to: localhost
|
|
|
|
delegate_to: localhost
|
|
|
|
become: true
|
|
|
|
become: true
|
|
|
@ -73,7 +84,10 @@
|
|
|
|
# connection:local, sudo
|
|
|
|
# connection:local, sudo
|
|
|
|
#
|
|
|
|
#
|
|
|
|
- name: "connection:local, sudo"
|
|
|
|
- name: "connection:local, sudo"
|
|
|
|
shell: whoami > /tmp/delegate_to.yml.txt
|
|
|
|
shell: |
|
|
|
|
|
|
|
|
whoami > "{{ local_path }}"
|
|
|
|
|
|
|
|
args:
|
|
|
|
|
|
|
|
creates: "{{ local_path }}"
|
|
|
|
connection: local
|
|
|
|
connection: local
|
|
|
|
become: true
|
|
|
|
become: true
|
|
|
|
tags:
|
|
|
|
tags:
|
|
|
@ -81,13 +95,15 @@
|
|
|
|
|
|
|
|
|
|
|
|
- name: "connection:local, sudo"
|
|
|
|
- name: "connection:local, sudo"
|
|
|
|
assert:
|
|
|
|
assert:
|
|
|
|
that: "lookup('file', '/tmp/delegate_to.yml.txt') == 'root'"
|
|
|
|
that:
|
|
|
|
|
|
|
|
- lookup('file', local_path) == 'root'
|
|
|
|
|
|
|
|
fail_msg: "{{ lookup('file', local_path) }}"
|
|
|
|
tags:
|
|
|
|
tags:
|
|
|
|
- requires_local_sudo
|
|
|
|
- requires_local_sudo
|
|
|
|
|
|
|
|
|
|
|
|
- name: "connection:local, sudo"
|
|
|
|
- name: "connection:local, sudo"
|
|
|
|
file:
|
|
|
|
file:
|
|
|
|
path: /tmp/delegate_to.yml.txt
|
|
|
|
path: "{{ local_path }}"
|
|
|
|
state: absent
|
|
|
|
state: absent
|
|
|
|
connection: local
|
|
|
|
connection: local
|
|
|
|
become: true
|
|
|
|
become: true
|
|
|
|