Please help to design layout for ansible

41 views
Skip to first unread message

Serega Sheypak

unread,
May 1, 2015, 8:19:36 AM5/1/15
to ansible...@googlegroups.com
Hi, I'm trying to pick correct roles layout and can't find solution.
The task is to install spark.
There are three roles:

-install-spark-base (install spark-core package)
-install-spark-configuration (puts configuration shared by all spark services)
-install-spark-service-XXX (where XXX master, worker, history, jobserver) (installs concrete spark service)

- hosts: sparkworkers
  user: "{{ sudoUser }}"
  sudo: True
  roles:
    - install-spark-worker

install-spark-worker depends on install-spark-configuration
install-spark-configuration depends on install-spark-base 

So when install-spark-worker role is played, ansible runs
-install-spark-base
then
-install-spark-configuration
then
-install-spark-worker

Looks nice, basement, configuration and concrete service are separated.
BUT
I want install-spark-configuration to restart services each time configuration changes. When I do first run install-spark-configuration tries to restart absent service, since concrete service is installed AFTER configuration.
What is the right way to resolve such collision?

Giovanni Tirloni

unread,
May 1, 2015, 8:55:32 AM5/1/15
to ansible...@googlegroups.com
On Fri, 01 May 2015 05:19 -0700, Serega Sheypak
<serega....@gmail.com> wrote:
> Hi, I'm trying to pick correct roles layout and can't find solution.
> The task is to install spark.
> There are three roles:
>
> -install-spark-base (install spark-core package)
> -install-spark-configuration (puts configuration shared by all spark
> services)
> -install-spark-service-XXX (where XXX master, worker, history, jobserver)
> (installs concrete spark service)
>
> - hosts: sparkworkers
> user: "{{ sudoUser }}"
> sudo: True
> roles:
> - install-spark-worker
>
> install-spark-worker depends on install-spark-configuration
> install-spark-configuration depends on install-spark-base
>
> So when install-spark-worker role is played, ansible runs
> -install-spark-base
> then
> -install-spark-configuration
> then
> -install-spark-worker

I'd just have:

spark (install packages, shared configuration, etc)
spark-master (specific packages, files, etc)
spark-worker
spark-jobserver
....


>
> Looks nice, basement, configuration and concrete service are separated.
> BUT
> I want install-spark-configuration to restart services each time
> configuration changes. When I do first run install-spark-configuration
> tries to restart absent service, since concrete service is installed
> AFTER
> configuration.
> What is the right way to resolve such collision?

I don't know how Spark works but there must be a way to trigger a
complete restart of all the services involved.

The basic "spark" role could have a task for that. And each
"spark-$service" role would take care of restarting only the service
impacted.

Giovanni
Reply all
Reply to author
Forward
0 new messages