Ansible unlike chef and puppet uses agent less run .
I would like to know is there any ansible remote client so that we can connect to fleet of ansible control machines to execute ansible playbooks on their respective targets .
I am looking for a command line cliient similar to following
ansible-execute hostname_of_control_machine username_of_control_machine password_of_control_machine inventory_file playbook_name
Please suggest if any ?
There is nothing preventing you from using Ansible to run Ansible on other machines. The Python API might be a good place to start, as you can get programmatic control over the initial Ansible runner.
You can do this with SSH
ssh username#controlmachine 'ansible-playbook yourPlaybook.yml
Related
I'm working with Ansible Tower and using Vault credential.
When I launch it using the graphical interface of Ansible Tower (I add the credential when it's prompted), it work well.
When I try with the tower-cli line, I get this message:
{"failed": true, "msg": "Decryption failed (no vault secrets would found t
hat could decrypt)"
I found that I need to add something like --ask-vault-pass but it is listed as an unknown argument when I add to my tower-cli line, so it work only with ansible-playbook command.
How can I ask for vault password with tower-cli?
Thanks in advance.
Please take note that there is a difference between Ansible Engine, the command line tools ansible for ad-hoc commands and ansible-playbook for executing playbooks, and Ansible Tower. According the documentation Ansible Tower is
a GUI and REST interface for Ansible that supercharges it by adding RBAC, centralized logging, autoscaling/provisioning callbacks, graphical inventory editing, and more ... tower-cli is a command line tool for Ansible Tower. It allows Tower commands to be easily run from the Unix command line
As you have already found out
I need to add something like --ask-vault-pass but it is listed as an unknown argument when I add to my tower-cli ... it work only with ansible-playbook command
this is the expected behavior.
The solution lays in the way you have described
When I launch it using the graphical interface of Ansible Tower (I add the credential when it's prompted), it work well
For further automation you will need to configure your Ansible Tower Credentials store and setup a credential of type Vault. Based on the there stored password, AWX will forward the vault password to Ansible Engine. Ansible Engine will then use that password to unlock the vault and your playbook can run.
Further Q&A
Ansible AWX / Tower - Use Vault credential in playbook
Ansible Tower - How to pass Machine credentials as an extra vars to the job template?
I have Jenkins and Ansible Server installed on different window machines .But how to trigger ansible playbook from jenkins
I added Ansible server as a Slave in Jenkins Server . I need solution on how to trigger anisble playbook
from jenkins
Go to Manage Jenkins > Manage Plugins >Available > search Ansible. If you are already installed Ansible Plugin on your Jenkins It will display in the Installed section. Now we can see the Invoke Ansible Playbook option in the Build Environment section but we need to configure Ansible path for Jenkins
I have created two Ubuntu machines on virtual box. I am able to ping the other machine from the terminal of the other.
However when I ping from ansible I get the following error.
My /etc/ansible/hosts file is :
Can I get the solution for this ?
If you read the documentation you will notice:
This is NOT ICMP ping
So the way in which the ping command works and the way in which Ansible module works is different.
Reading further, Ansible ping module is described as:
Try to connect to host, verify a usable Python and return pong on success.
So Ansible tries to connect (and the default connection method is SSH) and execute Python code.
In your case Ansible failed to connect.
SSH connectivity is a prerequisite, so you need to configure that before you'll be able to use Ansible. For Ubuntu 16.04 you might need to additionally install OpenSSH.
Refer to the official guide for the installation and configuration steps.
On top of that, Ubuntu Server 16.04 does not install Python 2 by default, so you need to manually add it (Ansible support for Python 3 is still experimental).
Refer to answers under this question on AskUbuntu.
Then you still might need to set a parameter in the inventory file to tell Ansible to use Python 2. Or make Python 2 the default interpreter.
I've installed Ansible host on my RHEL Linux machine.
I made some configurations changes and I want to restart it but I can't find how it's being done.
I used this manual for installation.
Checking running services I don't see an Ansible service.
How can I restart Ansible?
*NOTE: I installed Ansible from source files.
Ansible is not a service, it is an executable program (actually a few executables) which is called, starts, and ends its execution.
There is no way to restart Ansible other than calling it again. The changes in configuration will be reflected on the next run.
Also: there is no "Ansible host" component. "Ansible control machine" is a general term for the machine you run Ansible executables on.
Similarly Ansible-Pull is also not a service, but a script which is scheduled externally.
try
ps -ef|grep ansible
to double check that there is no ansible service or daemon.
I'm using Vagrant and Ansible to create my Bitbucket Server on Ubuntu 15.10. I have the server setup complete and working but I have to manually run the start-webapp.sh script to start the server each time I reprovision the server.
I have the following task in my Bitbucket role in Ansible and when I increase the verbosity I can see that I get a positive response from the server saying it will be running at http://localhost/ but when I go to the URL the server isn't on. If I then SSH in to the server and run the script myself, getting the exact same response after running the script I can see the startup webpage.
- name: Start the Bitbucket Server
become: yes
shell: /bitbucket-server/atlassian-bitbucket-4.7.1/bin/start-webapp.sh
Any advice would be great on how to fix this.
Thanks,
Sam
Probably better to change that to an init script and use the service module to start it. For example, see this role for installing bitbucket...
Otherwise, you're subject to HUP and other issues from running processes under an ephemeral session.