amazon ec2 - How to tell ansible to use different user for different environment? -


i'm building machine on ec2 using ansible. have vagrant test script locally.

here's playbook

- name: provision ec2   hosts:   user: vagrant   sudo: yes   gather_facts: true   vars:     gsutil_user_home: "vagrant" 

if want use playbook ec2 have change user , gsutil_user_home ubuntu work. there anyway can make variable , tell ansible user needs run based on argument?

if these values consistent duration of playbooks, you'd set them group/host vars in inventory, , have different inventories or groups different environments. if want vars , pass them in -e, that's fine too:

- name: provision ec2   hosts:   user: {{ my_ec2_user }}   sudo: yes   gather_facts: true   vars:     gsutil_user_home: {{ gsutil_user_home }} 

Comments

Popular posts from this blog

yii2 - Yii 2 Running a Cron in the basic template -

asp.net - 'System.Web.HttpContext' does not contain a definition for 'GetOwinContext' Mystery -

mercurial graft feature, can it copy? -