Multiple VHost with this Role?
MoBlockbuster opened this issue · 3 comments
Is it possible to create multiple vhost with this role?
example:
I want to create vhost-a.conf with own config and vhost-b.conf with another config
if yes, how can i do this?
I think the simplest way to do this is to just have your own list of files to copy to the server, then have a generic
include *.conf
to pull in all those configurations. Something sorta like this:
First I setup a vars/vhosts.yml file which looks like this:
httpd_conf_files:
- vhost-a.conf
- vhost-b.conf
- vhost-c.conf
and another block for files to remove. I should probably just remove them first and then only install the ones I need.
httpd_confd_files_remove:
- /etc/httpd/conf.d/autoindex.conf
- /etc/httpd/conf.d/userdir.conf
- /etc/httpd/conf.d/welcome.conf
- /etc/httpd/conf.d/ssl.conf
Then in my main playbook.yml I have
-
name: Call geerlingguy.apache role
include_role:
name: geerlingguy.apache -
name: deploy /etc/httpd/conf/httpd.conf
copy:
src: "files/etc/httpd/conf/httpd.conf"
dest: "/etc/httpd/conf/httpd.conf"
owner: root
group: root
mode: 0644
backup: yes
notify: restart apache -
name: deploy /etc/http/conf.d/*.conf configs
copy:
src: "files/etc/httpd/conf.d/{{ item }}"
dest: "/etc/httpd/conf.d/{{ item }}"
owner: root
group: root
mode: 0644
backup: yes
with_items: "{{ httpd_confd_files }}"
notify: restart apache -
name: Remove un-needed /etc/http/conf.d/ files
file:
path: "{{ item }}"
state: absent
force: yes
with_items: "{{ httpd_confd_files_remove }}"
notify: restart apache
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
Please read this blog post to see the reasons why I mark issues as stale.
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.