mirror of https://github.com/ansible/ansible.git
fix using templated values for include/import role FA (#80320)
* fix using templated values for include/import role options 'public', 'allow_duplicates', and 'rolespec_validate' * pass templated values without changing the instance * Fix templating by setting always_post_validate to True and calling IncludeRole.post_validate() instead ci_complete * add changelogpull/80375/head
parent
a45dd2a01c
commit
666188892e
@ -0,0 +1,2 @@
|
|||||||
|
bugfixes:
|
||||||
|
- roles - Fix templating ``public``, ``allow_duplicates`` and ``rolespec_validate`` (https://github.com/ansible/ansible/issues/80304).
|
@ -0,0 +1,7 @@
|
|||||||
|
argument_specs:
|
||||||
|
main:
|
||||||
|
short_description: The main entry point for dup_allowed_role
|
||||||
|
options:
|
||||||
|
optional_int:
|
||||||
|
type: int
|
||||||
|
description: An integer value
|
@ -0,0 +1 @@
|
|||||||
|
- debug: msg='Running role_with_argspec'
|
@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
- name: test templating allow_duplicates, public, and rolespec_validate
|
||||||
|
hosts: localhost
|
||||||
|
gather_facts: false
|
||||||
|
tasks:
|
||||||
|
- name: prevent duplicate roles with a templated value
|
||||||
|
block:
|
||||||
|
- import_role:
|
||||||
|
name: dup_allowed_role
|
||||||
|
allow_duplicates: "{{ False | bool }}"
|
||||||
|
- import_role:
|
||||||
|
name: dup_allowed_role
|
||||||
|
allow_duplicates: "{{ False | bool }}"
|
||||||
|
|
||||||
|
- name: prevent leaky vars with a templated value
|
||||||
|
include_role:
|
||||||
|
name: role1
|
||||||
|
public: "{{ False | bool }}"
|
||||||
|
- assert:
|
||||||
|
that:
|
||||||
|
- where_am_i_defined is undefined
|
||||||
|
|
||||||
|
- name: skip role argspec validation with a templated value
|
||||||
|
include_role:
|
||||||
|
name: role_with_argspec
|
||||||
|
rolespec_validate: "{{ False | bool }}"
|
||||||
|
vars:
|
||||||
|
optional_int: wrong_type
|
Loading…
Reference in New Issue