Work around needed for possible bug.

23 views
Skip to first unread message

Ian Hobson

unread,
Aug 14, 2022, 12:06:53 AM8/14/22
to ansible...@googlegroups.com
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


Dick Visser

unread,
Aug 14, 2022, 2:29:11 AM8/14/22
to ansible...@googlegroups.com
I think that is the way to go though. 
Neither import_role nor include_role supports 'creates'.
Why would that be 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-proje...@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.
--
Sent from Gmail Mobile

Amit Chettri

unread,
Aug 14, 2022, 6:02:44 AM8/14/22
to ansible...@googlegroups.com
Hi Ian, 

Either your yaml is not properly indented or you have the wrong parameter/action with the module in used. 

What i see from your statement below you have "create" as parameter/action in the import_role. 

Can you confirm the use of creates.  Also it would help if you can kind of put snap of code and error. 

- name: setup access to bitbucket
   import_role:
     name: bitbucketSetup
   creates: /home/ian/.ssh/id_rsa.pub

Regards
Amit. 

Walter Rowe

unread,
Aug 15, 2022, 8:08:27 AM8/15/22
to Ansible Project
Shouldn't the role itself handle whether or not BitBucket is already set up? Shouldn't the role itself be idempotent?
--
Walter Rowe, Chief
Infrastructure Services
Office of Information Systems Management
National Institute of Standards and Technology
United States Department of Commerce

Reply all
Reply to author
Forward
0 new messages