Nginx: Tag 'role::nginx:servers' no more applied?
Nobody has claimed this yet.
- Dominant language
- Jinja
- Stars
- 1.4k
- Forks
- 379
- Avg merge
- 4d 18h
- Merged PRs (30d)
- 8
Description
Running a playbook with -t role::nginx:servers won't run the tasks included by include_tasks (by example nginx_servers.yml):
ansible-playbook playbooks/web.yml --diff -l glpi-test01 -t role::nginx:servers
#...
TASK [debops.debops.nginx : Generate nginx conf.d/ files] ****************************************************
included: /home/mathieu/.../debops/debops/roles/nginx/tasks/nginx_configs.yml for glpi-test01
TASK [debops.debops.nginx : Generate nginx server configuration] ****************************************************
included: /home/mathieu/.../debops/debops/roles/nginx/tasks/nginx_servers.yml for glpi-test01
PLAY RECAP ****************************************************
glpi-test01 : ok=5 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0
Adding apply parameter to tasks seems to fixes the problem:
- name: Generate nginx server configuration
- ansible.builtin.include_tasks: 'nginx_servers.yml'
+ ansible.builtin.include_tasks:
+ file: 'nginx_servers.yml'
+ apply:
+ tags: [ 'role::nginx:servers' ]
tags: [ 'role::nginx:servers' ]
when: (nginx__deploy_state in ['present', 'config'])
The tasks now get included and played correctly.
It seems that this has changed since Debops moved from include to ansible.builtin.include_tasks, maybe?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in ansible/roles/nginx/tasks/main.yml at the include_tasks entries for nginx_configs.yml and nginx_servers.yml, then review the included task files. Reproduce the reported playbook command with the role::nginx:servers tag and verify that the nginx server configuration tasks are executed; done means the tag works as described without unrelated tasks running.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- ansible
- Domain
- devops
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100