Ansible - "add_host" skipping newgroup host

Here is my code:

- hosts: Server tasks: - name: Get Slave Status mysql_replication: mode=getslave register: slaveStat - name: Display MasterIP debug: msg="{{ slaveStat.Master_Host }}" - name: Register MasterIP local_action: add_host hostname={{ slaveStat.Master_Host }} groupname=active - hosts: active tasks: - name: Test command command: echo `df -h`

And when I ran the code it skipping the new hostgroup "active". Please help me to find out the cause of the task execution fail.

Here is the output :

#ansible-playbook -i hosts site.yml -l -u root -v PLAY [controller] ************************************************************* GATHERING FACTS *************************************************************** ok: [] TASK: [Get Slave Status] ****************************************************** ok: [] => {"Connect_Retry": 60, "Exec_Master_Log_Pos": 107, "Last_Errno": 0, "Last_Error": "", "Last_IO_Errno": 0, "Last_IO_Error": "", "Last_SQL_Errno": 0, "Last_SQL_Error": "", "Master_Host": "", "Master_Log_File": "mysql-bin.000017", "Master_Port": 3306, "Master_SSL_Allowed": "No", "Master_SSL_CA_File": "", "Master_SSL_CA_Path": "", "Master_SSL_Cert": "", "Master_SSL_Cipher": "", "Master_SSL_Key": "", "Master_SSL_Verify_Server_Cert": "No", "Master_Server_Id": 4886, "Master_User": "controller_repl", "Read_Master_Log_Pos": 107, "Relay_Log_File": "mysqld-relay-bin.000005", "Relay_Log_Pos": 253, "Relay_Log_Space": 556, "Relay_Master_Log_File": "mysql-bin.000017", "Replicate_Do_DB": "", "Replicate_Do_Table": "", "Replicate_Ignore_DB": "", "Replicate_Ignore_Server_Ids": "", "Replicate_Ignore_Table": "test.hoge", "Replicate_Wild_Do_Table": "", "Replicate_Wild_Ignore_Table": "", "Seconds_Behind_Master": 0, "Skip_Counter": 0, "Slave_IO_Running": "Yes", "Slave_IO_State": "Waiting for master to send event", "Slave_SQL_Running": "Yes", "Until_Condition": "None", "Until_Log_File": "", "Until_Log_Pos": 0, "changed": false} TASK: [Display MasterIP] ****************************************************** ok: [] => { "msg": "" } TASK: [Register MasterIP] ***************************************************** ok: [ ->] => {"new_groups": ["active"], "new_host": ""} PLAY [active] ***************************************************************** skipping: no hosts matched PLAY RECAP ********************************************************************

Category:ansible Views:0 Time:2018-07-11

Related post

  • Uploading to Cloud Files or S3 skipping script host 2011-03-26

    Is there a way to upload a file to Rackspace Cloud Files or Amazon S3 while skipping the script host as a temporary store before its moved to the cloud? I would like to minimize bandwidth to my shared hosting account. --------------Solutions---------

  • How to make Fabric ignore offline hosts in the env.hosts list? 2009-12-24

    This is related to my previous question, but a different one. I have the following fabfile: from fabric.api import * host1 = '' offline_host2 = '' host3 = '' env.hosts = [host1, offline_host2, host3] env.w

  • Cannot connect to host in C: Hostname not found (11001) on Windows, DNS Problem? 2011-03-11

    I am trying to use an API that connects to a remote server in C, but I keep having the following error message: log_message: 15:13:19.489 I [ap:1388] Connecting to AP log_message: 15:13:19.490 E [ap:1324] AP Socket Error: Hostname

  • Parallel rsync on multiple hosts 2012-02-07

    I have a requirement to fetch a set of files from 15 different hosts. These are in essense just text files. I have been able to set the ssh keys and stuff so that scp,ssh,rsync etc are passwordless now. Now I am searching for the right way to fetch t

  • Python Fabric: How to handle arbitrary remote shell prompt for input? 2010-04-16

    This is related to this question here, but with a slight twist: instead of just passing 'yes' or 'no', I need Fabric to pass an arbitrary string to the remote shell. For instance, if the remote shell prompts for 'what is your name?' then I need to fe

  • Getting GMP to work with GCC 4.5.2 2011-03-01

    I'm trying to make a cross compiler with the files from I'm on an Intel Mac (10.6.6, x86_64) I compiled: gmp, mpfr, mpc for the cross compiler as 32bit (as I'm on a 64bit Mac) but I'm ge

  • If Database connection failed try to reconnect 2011-03-14

    I am newbie to perl , My scenario is m having an array of host , In a loop i am creating DNS and connection to database . But if any host is not responding or down , then that loop is getting break and remaining host not able to connect , My question

  • What's the valid way to include an image with no src? 2011-04-25

    I have an image that I will dynamically populate with a src later with javascript but for ease I want the image tag to exist at pageload but just not display anything. I know <img src='' /> is invalid so what's the best way to do this? --------

  • Deploying and executing programs on distributed remote machines 2011-06-28

    I am developing a distributed program that will run on Amazon EC2 machines. Ideally I would develop on my local machine, trigger a script to deploy the source on the remote machines (All Linux machines on which I have ssh access), trigger a compile c

  • Perl: parse through multiple files in a single SSH session in File::Remote 2011-07-12

    I am making a script in Perl using the File::Remote module. The script needs to parse through several files in several hosts (let's say about 3 files per host). However, every time I open a file, the script connects to the host via SSH. My code looks

  • access a @SessionScoped bean from @WebService annotated EJB 2012-02-10

    One of my partners needs a SOAP interface and so I thought: lets move to an Application server. I chose Glassfish and it works great out of the box. There is just one thing I can not make it do: inject a @SessionScoped ManagedBean into the @Webservic

  • Host-file colums may be skipped only when copying into the server 2011-02-08

    I want to create a xml file from my database with bcp. The following code works in SQL Server 2008 but not in SQl Express 2005. This is the code error: SQLState = S1000, NativeError = 0 Error = [Microsoft][SQL Native Client] Host-file columns may be

  • Ansible orchestration: running tasks on multiple hosts in order 2014-12-01

    How can I determine the order of tasks in a playbook targeting multiple hosts? I have this playbook I currently run against some vagrant vms. All machines are provisioned using the same playbook. The playbook creates ssh keys and uses authorize_keys

  • Having Capistrano skip over down hosts 2010-12-15

    My setup I am deploying a Ruby on Rails application to 70+ hosts. These hosts are located behind consumer-grade ADSL connections which may or may not be up. Probability of being up is aroud 99% but definently not 100%. The deploy process works perfec

  • Upgrade Subversion 1.4.3 to 1.5.2 on Debian (hosted account) 2008-10-10

    I'm trying to upgrade my subversion server (I have it hosted with Dreamhost) This is what I run: wget wget tar -xjf s

  • Dir.glob doesn't work on site hosted by site5? 2008-12-16

    I have uploaded some files to a directory under public and I try to access them using Dir.glob. But I get no results back. The Dir.glob works fine on dev server (mongrel) and also works fine when using script/console on the site installed on site5 is

  • How to access a .Net COM object hosted in a COM+ Server in .Net? 2009-01-16

    This question is a follow-up to the answer given by Marc Gravell to my question Create Out-Of-Process COM in C#/.Net ?. I have chosen his proposed solution, but now am running in a different issue. Here is my situation: I implemented a "DataProvider"

  • Hosting company recommendation for remote desktop development 2009-02-27

    Are there any hosting companies that specialize in hosting a remote development environment? I am looking to have, sqlserver, subversion (and install my other development tools) so I can access my environment remotely from anywhere. ----------

  • PHP - Function to skip strtolower() if variable contain "" 2009-06-26

    My site allows users to enter URLs into a database. I am using the code "$site = strtolower($site);" to make all of these URLs lower-case. However, I just realized that Wikipedia URLs are case sensitive, so I would like to avoid using "$site = strtol

  • Skipping DNS and using IP adress in web dev as opposed to URLs 2009-06-26

    How much time would be saved in skipping the request for the IP of a domain name? Would it be noticeable. Before anyone gets to excited i know there could be problems with using an IP as opposed to a URL in web dev like if you have multiple servers,

  • What's the best way to return an interface (and object instance) to a remote caller, having said Object method calls run in the hosting app? 2009-07-05

    I'm prototyping a C#/.NET client/server environment in which I need to return an object instance (already constructed with data the client needs- avoiding the exposure of server-side (read: internal database details) that the calling code needs to pe

  • Best practices for (php/msql) deployment to shared hosting? 2009-08-15

    I have worked within a web development company where we had our local machines, a staging server and a a number of production servers. We worked on macs in perl and used svn to commit to stage, and perl scripts to load to production servers. Now I am

  • OK to skip slash before query string? 2009-10-24

    Is it safe to always skip the trailing slash when appending a query string? Instead of... All webhosts I've used support this but Is it safe to assume that all server environments will su

  • fsockopen error I want to skip 2009-10-29

    $sock = fsockopen($url_parts['host'], (isset($url_parts['port']) ? (int)$url_parts['port'] : 80), $errno, $errstr, 30); if (!$sock) return false; I have list on my db for urls, that I am visiting, and occassionally I get this: I am getting "Fatal err

  • Exposing WCF Services Via HTTP when not hosted in IIS 2009-11-08

    Like the title says, we need to set up WCF services between a .NET app, and a Adobe AIR app. We don't want to run IIS on the machine, and would much prefer to install and run the WCF services hosted within a windows service. However, I am uncertain o

Copyright (C), All Rights Reserved.

processed in 0.280 (s). 12 q(s)