Dak*_*kar 0 ansible ansible-playbook
I have the following problem:
A host_var defining my nginx sites (excerpt):
nginx_sites:
- server:
name: site1
location1:
config:
name: "/"
[...]
- server:
name: site2
location1:
config:
name: "/"
[...]
location2:
config:
name: "/secretspace"
[...]
htaccess:
username:
password: somepassword
Run Code Online (Sandbox Code Playgroud)
In this example I have 2 sites. The second one has two locations where the second one has a subelement named "htaccess". This is what I want to use in order to create an corresponding htaccess file.
I tried this ansible task:
- name: Creating htaccess files if nessecary
debug: msg="Huhu {{ item.0.name }} {{ item.1 }}"
with_subelements:
- "{{ nginx_sites }}"
- "htaccess"
- flags:
skip_missing: True
Run Code Online (Sandbox Code Playgroud)
This should imho print a debug statement, when there is a subelement named "htaccess" element in nginx_sites or skip if it is not there.
But nothing happens:
TASK [nginx : Creating htaccess files if nessecary] ****************************
task path: /home/dakky/devzone/ansible-cfg-mgmt/roles/nginx/tasks/main.yml:65
PLAY RECAP *********************************************************************
hostname : ok=1 changed=0 unreachable=0 failed=0
Run Code Online (Sandbox Code Playgroud)
Any idea what I'm doing wrong here?
这对我有用
- name: Creating htaccess files if nessecary
debug: msg="Huhu {{ item.0.name }} {{ item.1 }}"
with_subelements:
- "{{ nginx_sites }}"
- "htaccess"
- skip_missing: True
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5115 次 |
| 最近记录: |