Discussion:
[Fab-user] Best way to sort and maintain a list of server ?
Vincent Barillere
2014-01-03 16:08:00 UTC
Permalink
Hi,

First of all I wish you a happy new year.


I have my trouble to easily maintain about 70 servers placed in different
groups.

Currently I have a separate file that I import but it is not very
practical because
a server can be found in different groups when adding a server so I need to
add in the different groups.

Do you have any tips to sort and simply maintain a list of server
in fabric
?

Example of my servers.py :

# coding: utf-8

from __future__ import with_statement

from fabric.api import env

env.roledefs = {

#
mutualized servers

'mutualized' : ['
serv
',

'
serv1
',

'
serv
2
',

'
serv
3
',

'
serv
4
',

'
serv
5
',

'
serv
6
'],

#
dedicated servers

'dedicated' : ['
serv0
',

'
serv7
',

'
serv
8
',

'
serv
9
',

'
serv
10
',

'
serv
11
'
]
,

*....*

Thanks for your help,


Regards.
Vincent
Andres Riancho
2014-01-03 16:32:18 UTC
Permalink
After some issues with maintaining lists like that, I decided not to
maintain any. Let me explain... I'm an AWS user, so what I do is to
tag my servers accordingly when they are spawned, and then when I want
to run a command across all my web servers in the production
environment, I simply query the AWS API using boto to retrieve all the
instances which match those tags, get the IP addresses, and then run
the command on them.

On Fri, Jan 3, 2014 at 1:08 PM, Vincent Barillere
Post by Vincent Barillere
Hi,
First of all I wish you a happy new year.
I have my trouble to easily maintain about 70 servers placed in different
groups.
Currently I have a separate file that I import but it is not very practical
because a server can be found in different groups when adding a server so I
need to add in the different groups.
Do you have any tips to sort and simply maintain a list of server
in fabric
?
# coding: utf-8
from __future__ import with_statement
from fabric.api import env
env.roledefs = {
#
mutualized servers
'mutualized' : ['
serv
',
'
serv1
',
'
serv
2
',
'
serv
3
',
'
serv
4
',
'
serv
5
',
'
serv
6
'],
#
dedicated servers
'dedicated' : ['
serv0
',
'
serv7
',
'
serv
8
',
'
serv
9
',
'
serv
10
',
'
serv
11
'
]
,
....
Thanks for your help,
Regards.
Vincent
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
--
Andrés Riancho
Project Leader at w3af - http://w3af.org/
Web Application Attack and Audit Framework
Twitter: @w3af
GPG: 0x93C344F3
Jorge Vargas
2014-01-03 16:37:16 UTC
Permalink
We ended up doing the same thing with boto. That said if you are not using
AWS or you can't have an API.

You could do a naming scheme. For example web1,web2,etc. and dweb1,dweb2,
etc. as the hostname of the machines. Then have code autogenerate that and
only update the list when new machines are added.
Post by Andres Riancho
After some issues with maintaining lists like that, I decided not to
maintain any. Let me explain... I'm an AWS user, so what I do is to
tag my servers accordingly when they are spawned, and then when I want
to run a command across all my web servers in the production
environment, I simply query the AWS API using boto to retrieve all the
instances which match those tags, get the IP addresses, and then run
the command on them.
On Fri, Jan 3, 2014 at 1:08 PM, Vincent Barillere
Post by Vincent Barillere
Hi,
First of all I wish you a happy new year.
I have my trouble to easily maintain about 70 servers placed in different
groups.
Currently I have a separate file that I import but it is not very
practical
Post by Vincent Barillere
because a server can be found in different groups when adding a server
so I
Post by Vincent Barillere
need to add in the different groups.
Do you have any tips to sort and simply maintain a list of server
in fabric
?
# coding: utf-8
from __future__ import with_statement
from fabric.api import env
env.roledefs = {
#
mutualized servers
'mutualized' : ['
serv
',
'
serv1
',
'
serv
2
',
'
serv
3
',
'
serv
4
',
'
serv
5
',
'
serv
6
'],
#
dedicated servers
'dedicated' : ['
serv0
',
'
serv7
',
'
serv
8
',
'
serv
9
',
'
serv
10
',
'
serv
11
'
]
,
....
Thanks for your help,
Regards.
Vincent
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
--
Andrés Riancho
Project Leader at w3af - http://w3af.org/
Web Application Attack and Audit Framework
GPG: 0x93C344F3
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Kevin Horn
2014-01-03 17:54:24 UTC
Permalink
I had a similar situation once, and what I did was to define a mapping with
servers as the keys and a list of groups as the values. e.g.

group_map = {
'serv1' = ['group1', 'group2'],
'serv2' = ['group2', group3],
}

Then I wrote a function to "reverse" that mapping (generate the mapping
that roledefs expects) and assigned the result to roledefs, e.g.

env.roledefs = map_flipper(group_map)

the definition of map_flipper is left to the reader, but it isn't difficult.

Good luck!
Post by Jorge Vargas
We ended up doing the same thing with boto. That said if you are not using
AWS or you can't have an API.
You could do a naming scheme. For example web1,web2,etc. and dweb1,dweb2,
etc. as the hostname of the machines. Then have code autogenerate that and
only update the list when new machines are added.
Post by Andres Riancho
After some issues with maintaining lists like that, I decided not to
maintain any. Let me explain... I'm an AWS user, so what I do is to
tag my servers accordingly when they are spawned, and then when I want
to run a command across all my web servers in the production
environment, I simply query the AWS API using boto to retrieve all the
instances which match those tags, get the IP addresses, and then run
the command on them.
On Fri, Jan 3, 2014 at 1:08 PM, Vincent Barillere
Post by Vincent Barillere
Hi,
First of all I wish you a happy new year.
I have my trouble to easily maintain about 70 servers placed in
different
Post by Vincent Barillere
groups.
Currently I have a separate file that I import but it is not very
practical
Post by Vincent Barillere
because a server can be found in different groups when adding a server
so I
Post by Vincent Barillere
need to add in the different groups.
Do you have any tips to sort and simply maintain a list of server
in fabric
?
# coding: utf-8
from __future__ import with_statement
from fabric.api import env
env.roledefs = {
#
mutualized servers
'mutualized' : ['
serv
',
'
serv1
',
'
serv
2
',
'
serv
3
',
'
serv
4
',
'
serv
5
',
'
serv
6
'],
#
dedicated servers
'dedicated' : ['
serv0
',
'
serv7
',
'
serv
8
',
'
serv
9
',
'
serv
10
',
'
serv
11
'
]
,
....
Thanks for your help,
Regards.
Vincent
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
--
Andrés Riancho
Project Leader at w3af - http://w3af.org/
Web Application Attack and Audit Framework
GPG: 0x93C344F3
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
--
--
Kevin Horn
William Salt
2014-01-03 18:08:49 UTC
Permalink
Hi Vincent,

You could look at using boto and ec2 tags, but i find them somewhat
inflexible.
Instead, i use chef for basic service discovery, and apply roles to nodes.
You can then search for nodes woth a role in an environment.
The pychef library has fabric integration too.

Regards
Will
Hi,

First of all I wish you a happy new year.


I have my trouble to easily maintain about 70 servers placed in different
groups.

Currently I have a separate file that I import but it is not very
practical because
a server can be found in different groups when adding a server so I need to
add in the different groups.

Do you have any tips to sort and simply maintain a list of server
in fabric
?

Example of my servers.py :

# coding: utf-8

from __future__ import with_statement

from fabric.api import env

env.roledefs = {

#
mutualized servers

'mutualized' : ['
serv
',

'
serv1
',

'
serv
2
',

'
serv
3
',

'
serv
4
',

'
serv
5
',

'
serv
6
'],

#
dedicated servers

'dedicated' : ['
serv0
',

'
serv7
',

'
serv
8
',

'
serv
9
',

'
serv
10
',

'
serv
11
'
]
,

*....*

Thanks for your help,


Regards.
Vincent
Vincent Barillere
2014-01-06 08:37:33 UTC
Permalink
Hi,

Unfortunately servers from different host
er
so I can not use a tag system but the
mapping
solution looks interesting.



Thanks for your helps.

Regards,

Vincent
Post by William Salt
Hi Vincent,
You could look at using boto and ec2 tags, but i find them somewhat
inflexible.
Instead, i use chef for basic service discovery, and apply roles to nodes.
You can then search for nodes woth a role in an environment.
The pychef library has fabric integration too.
Regards
Will
Hi,
First of all I wish you a happy new year.
I have my trouble to easily maintain about 70 servers placed in different
groups.
Currently I have a separate file that I import but it is not very
practical because a server can be found in different groups when adding a
server so I need to add in the different groups.
Do you have any tips to sort and simply maintain a list of server
in fabric
?
# coding: utf-8
from __future__ import with_statement
from fabric.api import env
env.roledefs = {
#
mutualized servers
'mutualized' : ['
serv
',
'
serv1
',
'
serv
2
',
'
serv
3
',
'
serv
4
',
'
serv
5
',
'
serv
6
'],
#
dedicated servers
'dedicated' : ['
serv0
',
'
serv7
',
'
serv
8
',
'
serv
9
',
'
serv
10
',
'
serv
11
'
]
,
*....*
Thanks for your help,
Regards.
Vincent
_______________________________________________
Fab-user mailing list
https://lists.nongnu.org/mailman/listinfo/fab-user
Loading...