1). Send all your user input to ansible playbook command using —extra-vars. 
You can also pass as json and yaml file. 


Example:  # ansible-playbook  site.yml —extra-vars 
“http_server_root=/var/www/html  http_listen=8080 http_user=apache 
http_group=apache”


https://docs.ansible.com/ansible/2.7/user_guide/playbooks_variables.html#passing-variables-on-the-command-line


2). Create a template for your http.conf file with variable which you are 
passing via —extra-vars. 


http.conf.j2


ServerRoot {{ http_server_root }}

Listen {{ http_listen }}


User {{ http_user }}

Group {{ http_group }}


3). Use template module to copy the config to target. 


- name: Install main configuration file

  template:

    src: httpd.conf.j2

    dest: /etc/httpd/conf/httpd.conf




On Wednesday, October 31, 2018 at 4:33:37 PM UTC+5:30, nadim mansour wrote:
>
> I have an http.conf where some values will be variables passed by the user 
>
> where should I put the variables and how the file should look can someone 
> advice ?
>

-- 
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/b3f1ada9-cccc-49b1-8d97-9b81304f3b44%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to