volanja / ansible-sample-tdd

Test Driven Development for Ansible by ServerSpec. It's Sample
94 stars 14 forks source link

how to make host groups #2

Closed montells closed 9 years ago

montells commented 9 years ago

I want to run differente test for differente host

[ubuntu] 172.23.10.22 ansible_ssh_host=172.23.10.22 ansible_ssh_user=test ansible_ssh_pass=test

[centos] 172.23.10.23 ansible_ssh_host=172.23.10.23 ansible_ssh_user=test ansible_ssh_pass=test

[other] 172.23.10.24 ansible_ssh_host=172.23.10.24 ansible_ssh_user=test ansible_ssh_pass=test

[pg] ubuntu centos

[mail] other ubuntu centos

my site.yml

I want rake:pg run in ubuntu and centos hosts and rake:mail run in all hosts.

Therefore I need spec for centos are differents of test for ubuntu. It is possible? How?

volanja commented 9 years ago

I think that it can be what you want. If you know ruby, you can re-write Rakefile and spec/spec_helper.rb.

This sample use ansible_spec that I created rubygems. And ansible_spec don't have function what you want. So , I consider the implementation of the function that you want. I can not tell determine whether the implementation is time.

volanja commented 9 years ago

I create issue on ansible_spec

volanja commented 9 years ago

I update ansible_spec. Please install ansible_spec that Rubygems. And you should change files.

[ubuntu]
172.23.10.22 ansible_ssh_host=172.23.10.22 ansible_ssh_user=test

[centos]
172.23.10.23 ansible_ssh_host=172.23.10.23 ansible_ssh_user=test

[other]
172.23.10.24 ansible_ssh_host=172.23.10.24 ansible_ssh_user=test

[pg:children]
ubuntu
centos

[mail:children]
other
ubuntu
centos

(Not Support ansible_ssh_pass. it's insecure)

- name: pg
  hosts: pg
  user: root
  roles:
    - pg

- name: mail
  hosts: mail
  user: root
  roles:
    - mail