Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/clojure/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
ansible.utils.unsafe_proxy.AnsibleUnsafeT ext object';没有属性_Ansible_Ansible Template - Fatal编程技术网

ansible.utils.unsafe_proxy.AnsibleUnsafeT ext object';没有属性

ansible.utils.unsafe_proxy.AnsibleUnsafeT ext object';没有属性,ansible,ansible-template,Ansible,Ansible Template,我正在尝试修改和使用此httpd ansible角色 我面临pki-tls.yml的问题 这段代码将重现我面临的问题 --- - name: Copy certificates hosts: myhost.domain.com remote_user: user become: yes vars: httpd_vhost_shared_list: - name: emacs fqdn: domain.com path: /va

我正在尝试修改和使用此httpd ansible角色

我面临pki-tls.yml的问题

这段代码将重现我面临的问题

---
- name: Copy certificates
  hosts: myhost.domain.com
  remote_user: user
  become: yes

  vars:
    httpd_vhost_shared_list:
      - name: emacs
        fqdn: domain.com
        path: /var/www/emacs
        acl:
          - 10.10.40.0/24
    pkistore: /home/user/certificates

  tasks:
    - name: Debug
      debug:
        var: httpd_vhost_shared_list

    - name: TLS certs
      copy:
        src: "{{ pkistore }}/{{ item.name }}"
        dest: "/etc/pki/tls/certs/{{ item.name }}"
      with_items:
        - "{{ httpd_vhost_shared_list }}.crt"
        - "{{ httpd_vhost_shared_list }}-CAChain.crt"

    - name: TLS key
      copy:
        src: "{{ pkistore }}/{{ item.name }}"
        dest: "/etc/pki/tls/private/{{ item.name }}"
      with_items:
        - "{{ httpd_vhost_shared_list }}.key"
运行playbook时,出现以下错误:

该任务包括一个带有未定义变量的选项。错误是:“ansible.utils.unsafe\u proxy.AnsibleUnsafeT” ext对象“”没有属性“name”

但是,变量已定义。如何访问变量httpd_vhost_shared_列表中的名称


欢迎任何反馈。

同时,我发现将“TLS证书”分为两个剧本很简单。一个用于服务器证书,另一个用于链证书

    - name: TLS certificate
      copy:
        src: "{{ pkistore }}/{{ item.name }}.crt"
        dest: "/etc/pki/tls/certs/{{ item.name }}.crt"
      with_items:
        - "{{ httpd_vhost_shared_list }}"

    - name: TLS chain
      copy:
        src: "{{ pkistore }}/{{ item.name }}-CAChain.crt"
        dest: "/etc/pki/tls/certs/{{ item.name }}-CAChain.crt"
      with_items:
        - "{{ httpd_vhost_shared_list }}"

    - name: TLS key
      copy:
        src: "{{ pkistore }}/{{ item.name }}.key"
        dest: "/etc/pki/tls/private/{{ item.name }}.key"
      with_items:
        - "{{ httpd_vhost_shared_list }}"

大家好,欢迎来到SO。请把这个做成一个。完成。谢谢你的提示。