How to restart Ansible host machine on Linux? - ansible

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.

Related

Run an IBM OS/2 related command on remote server through Ansible playbook but hangs, no response

I have a playbook, as below:
tasks:
- name: Execute a program_A on managed node
win_command: 'D:test\program_A.exe'
I run this playbook but hung and no any response on managed node (Windows 2012). (i.e. there is a program_A.exe process generated on managed node but no response, it's CPU usage time is always 0%)
I also tired to replace win_command by win_shell module, raw module, but it still hung and no response on managed node...
When I try to open a command window on the managed node to run D:\test\program_A.exe directly, the program_A.exe was successfully executed.
What could be wrong?
Make sure the exe file is executed by the same privilege. eg. when you directly execute it, you are using Administrator, but in playbook, you may use guest rule.

How can i configure Ansible and Jenkins if both are not on same machine?

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

Ansible on Ubuntu

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.

Starting Bitbucket Server in Ansible

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.

Is there any Ansible remote client for control machine?

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

Resources