New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Please apply patch at http://merlin.wl0.org/201305/01/ansible-1.0-extend-patterns.patch to extend pattern matching #3135

Closed
sjmudd opened this Issue Jun 6, 2013 · 5 comments

Comments

Projects
None yet
2 participants
@sjmudd
Contributor

sjmudd commented Jun 6, 2013

See: http://blog.wl0.org/2013/05/extend-ansible-hostnames/

I use ansible to talk to servers at work and the current hostname matching does not cover cases I use where there is more than one "variable" part. Thus to reduce the size of the ansible host file applying this patch allows me to include my hosts (and make the pattern matching more flexible) but in a much more compact ansible file.

I see that this is not in ansible 1.1 (from macports) so hope that perhaps it can be added to the (I believe) upcoming 1.2 version. Patches cleanly against 1.0 and 1.1.

Thanks.

@sjmudd

This comment has been minimized.

Show comment
Hide comment
@sjmudd

sjmudd Jun 6, 2013

Contributor

Example patterns I use are:

[dc3-app]
bc[301:305]app-[01:02]

[dc2-app]
bc[201:205]app-[01:02]

[dc1-app]
bc[101:105]app-[01:02]

[all-app:children]
dc1-app
dc2-app
dc3-app

This generates (with a patched 1.2):

[sjmudd@m7 ~]$ ansible all-app --list-hosts
bc101app-01
bc101app-02
bc102app-01
bc102app-02
bc103app-01
bc103app-02
bc104app-01
bc104app-02
bc105app-01
bc105app-02
bc201app-01
bc201app-02
bc202app-01
bc202app-02
bc203app-01
bc203app-02
bc204app-01
bc204app-02
bc205app-01
bc205app-02
bc301app-01
bc301app-02
bc302app-01
bc302app-02
bc303app-01
bc303app-02
bc304app-01
bc304app-02
bc305app-01
bc305app-02
[sjmudd@m7 ~]$

Contributor

sjmudd commented Jun 6, 2013

Example patterns I use are:

[dc3-app]
bc[301:305]app-[01:02]

[dc2-app]
bc[201:205]app-[01:02]

[dc1-app]
bc[101:105]app-[01:02]

[all-app:children]
dc1-app
dc2-app
dc3-app

This generates (with a patched 1.2):

[sjmudd@m7 ~]$ ansible all-app --list-hosts
bc101app-01
bc101app-02
bc102app-01
bc102app-02
bc103app-01
bc103app-02
bc104app-01
bc104app-02
bc105app-01
bc105app-02
bc201app-01
bc201app-02
bc202app-01
bc202app-02
bc203app-01
bc203app-02
bc204app-01
bc204app-02
bc205app-01
bc205app-02
bc301app-01
bc301app-02
bc302app-01
bc302app-02
bc303app-01
bc303app-02
bc304app-01
bc304app-02
bc305app-01
bc305app-02
[sjmudd@m7 ~]$

@sjmudd

This comment has been minimized.

Show comment
Hide comment
@sjmudd

sjmudd Jun 6, 2013

Contributor

(sorry patched 1.1). Note hostnames slightly adjusted but you get the idea. Usage of this type of pattern is real.

Contributor

sjmudd commented Jun 6, 2013

(sorry patched 1.1). Note hostnames slightly adjusted but you get the idea. Usage of this type of pattern is real.

@mpdehaan

This comment has been minimized.

Show comment
Hide comment
@mpdehaan

mpdehaan Jun 6, 2013

Contributor

Contributions should be made via github pull requests.

Contributor

mpdehaan commented Jun 6, 2013

Contributions should be made via github pull requests.

@mpdehaan mpdehaan closed this Jun 6, 2013

@mpdehaan

This comment has been minimized.

Show comment
Hide comment
@mpdehaan

mpdehaan Jun 6, 2013

Contributor

Happy to review this, just send me a PR.

It's very hard to do code review on a blog post or if everyone did it a different way.

See tips here: https://help.github.com/articles/using-pull-requests

Contributor

mpdehaan commented Jun 6, 2013

Happy to review this, just send me a PR.

It's very hard to do code review on a blog post or if everyone did it a different way.

See tips here: https://help.github.com/articles/using-pull-requests

@sjmudd

This comment has been minimized.

Show comment
Hide comment
@sjmudd

sjmudd Jun 6, 2013

Contributor

Hi Michael, thanks for responding. I'm not familiar with github usage which is why I thought a simple link to a url with the diff would be sufficient. I have attempted to create a pull request. I hope this has been done correctly.

Contributor

sjmudd commented Jun 6, 2013

Hi Michael, thanks for responding. I'm not familiar with github usage which is why I thought a simple link to a url with the diff would be sufficient. I have attempted to create a pull request. I hope this has been done correctly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment