Guest User

Untitled

a guest
Sep 19th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.82 KB | None | 0 0
  1. vars:
  2. amazon_linux_ami: "ami-fb8e9292"
  3. user_data_file: "base-ami-userdata.sh"
  4. tasks:
  5. - name: user_data_contents
  6. shell: cat {{ user_data_file }}
  7. register: user_data_action
  8. - name: launch ec2-instance
  9. local_action:
  10. ...
  11. user_data: "{{ user_data_action.stdout }}"
  12.  
  13. user_data: "{{ lookup('file', user_data_file) }}"
  14.  
  15. - hosts: all
  16. vars:
  17. contents: "{{ lookup('file', '/etc/foo.txt') }}"
  18. tasks:
  19. - debug: msg="the value of foo.txt is {{ contents }}"
  20.  
  21. vars:
  22. amazon_linux_ami: "ami-fb8e9292"
  23. user_data_file: "base-ami-userdata.sh"
  24. tasks:
  25. - name: Load data
  26. slurp:
  27. src: "{{ user_data_file }}"
  28. register: slurped_user_data
  29. - name: Decode data and store as fact # You can skip this if you want to use the right hand side directly...
  30. set_fact:
  31. user_data: "{{ slurped_user_data.content | b64decode }}"
Add Comment
Please, Sign In to add comment