[ansible-project] Work around needed for possible bug.

2022-08-13 Thread Ian Hobson

Hi,

I have a playbook, with a task that reads:

# set up ssh access to bitbucket
- name: setup access to bitbucket
  import_role:
name: bitbucketSetup
  creates: /home/ian/.ssh/id_rsa.pub
# so skipped if executed elsewhere

This fails with the error
"conflicting action statements: import_role, creates"

I have tried "include_role" which also errors "conflicting action 
statements".


Just for the record, the role does indeed create the file, and I do only 
want it run if the file does not exist. I think the error is a bug, but 
I am not familiar enough with Ansible, to be sure.


The setup may have been run in a previous playbook,
or from a role earlier in this playbook, or even on an earlier run of 
this playbook. In these cases it should not be run again.


How can I do this, without using stat, register and testing the result, 
which is horribly slow.


Many thanks

Ian


--
You received this message because you are subscribed to the Google Groups "Ansible 
Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/82fa081d-a02e-4d70-ebd4-af6b8a616c80%40gmail.com.


Re: [ansible-project] Error- When Condition

2022-08-13 Thread Vladimir Botka
On Sat, 13 Aug 2022 17:58:02 -0400
Nico Kadel-Garcia  wrote:

> On Fri, Aug 12, 2022 at 2:48 AM Vladimir Botka  wrote:
> >
> > On Fri, 12 Aug 2022 11:01:01 +0500
> > farrukh ahmed  wrote:
> >  
> > > *What I'm trying to achieve is that;*
> > > *1) Check if any job process is running.*
> > > *2) If the job process found running then; first stop the process and then
> > > remove the process.*  
> >
> > Use *pkill*
> > https://www.commandlinux.com/man-page/man1/pkill.1.html
> 
> pkill is a useful tool, and a dangerous one if other processes may
> have matching names. Use it cautiously.

Right. Probably it would be good to add that cautious usage here
includes running *pgrep* first and see whether the selected processes
are what you really want. This is the reason why *pgrep/pkill* come
together.

FWIW. See the playbook for testing asynchronous scripts and signals
https://gist.github.com/vbotka/755c3c4fea3d7afb54406412325a3f12


-- 
Vladimir Botka

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/20220814014019.7ee02329%40gmail.com.


pgp2DwgwJ2c6j.pgp
Description: OpenPGP digital signature


Re: [ansible-project] Error- When Condition

2022-08-13 Thread Nico Kadel-Garcia
On Fri, Aug 12, 2022 at 2:48 AM Vladimir Botka  wrote:
>
> On Fri, 12 Aug 2022 11:01:01 +0500
> farrukh ahmed  wrote:
>
> > *What I'm trying to achieve is that;*
> > *1) Check if any job process is running.*
> > *2) If the job process found running then; first stop the process and then
> > remove the process.*
>
> Use *pkill*
> https://www.commandlinux.com/man-page/man1/pkill.1.html
>
> --
> Vladimir Botka

pkill is a useful tool, and a dangerous one if other processes may
have matching names. Use it cautiously.

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/CAOCN9rzSpW0ReL6dOv1E%3DjpMuH4%3D240UEnw7HbQSUa6kz5ZRbg%40mail.gmail.com.