include_playbook / include tasks from Bitbucket?

Hi everyone,

short summary: I have a playbook from where I wanna start other playbooks hosted on Bitbucket. In short words: Got a server and want to clone repository on Bitbucket where are all the other playbooks which I want to run on the remote server.

`

There is a git module for this purpose which may work better for you.

https://docs.ansible.com/ansible/latest/modules/git_module.html#git-module

Hi Michael,

thanks for your answer. I’m already using it, it’s in the first code block above.

Best

Sorry, yes, too early for clear thinking. :wink:

I was thinking of ansible-pull. I know Brian Coca that frequents this forum had a github or galaxy entry on the subject some time ago but I can’t seem to find it. But this is a good reference (or you can just do a ‘man ansible-pull’):

http://manpages.ubuntu.com/manpages/trusty/man1/ansible-pull.1.html

Good morning then! :slight_smile:

I’ll take a look. The weird thing is following: The remote server is cloning the files (checked it manually if they’re there) but with “include_tasks” or “import_playbook” I’m not able to execute the playbooks lying around there.

Yeah I have not tried to execute a playbook like that so I don’t have anything to offer there. I’ve done your exact scenerio though using ansible-pull to run a playbook from my BitBucket repo.

Okay, going to take a look on it - thanks. Do you know if it’s possible to use pull on Ansible AWX?

Yes, AWX let you use any kind of remote repo as a data source. Although I have not used it in a couple of years.

Ansible CANNOT read the files on the remote as part of the playbook,
you need to either check them out on the controller (git +
delegate_to: localhost) or 'fetch' them via the module with the same
name.

AWX will just checkout that repo onto the AWX machine and run Ansible
'locally' on those files, either way works

hello,

Once check your file location.