Open ktaragorn opened 10 years ago
my hosts file is
[dev]
localhost ansible_connection=local
Setting ansible_hostname=localhost
as a host var doesnt seem to be helping :(
Trying to find a better way @ http://stackoverflow.com/questions/26200653/force-ansible-hostname-value-or-check-ansible-target-is-localhost
seems inventory_hostname
is what you specify in the hosts file, perhaps that is a better choice to compare against localhost
? might need to check 127.0.0.1
..
Yeah, inventory_hostname looks like the way to go with the condition to me.
I have the same problem, what would be the solution? just add in hosts like this:
[web]
example.com inventory_hostname=localhost
I've tried it and it didn't help :-(
HI @rstormsf this is a change for the role itself, setting in the host file isnt it. I have the role downloaded into my repository, so I ended up changing the condition above to a boolean variable and i set that variable in the host file.. Not pretty but atleast it works and is explicit. Ideally the role should fix this
Still not quite understand how to fix it.
Anything on this, im getting this when trying to run inside a container
Another discovery... I can ping my ansible_fqdn
which is "ansible_fqdn": "Karthiks-MacBook-Pro.local"
But I cannot ping my ansible_hostname
which is just "Karthiks-MacBook-Pro"
. This might be mac specific though..
For those looking for a fix, what I did was add a db_local
variable in my hosts file, which was true or false as needed, and actually modified the code in tasks/secure.yml
to replace cases of when: ansible_hostname != 'localhost'
with when: db_local
. This only works for me because I store the role within my repository and thus can modify and commit to my repository.
I think the problem really is with ansible_hostname
Good find, perhaps the role should start using that, might even negate the need to do different things on local...
Ive changed to inventory_hostname and it reacts better now, but im still getting an error:
ansible_1 | TASK: [ANXS.mysql | MySQL | Changing the root password (local hostname).] *****
ansible_1 | failed: [localhost] => (item=127.0.0.1) => {"failed": true, "item": "127.0.0.1"}
ansible_1 | msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials
ansible_1 | failed: [localhost] => (item=::1) => {"failed": true, "item": "::1"}
ansible_1 | msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials
ansible_1 | failed: [localhost] => (item=localhost) => {"failed": true, "item": "localhost"}
ansible_1 | msg: unable to connect to database, check login_user and login_password are correct or ~/.my.cnf has the credentials
ansible_1 |
ansible_1 | FATAL: all hosts have already failed -- aborting
ansible_1 |
ansible_1 | PLAY RECAP ********************************************************************
ansible_1 | to retry, use: --limit @/root/playbook.retry
ansible_1 |
ansible_1 | localhost : ok=11 changed=4 unreachable=0 failed=1
I've got the same problem where MariaDB has already been installed. Will this create an issue and if so should I remove MariaDB and re-install ./rd-installer?
By the way, I cannot remove MariaDB as I get the following error: [root@rad01thn /]# yum remove mariadb mariadb-server Loaded plugins: fastestmirror No Match for argument: mariadb No Match for argument: mariadb-server No Packages marked for removal
I'm on Centos 7.3, so I also tried: [root@rad01thn /]# yum remove MariaDB-server MariaDB-client Loaded plugins: fastestmirror No Match for argument: MariaDB-server No Match for argument: MariaDB-client No Packages marked for removal
My .cnf file looks like this: [root@rad01thn etc]# more my.cnf [mysqld] bind-address=127.0.0.1 datadir=/var/lib/mysql socket=/var/lib/mysql/mysql.sock
symbolic-links=0
[mysqld_safe] log-error=/var/log/mysql.err pid-file=/var/run/mariadb/mariadb.pid
#
# !includedir /etc/my.cnf.d
sql_mode=IGNORE_SPACE,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION Any help please
This is on LXLE which is based on ubuntu 14.04.1 The first time I run the task, I get
Which means the second time I get
This works fine on a remote system.
As I write this (:P), I notice that the first Item is
"item": "KarthikT-OptiPlex-GX620
which I believe was the name set by the ubuntu/lxle installer.. This would mean that it is picking the wrong task of the two tasksSet the root password.
intasks/secure.yml
. First fix would be to name them differently based on their use (localhost vs remote perhaps). And perhaps a better check is needed rather thanwhen: ansible_hostname != 'localhost'
?This was repeatedly encountered, after purging mysql as shown in http://stackoverflow.com/questions/10853004/removing-mysql-5-5-completely. It is running the ansible galaxy version of the role.