Hello,
I have a template with few variables to be populated, then I am shipping 
that template populated to a another server.

Here is my playbook :

- hosts: dev
  become: yes
  become_method: sudo
  vars:
    username: "{{ username }}"
    ad_username: "{{ ad_username }}"
    vhost_id: "{{ vhost_id }}"
  tasks:
    - name: Ansible Template
      template:
        src: 
/usr/local/cmd-sysadmin/automation/ansible/cmd/files/templates/apache_vhost_api_private_public.j2
        dest: /usr/local/apache2.4/conf/vhosts/v2/{{ vhost_id }}_{{ 
username }}_apis.vhost.conf
    - name: Add vhost to httpd.conf
      shell: echo "Include conf/vhosts/v2/{{ vhost_id }}_{{ username 
}}_apis.vhost.conf" >> /usr/local/apache2.4/conf/httpd.conf

It works well if I call it from command line and I pass all variable via -e 
switch.
Something like : ansible-playbook 
playbooks/apache/create_new_vhost_from_template_dev.yml -K -e 
"username=xxxx ad_username=xxxx.xxx vhost_id=60"

As I have too many vhosts to be created, I got a file from where I would 
like to read content, iterate it, populate variables and push the file.

The file is like this :
5;yyy;yyyyy
70;zzzz;zzz

I can modify the file to include the header, to be , delimited.. whatever. 

Is there anyone that can explain how to do this?

It's hard for me to find something like this on the documentation.

Can anyone help?

Thanks

-- 
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/d2fbfd69-889c-4487-9111-a4bc9e353542%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to