On 16.05.2018 22:06, jeyyu2003 wrote:
Hi, I am trying to use Ansible to reference a file to populate
variables
onto my mail playbook and having issues. Inline and using Jinja
templates
work but not with this specific configuration.
Here's my main loop3.yml file
# Add Servers
- name: Add Server Objects from a loop
hosts: dev_servers
gather_facts: false
vars_files:
- server_vars2.yml
tasks:
- name: Create Server "{{ item.svrname }}"
delegate_to: localhost
server:
name: "{{ item.svrname }}"
ipaddress: "{{ item.svrip }}"
state: present
comment: Apache Server "{{ item.svrname }}" with IP "{{
item.svrip }}"
with_items: "{ { serverlist } }"
What sticks out as a sore thumb is the last line, there should not be
any space between {{ and }}.
And for the record, you should be consistent with your indentation, YAML
only support spaces and you should the same amount of spaces for the
indentation.
After the vars_files: you use 2 spaces, but after the tasks: you use 4
spaces.
This does not create a problem for you in this example, but for the
future it is a bad idea to not keep the indentation uniform.
--
Kai Stian Olstad
--
You received this message because you are subscribed to the Google Groups "Ansible
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/7d928b3d4577cbaf1e68fbf6956ad010%40olstad.com.
For more options, visit https://groups.google.com/d/optout.