mirror of
https://github.com/ansible-collections/ansible.posix.git
synced 2026-01-11 23:25:28 +01:00
Compare commits
20 commits
d116db1420
...
4c2a034318
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4c2a034318 | ||
|
|
5ceb40b600 | ||
|
|
2cec8cbed5 | ||
|
|
1b8aeb03cb | ||
|
|
ed3d322fd5 | ||
|
|
d9f54eb9d4 | ||
|
|
c401a5d331 | ||
|
|
94059765b6 | ||
|
|
48c2e9310e | ||
|
|
0a58f59906 | ||
|
|
892c045679 | ||
|
|
793518be3c | ||
|
|
b4fe18e6ff | ||
|
|
e72424ae50 | ||
|
|
6afd4cdcf1 | ||
|
|
ee7748732c | ||
|
|
1e0654f8b6 | ||
|
|
fe7dd71bda | ||
|
|
1a4c2051e8 | ||
|
|
8bb61047f8 |
8 changed files with 84 additions and 27 deletions
|
|
@ -122,14 +122,14 @@ stages:
|
||||||
parameters:
|
parameters:
|
||||||
testFormat: devel/linux/{0}/1
|
testFormat: devel/linux/{0}/1
|
||||||
targets:
|
targets:
|
||||||
- name: Fedora 40
|
- name: Fedora 41
|
||||||
test: fedora40
|
test: fedora41
|
||||||
- name: Ubuntu 22.04
|
- name: Ubuntu 22.04
|
||||||
test: ubuntu2204
|
test: ubuntu2204
|
||||||
- name: Ubuntu 24.04
|
- name: Ubuntu 24.04
|
||||||
test: ubuntu2404
|
test: ubuntu2404
|
||||||
- stage: Docker_2_18
|
- stage: Docker_2_18
|
||||||
displayName: Docker devel
|
displayName: Docker 2.18
|
||||||
dependsOn: []
|
dependsOn: []
|
||||||
jobs:
|
jobs:
|
||||||
- template: templates/matrix.yml
|
- template: templates/matrix.yml
|
||||||
|
|
@ -152,8 +152,6 @@ stages:
|
||||||
targets:
|
targets:
|
||||||
- name: Fedora 39
|
- name: Fedora 39
|
||||||
test: fedora39
|
test: fedora39
|
||||||
- name: Ubuntu 20.04
|
|
||||||
test: ubuntu2004
|
|
||||||
- name: Ubuntu 22.04
|
- name: Ubuntu 22.04
|
||||||
test: ubuntu2204
|
test: ubuntu2204
|
||||||
- stage: Docker_2_16
|
- stage: Docker_2_16
|
||||||
|
|
@ -168,8 +166,6 @@ stages:
|
||||||
test: centos7
|
test: centos7
|
||||||
- name: Fedora 38
|
- name: Fedora 38
|
||||||
test: fedora38
|
test: fedora38
|
||||||
- name: Ubuntu 20.04
|
|
||||||
test: ubuntu2004
|
|
||||||
- name: Ubuntu 22.04
|
- name: Ubuntu 22.04
|
||||||
test: ubuntu2204
|
test: ubuntu2204
|
||||||
|
|
||||||
|
|
@ -187,8 +183,6 @@ stages:
|
||||||
test: fedora37
|
test: fedora37
|
||||||
- name: openSUSE 15 py3
|
- name: openSUSE 15 py3
|
||||||
test: opensuse15
|
test: opensuse15
|
||||||
- name: Ubuntu 20.04
|
|
||||||
test: ubuntu2004
|
|
||||||
- name: Ubuntu 22.04
|
- name: Ubuntu 22.04
|
||||||
test: ubuntu2204
|
test: ubuntu2204
|
||||||
|
|
||||||
|
|
@ -201,14 +195,14 @@ stages:
|
||||||
parameters:
|
parameters:
|
||||||
testFormat: devel/{0}/1
|
testFormat: devel/{0}/1
|
||||||
targets:
|
targets:
|
||||||
- name: RHEL 9.4
|
- name: RHEL 9.5
|
||||||
test: rhel/9.4
|
test: rhel/9.5
|
||||||
- name: FreeBSD 14.1
|
- name: FreeBSD 14.2
|
||||||
test: freebsd/14.1
|
test: freebsd/14.2
|
||||||
- name: FreeBSD 13.4
|
- name: FreeBSD 13.5
|
||||||
test: freebsd/13.4
|
test: freebsd/13.5
|
||||||
- stage: Remote_2_18
|
- stage: Remote_2_18
|
||||||
displayName: Remote devel
|
displayName: Remote 2.18
|
||||||
dependsOn: []
|
dependsOn: []
|
||||||
jobs:
|
jobs:
|
||||||
- template: templates/matrix.yml
|
- template: templates/matrix.yml
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,2 @@
|
||||||
|
minor_changes:
|
||||||
|
- synchronize - add the ``quiet`` option to suppress non-error messages (https://github.com/ansible-collections/ansible.posix/issues/171).
|
||||||
2
changelogs/fragments/618_ci_remove_ubuntu2004.yml
Normal file
2
changelogs/fragments/618_ci_remove_ubuntu2004.yml
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
trivial:
|
||||||
|
- Remove ubuntu20.04 from CI tests (https://github.com/ansible-collections/ansible.posix/issues/612).
|
||||||
|
|
@ -8,7 +8,6 @@
|
||||||
from __future__ import absolute_import, division, print_function
|
from __future__ import absolute_import, division, print_function
|
||||||
__metaclass__ = type
|
__metaclass__ = type
|
||||||
|
|
||||||
|
|
||||||
DOCUMENTATION = r'''
|
DOCUMENTATION = r'''
|
||||||
---
|
---
|
||||||
module: synchronize
|
module: synchronize
|
||||||
|
|
@ -204,6 +203,12 @@ options:
|
||||||
description: Internal use only. See O(use_ssh_args) for ssh arg settings.
|
description: Internal use only. See O(use_ssh_args) for ssh arg settings.
|
||||||
type: str
|
type: str
|
||||||
required: false
|
required: false
|
||||||
|
quiet:
|
||||||
|
description:
|
||||||
|
- This option specifies quiet option which on true suppresses the output.
|
||||||
|
type: bool
|
||||||
|
default: false
|
||||||
|
version_added: 1.6.0
|
||||||
|
|
||||||
notes:
|
notes:
|
||||||
- C(rsync) must be installed on both the local and remote host.
|
- C(rsync) must be installed on both the local and remote host.
|
||||||
|
|
@ -361,6 +366,12 @@ EXAMPLES = r'''
|
||||||
src: /tmp/localpath/
|
src: /tmp/localpath/
|
||||||
dest: /tmp/remotepath
|
dest: /tmp/remotepath
|
||||||
rsync_path: /usr/gnu/bin/rsync
|
rsync_path: /usr/gnu/bin/rsync
|
||||||
|
|
||||||
|
- name: Synchronization with quiet option enabled
|
||||||
|
ansible.posix.synchronize:
|
||||||
|
src: some/relative/path
|
||||||
|
dest: /some/absolute/path
|
||||||
|
quiet: true
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -438,6 +449,7 @@ def main():
|
||||||
delay_updates=dict(type='bool', default=True),
|
delay_updates=dict(type='bool', default=True),
|
||||||
mode=dict(type='str', default='push', choices=['pull', 'push']),
|
mode=dict(type='str', default='push', choices=['pull', 'push']),
|
||||||
link_dest=dict(type='list', elements='path'),
|
link_dest=dict(type='list', elements='path'),
|
||||||
|
quiet=dict(type='bool', default=False)
|
||||||
),
|
),
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
|
@ -478,6 +490,7 @@ def main():
|
||||||
verify_host = module.params['verify_host']
|
verify_host = module.params['verify_host']
|
||||||
link_dest = module.params['link_dest']
|
link_dest = module.params['link_dest']
|
||||||
delay_updates = module.params['delay_updates']
|
delay_updates = module.params['delay_updates']
|
||||||
|
quiet = module.params['quiet']
|
||||||
|
|
||||||
if '/' not in rsync:
|
if '/' not in rsync:
|
||||||
rsync = module.get_bin_path(rsync, required=True)
|
rsync = module.get_bin_path(rsync, required=True)
|
||||||
|
|
@ -602,6 +615,9 @@ def main():
|
||||||
|
|
||||||
cmd.append(shlex_quote(source))
|
cmd.append(shlex_quote(source))
|
||||||
cmd.append(shlex_quote(dest))
|
cmd.append(shlex_quote(dest))
|
||||||
|
if quiet:
|
||||||
|
cmd.append('--quiet')
|
||||||
|
|
||||||
cmdstr = ' '.join(cmd)
|
cmdstr = ' '.join(cmd)
|
||||||
|
|
||||||
# If we are using password authentication, write the password into the pipe
|
# If we are using password authentication, write the password into the pipe
|
||||||
|
|
@ -634,14 +650,17 @@ def main():
|
||||||
out_lines = out_clean.split('\n')
|
out_lines = out_clean.split('\n')
|
||||||
while '' in out_lines:
|
while '' in out_lines:
|
||||||
out_lines.remove('')
|
out_lines.remove('')
|
||||||
if module._diff:
|
|
||||||
diff = {'prepared': out_clean}
|
|
||||||
return module.exit_json(changed=changed, msg=out_clean,
|
|
||||||
rc=rc, cmd=cmdstr, stdout_lines=out_lines,
|
|
||||||
diff=diff)
|
|
||||||
|
|
||||||
return module.exit_json(changed=changed, msg=out_clean,
|
result = dict(changed=changed, rc=rc, cmd=cmdstr, stdout_lines=out_lines, msg=out_clean)
|
||||||
rc=rc, cmd=cmdstr, stdout_lines=out_lines)
|
|
||||||
|
if quiet:
|
||||||
|
changes = out.count(changed_marker) if changed else 0
|
||||||
|
result['msg'] = "%s files/directories have been synchronized" % changes
|
||||||
|
|
||||||
|
if module._diff:
|
||||||
|
result['diff'] = {'prepared': out_clean}
|
||||||
|
|
||||||
|
return module.exit_json(**result)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
|
||||||
|
|
@ -80,6 +80,13 @@ EXAMPLES = r'''
|
||||||
sysctl_file: /tmp/test_sysctl.conf
|
sysctl_file: /tmp/test_sysctl.conf
|
||||||
reload: false
|
reload: false
|
||||||
|
|
||||||
|
# Enable resource limits management in FreeBSD
|
||||||
|
- ansible.posix.sysctl:
|
||||||
|
name: kern.racct.enable
|
||||||
|
value: '1'
|
||||||
|
sysctl_file: /boot/loader.conf
|
||||||
|
reload: false
|
||||||
|
|
||||||
# Set ip forwarding on in /proc and verify token value with the sysctl command
|
# Set ip forwarding on in /proc and verify token value with the sysctl command
|
||||||
- ansible.posix.sysctl:
|
- ansible.posix.sysctl:
|
||||||
name: net.ipv4.ip_forward
|
name: net.ipv4.ip_forward
|
||||||
|
|
|
||||||
2
tests/integration/inventory
Normal file
2
tests/integration/inventory
Normal file
|
|
@ -0,0 +1,2 @@
|
||||||
|
[testgroup]
|
||||||
|
testhost ansible_connection="local" ansible_pipelining="yes" ansible_python_interpreter="/Users/mandkulk/venv3.9/bin/python"
|
||||||
|
|
@ -339,6 +339,37 @@
|
||||||
- stat_result_b.stat.exists == True
|
- stat_result_b.stat.exists == True
|
||||||
- stat_result_b.stat.checksum == '2aae6c35c94fcfb415dbe95f408b9ce91ee846ed'
|
- stat_result_b.stat.checksum == '2aae6c35c94fcfb415dbe95f408b9ce91ee846ed'
|
||||||
|
|
||||||
|
- name: Synchronize files with quiet option
|
||||||
|
ansible.posix.synchronize:
|
||||||
|
src: '{{ output_dir }}/foo.txt'
|
||||||
|
dest: '{{ output_dir }}/foo.result'
|
||||||
|
quiet: true
|
||||||
|
register: sync_result
|
||||||
|
|
||||||
|
- name: Assertion for synchronize with quiet option
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- '''files/directories have been synchronized'' in sync_result.msg'
|
||||||
|
|
||||||
|
- name: Cleanup
|
||||||
|
ansible.builtin.file:
|
||||||
|
state: absent
|
||||||
|
path: '{{ output_dir }}/{{ item }}'
|
||||||
|
loop:
|
||||||
|
- foo.result
|
||||||
|
- bar.result
|
||||||
|
|
||||||
|
- name: Synchronize files without quiet option
|
||||||
|
ansible.posix.synchronize:
|
||||||
|
src: '{{ output_dir }}/foo.txt'
|
||||||
|
dest: '{{ output_dir }}/foo.result'
|
||||||
|
register: sync_result
|
||||||
|
|
||||||
|
- name: Assertion for synchronize without quiet option
|
||||||
|
ansible.builtin.assert:
|
||||||
|
that:
|
||||||
|
- '''files/directories have been synchronized'' not in sync_result.msg'
|
||||||
|
|
||||||
- name: Cleanup
|
- name: Cleanup
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
state: absent
|
state: absent
|
||||||
|
|
|
||||||
|
|
@ -62,15 +62,15 @@ else
|
||||||
retry pip install "https://github.com/ansible/ansible/archive/stable-${ansible_version}.tar.gz" --disable-pip-version-check
|
retry pip install "https://github.com/ansible/ansible/archive/stable-${ansible_version}.tar.gz" --disable-pip-version-check
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export ANSIBLE_COLLECTIONS_PATHS="${PWD}/../../../"
|
export ANSIBLE_COLLECTIONS_PATH="${PWD}/../../../"
|
||||||
|
|
||||||
# START: HACK install dependencies
|
# START: HACK install dependencies
|
||||||
if [ "${ansible_version}" == "2.9" ] || [ "${ansible_version}" == "2.10" ]; then
|
if [ "${ansible_version}" == "2.9" ] || [ "${ansible_version}" == "2.10" ]; then
|
||||||
# Note: Since community.general 5.x, Ansible Core versions prior to 2.11 are not supported.
|
# Note: Since community.general 5.x, Ansible Core versions prior to 2.11 are not supported.
|
||||||
# So we need to use 4.8.1 for Ansible 2.9 and Ansible Engine 2.10.
|
# So we need to use 4.8.1 for Ansible 2.9 and Ansible Engine 2.10.
|
||||||
retry git clone --depth=1 --single-branch -b 4.8.1 https://github.com/ansible-collections/community.general.git "${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/community/general"
|
retry git clone --depth=1 --single-branch -b 4.8.1 https://github.com/ansible-collections/community.general.git "${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/community/general"
|
||||||
else
|
else
|
||||||
retry git clone --depth=1 --single-branch https://github.com/ansible-collections/community.general.git "${ANSIBLE_COLLECTIONS_PATHS}/ansible_collections/community/general"
|
retry git clone --depth=1 --single-branch https://github.com/ansible-collections/community.general.git "${ANSIBLE_COLLECTIONS_PATH}/ansible_collections/community/general"
|
||||||
fi
|
fi
|
||||||
# Note: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
# Note: we're installing with git to work around Galaxy being a huge PITA (https://github.com/ansible/galaxy/issues/2429)
|
||||||
# END: HACK
|
# END: HACK
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue