On 03.01.2020 17:43, Mauricio Tavares wrote:
> Easy question of the day:
The answer might not be ;-)
> so I have a package I want to build
> from source. To do so I need to run config feeding some custom
> parameters, which makes me think I cannot then use the make [1]
> module.
You can still use the make module but need to run the configure part in
a separate task.
> So I thought on using the command [2] module instead.
>
> I guess I could do something like
>
> - name: build thing
> command:
> cmd: ./configure --with_that-lib=/path/to/the/lib && make
> args:
> chdir: dev/thing
> creates: dev/thing/thing.o
> register: thing
This will not work with command, since you can't use %%, ||, pipes or
redirect with command module, you would need to use shell module for
that.
> Now, I have been reading [3] and [4] which suggest breaking into
> separate tasks (which I can see the wisdom because it scales up) using
> creates from the command [2] module. How would that work? I mean, I
> expect if I have a command: doing the configuring and another doing
> the making, if one dies, the entire playbook will come to a halt,
> which is something I want.
Default Ansible will stop/halt the play for that host.
> But what value is the creates adding here?
> Only thing I can think of, which is why I use it, is to ensure a
> successful step is not rerun.
Yes, that is the reason.
But it also creates something to be aware off, if you need to change,
remove or add parameter you also need to remove the file so the task is
run again.
> Am I overthinking this (hence why I said this is probably the easiest
> question of the day)?
I leave that up to you to decide (but I have had easier question at work
today).
--
Kai Stian Olstad