Add delegate_to option to each syncronized task

Signed-off-by: Hideki Saito <saito@fgrep.org>
This commit is contained in:
Hideki Saito 2021-10-04 10:59:49 +09:00
parent b7414027c5
commit 5913800125
3 changed files with 33 additions and 5 deletions

View file

@ -51,10 +51,22 @@ stages:
parameters:
testFormat: devel/linux/{0}/1
targets:
- name: CentOS 6
test: centos6
- name: CentOS 7
test: centos7
- name: CentOS 8
test: centos8
- name: Fedora 33
test: fedora33
- name: Fedora 34
test: fedora34
- name: openSUSE 15 py2
test: opensuse15py2
- name: openSUSE 15 py3
test: opensuse15
- name: Ubuntu 18.04
test: ubuntu1804
- name: Ubuntu 20.04
test: ubuntu2004
- stage: Docker_2_11
@ -147,6 +159,8 @@ stages:
targets:
- name: MacOS 11.1
test: macos/11.1
- name: RHEL 7.9
test: rhel/7.9
- name: RHEL 8.4
test: rhel/8.4
- name: FreeBSD 12.2

View file

@ -1,3 +1,3 @@
---
trivial:
- CI tests - remove unsupported platform from devel branch tests.
- CI tests - fix integration test for synchronize to address changing behavior of devel.

View file

@ -2,18 +2,23 @@
package:
name: rsync
when: ansible_distribution != "MacOSX"
- name: cleanup old files
shell: rm -rf {{output_dir}}/*
- name: Clean up the working directory and files
file:
path: "{{ output_dir }}"
state: absent
- name: Create the working directory
file:
path: "{{ output_dir }}"
state: directory
- name: create test new files
copy: dest={{output_dir}}/{{item}} mode=0644 content="hello world"
with_items:
- foo.txt
- bar.txt
- stat:
path: "{{ output_dir }}"
- name: synchronize file to new filename
synchronize: src={{output_dir}}/foo.txt dest={{output_dir}}/foo.result
register: sync_result
delegate_to: "{{ inventory_hostname }}"
- assert:
that:
- '''changed'' in sync_result'
@ -36,6 +41,7 @@
- name: test that the file is not copied a second time
synchronize: src={{output_dir}}/foo.txt dest={{output_dir}}/foo.result
register: sync_result
delegate_to: "{{ inventory_hostname }}"
- assert:
that:
- sync_result.changed == False
@ -52,6 +58,7 @@
dest: '{{output_dir}}/foo.result'
mode: push
register: sync_result
delegate_to: "{{ inventory_hostname }}"
- assert:
that:
- '''changed'' in sync_result'
@ -77,6 +84,7 @@
dest: '{{output_dir}}/foo.result'
mode: push
register: sync_result
delegate_to: "{{ inventory_hostname }}"
- assert:
that:
- sync_result.changed == False
@ -93,6 +101,7 @@
dest: '{{output_dir}}/foo.result'
mode: pull
register: sync_result
delegate_to: "{{ inventory_hostname }}"
- assert:
that:
- '''changed'' in sync_result'
@ -118,6 +127,7 @@
dest: '{{output_dir}}/foo.result'
mode: pull
register: sync_result
delegate_to: "{{ inventory_hostname }}"
- assert:
that:
- sync_result.changed == False
@ -134,6 +144,7 @@
- foo.txt
- bar.txt
register: sync_result
delegate_to: "{{ inventory_hostname }}"
- assert:
that:
- sync_result.changed
@ -156,6 +167,7 @@
- name: synchronize files using rsync_path (issue#7182)
synchronize: src={{output_dir}}/foo.txt dest={{output_dir}}/foo.rsync_path rsync_path="sudo rsync"
register: sync_result
delegate_to: "{{ inventory_hostname }}"
- assert:
that:
- '''changed'' in sync_result'
@ -188,6 +200,7 @@
dest: '{{output_dir}}/{{item}}/foo.txt'
with_items:
- directory_a
delegate_to: "{{ inventory_hostname }}"
- name: synchronize files using link_dest
synchronize:
src: '{{output_dir}}/directory_a/foo.txt'
@ -195,6 +208,7 @@
link_dest:
- '{{output_dir}}/directory_a'
register: sync_result
delegate_to: "{{ inventory_hostname }}"
- name: get stat information for directory_a
stat:
path: '{{ output_dir }}/directory_a/foo.txt'