我正在尝试从源代码安装apachehttp,并使用以下编译命令,这导致了上述错误。请帮忙吗?
- name: Install Apache, Version n -- {{ apache_version }})
command: "{{ item }} chdir={{ apache_source_dir }}"
with_items:
- >
./configure --with-apr={{ apr-dir }} --with-apr-util={{ apr_util_dir }}
--enable-mods-shared=all --enable-ssl --enable-so
--with-pcre={{ pcre_dir}}/pcre-config --prefix={{ apache_install_dir }}`
- /usr/bin/make
- /usr/bin/make install
become: yes
错误:
TASK [Install Apache, Version n -- 2.4.43)] ***************************************************
fatal: [physoaapp03-tst]: FAILED! => {"msg": "Unable to look up a name or access an attribute in template string (./configure --with-apr={{ apr-dir }} --with-apr-util={{ apr_util_dir }} --enable-mods-shared=all --enable-ssl --enable-so --with-pcre={{ pcre_dir}}/pcre-config --prefix={{ apache_install_dir }}`n).nMake sure your variable name does not contain invalid characters like '-': unsupported operand type(s) for -: 'StrictUndefined' and 'StrictUndefined'"}
有人能告诉我在哪里需要改进代码吗?感谢
确保变量名不包含无效字符,如'-'
错误已经描述了问题以及如何解决。
将{{ apr-dir }}
更改为{{ apr_dir }}
,依此类推。也更改声明。
请仔细阅读ansible中有关变量名的文档,以避免将来出现此类问题。