私は自分の不可解なプレイブックでvarsを使用しようとしています。 ENV
は、コマンドラインからの入力として渡されます。Ancesの引数としてvarsを使用する
---
- hosts: development
sudo: yes
sudo_user: root
vars:
env: "{{ ENV|default('DEV') }}"
roles:
# Copy conf files
- { role: copy, src: ./conf/ems/7000/"{{ env }}"/*.conf , dest: /apps/tibco/config/ems/7000/data/ }
- { role: copy, src: ./conf/ems/7000/"{{ env }}"/*.conf , dest: /apps/tibco/config/ems/7200/data/ }
- { role: copy, src: ./conf/ems/7000/"{{ env }}"/*.conf , dest: /apps/tibco/config/ems/7004/data/ }
私はまだAnsibleで幼児だとして
# Copy conf files
- { role: copy, src: ./conf/ems/7000/" {{env}} "/*.conf , dest: /apps/tibco/config/ems/7000/data/ }
^
We could be wrong, but this one looks like it might be an issue with
missing quotes. Always quote template expression brackets when they
start a value. For instance:
with_items:
- {{ foo }}
Should be written as:
with_items:
- "{{ foo }}"
が答えに明示してください取得
ansible-playbook -e 'ENV=DEV' --ask-sudo-pass install-ems-plybook.yml
コマンドによって、この脚本を実行します。
become_userは1.9でサポートされていますか? –
はい、[docs](https://docs.ansible.com/ansible/become.html#for-those-from-pre-1-9-sudo-and-su-still-work)によると 'become'パラメータは1.9に導入されました。 – techraf