mirror of
https://github.com/ansible/ansible.git
synced 2026-08-01 16:19:10 +02:00
deb822_repository: add include, exclude parameters (#86171)
This commit is contained in:
@@ -0,0 +1,2 @@
|
|||||||
|
minor_changes:
|
||||||
|
- deb822_repository - add include and exclude parameter arguments (https://github.com/ansible/ansible/issues/86155)
|
||||||
@@ -62,6 +62,22 @@ options:
|
|||||||
description:
|
description:
|
||||||
- Tells APT whether the source is enabled or not.
|
- Tells APT whether the source is enabled or not.
|
||||||
type: bool
|
type: bool
|
||||||
|
exclude:
|
||||||
|
description:
|
||||||
|
- Controls which packages C(APT) should exclude from the repository.
|
||||||
|
- Mutually exclusive with O(include).
|
||||||
|
- This option is supported by apt>=3.1.0.
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
|
version_added: '2.21'
|
||||||
|
include:
|
||||||
|
description:
|
||||||
|
- Controls which packages C(APT) should use from the repository.
|
||||||
|
- Mutually exclusive with O(exclude).
|
||||||
|
- This option is supported by apt>=3.1.0.
|
||||||
|
type: list
|
||||||
|
elements: str
|
||||||
|
version_added: '2.21'
|
||||||
inrelease_path:
|
inrelease_path:
|
||||||
description:
|
description:
|
||||||
- Determines the path to the C(InRelease) file, relative to the normal
|
- Determines the path to the C(InRelease) file, relative to the normal
|
||||||
@@ -419,6 +435,14 @@ def main():
|
|||||||
'enabled': {
|
'enabled': {
|
||||||
'type': 'bool',
|
'type': 'bool',
|
||||||
},
|
},
|
||||||
|
'exclude': {
|
||||||
|
'elements': 'str',
|
||||||
|
'type': 'list',
|
||||||
|
},
|
||||||
|
'include': {
|
||||||
|
'elements': 'str',
|
||||||
|
'type': 'list',
|
||||||
|
},
|
||||||
'inrelease_path': {
|
'inrelease_path': {
|
||||||
'type': 'str',
|
'type': 'str',
|
||||||
},
|
},
|
||||||
@@ -480,6 +504,9 @@ def main():
|
|||||||
'default': 'present',
|
'default': 'present',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
mutually_exclusive=[
|
||||||
|
['exclude', 'include']
|
||||||
|
],
|
||||||
supports_check_mode=True,
|
supports_check_mode=True,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -34,6 +34,80 @@
|
|||||||
name: ansible-test local
|
name: ansible-test local
|
||||||
state: absent
|
state: absent
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: Remove repo
|
||||||
|
deb822_repository:
|
||||||
|
name: debian
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
- deb822_repository:
|
||||||
|
name: debian
|
||||||
|
types: deb
|
||||||
|
uris: file:{{ repodir }}
|
||||||
|
suites: stable
|
||||||
|
components:
|
||||||
|
- main
|
||||||
|
architectures: all
|
||||||
|
exclude:
|
||||||
|
- foo
|
||||||
|
trusted: yes
|
||||||
|
register: deb822_add_repo
|
||||||
|
|
||||||
|
- name: Update apt cache
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
when: deb822_add_repo is changed
|
||||||
|
|
||||||
|
- name: Install package from local repo
|
||||||
|
apt:
|
||||||
|
name: foo=1.0.0
|
||||||
|
register: deb822_install_pkg_exclude
|
||||||
|
ignore_errors: true
|
||||||
|
|
||||||
|
- name: Check if package was not installed
|
||||||
|
shell: dpkg-query -l foo
|
||||||
|
register: deb822_install_pkg_exclude_result
|
||||||
|
ignore_errors: true
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- deb822_install_pkg_exclude is failed
|
||||||
|
- "'no packages found matching foo' in deb822_install_pkg_exclude_result.stderr"
|
||||||
|
|
||||||
|
- deb822_repository:
|
||||||
|
name: debian
|
||||||
|
types: deb
|
||||||
|
uris: file:{{ repodir }}
|
||||||
|
suites: stable
|
||||||
|
components:
|
||||||
|
- main
|
||||||
|
architectures: all
|
||||||
|
include:
|
||||||
|
- foobar
|
||||||
|
trusted: yes
|
||||||
|
register: deb822_add_repo
|
||||||
|
|
||||||
|
- name: Update apt cache
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
when: deb822_add_repo is changed
|
||||||
|
|
||||||
|
- name: Install package from local repo
|
||||||
|
apt:
|
||||||
|
name: foobar=1.0.1
|
||||||
|
register: deb822_install_pkg_include
|
||||||
|
|
||||||
|
- name: Check if package was installed
|
||||||
|
shell: dpkg-query -l foobar
|
||||||
|
register: deb822_install_pkg_include_result
|
||||||
|
|
||||||
|
when: (ansible_facts["distribution"] == 'Ubuntu' and ansible_facts["distribution_version"] is version('25.10', '>=')) or (ansible_lsb["id"] == 'Debian' and 'sid' in ansible_lsb["description"] )
|
||||||
|
always:
|
||||||
|
- name: Remove repo
|
||||||
|
deb822_repository:
|
||||||
|
name: debian
|
||||||
|
state: absent
|
||||||
|
|
||||||
|
|
||||||
- assert:
|
- assert:
|
||||||
that:
|
that:
|
||||||
- deb822_install_repo is changed
|
- deb822_install_repo is changed
|
||||||
|
|||||||
Reference in New Issue
Block a user