On 02. mars 2017 11:27, Dennis Klein wrote:
Hello,
i'm not sure if i understand the Ansible structure correctly and if Ansible
is the best solution for us.
Our scenario: We are a webhosting company with about 200 VMs (and counting) with
mostly individual websites.
We also have 4 server farms where multiple VMs serve one website. (3x
Webserver, 2x Varnish, 2x DB, etc)
We have started to use Ansible and are now at a point where the best
practices from the docs are not usable.
An example for the problem: We have a Jenkins-Server in evey server farm.
So we use a Jenkins Role to install it.
But every instance needs different packages installed for Jenkins to build
the software on it.
So the Task for Ansible to do is to install one package on one Host.
I simply can do that in Puppet or Saltstack, but in Ansible i can't apply a
task to a Host as i know.
How am i supposed to organize this situation?
I think it is not meant to have a role that is only used once or a playbook
for every host.
- name: Install a package on one host
package:
name: <some package>
when: inventory_hostname == 'host.example.com'
A better way might be to set a variable in host_vars/host.example.com.yml
---
packages_to_install_on_jenkins:
- <package one>
- <package two>
The in the role you could do this.
- name: Install some packages needed for Jenkins build
package:
name: "{{ item }}"
with_items: "{{ packages_to_install_on_jenkins }}"
I hope this gives you an idea of how you can solve it in Ansible.
--
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/eec2088c-75c5-9b71-140b-d74cea1f3f82%40olstad.com.
For more options, visit https://groups.google.com/d/optout.