Description
A simple addon introducing support for ansible execution directly from your deploy and build projectsMain features:
- support for main commands ansible and ansible-playbook
- automatic cleanup of child processes from ansible
In order to use the plugin you will need to install ansible of the agent and ensure it is in the system path.
Global settings under addon configuration is allowing you to change generic settings, customizable variables and filter environments where custom deployment is allowed.
In order to trigger a custom deployment use Ansible deployment from main menu. This will allow you to choose hosts/tags that will be used by the Ansible playbook run.
Initially the hosts and tags lists will be empty but after the first run things should get populated.
Note: the plugin will be using regular output and parse it in order to gather HOSTS and TAGS. If this output has been formatted using some callback please provide a sample and we will include it in the plugin for parsing.
This comment has been removed by a blog administrator.
ReplyDeleteWhy is it not using the ssh key from the user running bamboo? Is there a way to use key authentication without providing it in the task?
ReplyDelete
DeleteI never provide the keys inside bamboo plugin. I only specify in inventory the servers and keys like ~/.ssh/xsa.pem or just server address
Also make sure the bamboo agent user is trusted by remote server.
The bamboo agent user is trusted by remote server, but it seams that the way ansible gets called from bamboo the key in my case ~/.ssh/id_ecdsa is not used, when I login as the bamboo agent user and ssh to the remote server I can login with the ssh key.
DeleteMy bad, as usual the problem sits in front of the pc, after going through with -vvvv I got the problem, I forgot to set the remote_user to root.
DeleteThis comment has been removed by the author.
ReplyDeleteHi, there. I uploaded the PEM via the task, public key has been deployed to the target server, but I'm still getting the ERROR 13(host key cannot be verified)
ReplyDeleteTry to add -vvvv to the options of the ansible deploy task to see more information. I would check few things like: permissions of the authorized_keys, enabled key types on the server (like is rsa, dsa enabled depending on your key) etc. The flag -vvvv should give more info about what is wrong.
DeleteThanks! I got it working with the default ssh key, id_rsa....what if i have a different key pair with name like "ansible", how can I specify the task to use this key?
DeleteI put in inventory something like this:
Delete[bastionhosts]
1.1.1.1 ansible_ssh_private_key_file=~/.ssh/bastion.pem ansible_ssh_user=ec2-user
Thanks a lot... I will give it a try
DeleteThis comment has been removed by a blog administrator.
ReplyDeleteI'm a little confused on how to use this. I have a playbook already written - do I have to copy and paste it's contents into the configuration of the task or can I just reference the playbook through this task?
ReplyDeleteAlso, if I can use a playbook on the agent's filesystem (or pull one down from Bitbucket), where does that path go?
Deleteyou can just reference the file. the adhoc playbook is just a separate capability so you can write playbooks in bamboo, just make sure only one is used, filename or inline.
DeleteOk thanks. When I try to add an Ansible Playbook task to a deploy job I get the nasty red message at the top:
DeleteNo agents meet the Environments's requirements.
What do I need to add so the agent knows it can run this? Sorry for the newbie questions - I'm totally new to CI/CD and am on the Infrastructure team ;)
the system should have ansible installed and available in the path so capability can be detected.
DeleteWill the plugin supports Ansible Tower?
ReplyDeleteThe plugin is not using Tower at the moment, do you see any benefits of this integration ? We can think about it as a feature request and see where it leads :)
Delete