Re: Kickstart / PXE / Cobbler / Ansible

2016-01-14 Thread Loris Bennett
Hi Benjamin,

Benjamin Lefoul  writes:

> Hi all,
>
> I am actually interested in the automated install topic (currently
> taking place in the other discussion, but I don't want to feed the
> troll so I'll start a new one).
>
> Someone just mentioned Cobbler, and the fact that it's RH's baby. Is
> this in any way linked to the recent acquisition of Ansible ?  In
> fact, I never really understood what Ansible was, and does it have its
> place in automated install? Can it replace Kickstart?
>
> As you can see I am pretty naive about the topic...

I don't know very much about kickstart but am currently using ansible to
set up two administration servers for a test cluster.  My meagre
understanding is that kickstart is mainly aimed at the initial
lower-level installation (partitioning the disk, installing the base OS
and other packages, ...).

Ansible on the other hand requires the machines you are managing to be
already up and running and, normally, accessible via ssh.  Thus it seems
it is a more fancy way of doing what kickstart can probably do in the
post-install section.  However, Ansible works with 'playbooks', which are
sets of 'plays', which in turn are sets of tasks to be carried out on a
set of hosts.  You can run entire playbooks or just groups of tasks and
you can also define roles, such as 'ldapserver' or 'dbserver' to bundle
associated tasks together.  In general it seems slightly more orientated
towards automated day-to-day management of multiple, heterogeneous hosts.

That having been said, I am no expert.

Regards

Loris

-- 
Dr. Loris Bennett (Mr.)
ZEDAT, Freie Universität Berlin Email loris.benn...@fu-berlin.de


Setting hostname

2016-03-15 Thread Loris Bennett
Hi,

I'm using ansible to set up two servers and have run into the problem
that on one server 'hostname' returns the just the name of the machine,
but on the other I get the FQDN:

# hostname -s; hostname -d; hostname -f; hostname 
tadmin01
test.cluster
tadmin01.test.cluster
tadmin01

# hostname -s; hostname -d; hostname -f; hostname
tadmin02
test.cluster
tadmin02.test.cluster
tadmin02.test.cluster

The following files are identical on both servers

/etc/hosts
/etc/resolv.conf

The files

/etc/sysconfig/network

differs just in the following way:

< HOSTNAME=tadmin01
---
> HOSTNAME=tadmin02

What other files could have an influence on what 'hostname' returns?

Cheers,

Loris

--
This signature is currently under construction.


Re: Setting hostname

2016-03-15 Thread Loris Bennett
Hi Benjamin,

Benjamin Lefoul  writes:

> Hi Loris,
>
> On SL7, I believe hostnames are best set declaratively in the file
> /etc/hostname (as has been the case for long on other distros).  I
> suspect the preferred imperative way to set hostname is with
> "hostnamectl set-hostname" (check the man hostnamectl).
>
> Regards,
>
> Benjamin Lefoul
> nWISE AB

[snip (50 lines)]

Ah, I should have said:  I'm on SL 6.7 and 'hostnamectl' doesn't seem to
be available.

Cheers,

Loris

-- 
This signature is currently under construction.


Re: Setting hostname

2016-03-15 Thread Loris Bennett
Hi Paddy,

Paddy Doyle  writes:

> Hi Loris,
>
> On Tue, Mar 15, 2016 at 11:43:55AM +0100, Loris Bennett wrote:
>
>> Hi,
>> 
>> I'm using ansible to set up two servers and have run into the problem
>> that on one server 'hostname' returns the just the name of the machine,
>> but on the other I get the FQDN:
>> 
>> # hostname -s; hostname -d; hostname -f; hostname 
>> tadmin01
>> test.cluster
>> tadmin01.test.cluster
>> tadmin01
>> 
>> # hostname -s; hostname -d; hostname -f; hostname
>> tadmin02
>> test.cluster
>> tadmin02.test.cluster
>> tadmin02.test.cluster
>> 
>> The following files are identical on both servers
>> 
>> /etc/hosts
>> /etc/resolv.conf
>> 
>> The files
>> 
>> /etc/sysconfig/network
>> 
>> differs just in the following way:
>> 
>> < HOSTNAME=tadmin01
>> ---
>> > HOSTNAME=tadmin02
>> 
>> What other files could have an influence on what 'hostname' returns?
>
> Is caching an issue? E.g. with sssd or nscd? That gave us some trouble with
> ansible iirc.

I also suspected something might be being cached, but I have restarted
all the services I thought might play a role and the difference remains.

> We ended up using an explicit ansible rule to set the FQDN in
> /etc/sysconfig/network just to make sure that every node was consistent. And
> then if necessary use "hostname -s" or "hostname -f" as required.

The problem is that I am setting up DRDB with the following resource
definition:

resource r0 {
  net {
protocol C;
allow-two-primaries yes;
  }
  on tadmin01 {
device   /dev/drbd0;
disk /dev/sda1;
address  10.141.235.254:7789;
meta-disk internal;
  }
  on tadmin02 {
device   /dev/drbd0;
disk /dev/sda1;
address  10.141.235.253:7789;
meta-disk internal;
  }
}

However, when I do

  drbdadm create-md r0

I get the error

  'r0' not defined in your config (for this host).

>From my googling my understanding is that the entry in the DRDB config
must match the result returned by 'hostname'.  I can obviously just
tweak the DRDB config to make it work, but I would really like to
understand why 'hostname' without any options gives me the FQDN in one
case and not in the other 

Cheers,

Loris

-- 
This signature is currently under construction.


Re: Setting hostname

2016-03-15 Thread Loris Bennett
Hi Nico,

Nico Kadel-Garcia 
writes:

[snip (27 lines)]

> "system-config-network-tui" works pretty well if installed.

I've had a look at the settings with this, and the setting are as I
expect.

> The problem is that the $HOSTNAME for the system isn't published in
> DNS, nor is it the first hostname for a line in /etc/hosts, so the
> "hostname --fqdn" is not finding it associated with your IP addresses.

I may have explained it badly, but 'hostname --fqdn' works as expected:

  [root@tadmin01 ~]# hostname -f
  tadmin01.test.cluster

  [root@tadmin02 ~]# hostname -f
  tadmin02.test.cluster

The difference is when I call 'hostname' *without* any option:

  [root@tadmin01 ~]# hostname
  tadmin01

  [root@tadmin02 ~]# hostname
  tadmin02.test.cluster

> The usual approach for portable laptops is to put a line like this in
> /etc/hosts somewhere.
>
> 127.0.0.1 mymachine.mydomain
>
> Do *not* put this.
>
> 127.0.0.1 mymachine mymachine.mydomain
>
> And do not touch the line for localhost, the way some installers do.
>
> 127.0.0.1  localhost.localdomain localhost localhost4.localdomain
> localhost4 mymachine.mydomain mymachine
>
> That last one is very common with a lot of bad, bad, software
> installers and configuration tools. Use a *different line* for the
> FQDN.
>
> Note that some software also may work better if you have the hostname
> tied to the systems's live IP addresses, but that's usually because
> it's bad software.

/etc/host looks like this (except with real external IP addresses) on
both machines:

  127.0.0.1   localhost.localdomain localhost
  ::1 localhost6.localdomain6 localhost6

  xxx.xxx.xxx.xxx tadmin01.zedat.fu-berlin.de
  xxx.xxx.xxx.xxx tadmin02.zedat.fu-berlin.de
  10.141.235.254  tadmin01.test.cluster tadmin01
  10.141.235.253  tadmin02.test.cluster tadmin02

But as they are identical, it shouldn't be the source of the
difference.

Cheers,

Loris

-- 
This signature is currently under construction.


Re: Setting hostname

2016-03-16 Thread Loris Bennett
Hi Andrew,

Andrew C Aitchison 
writes:

> On Tue, 15 Mar 2016, Loris Bennett wrote:
>
>> Hi,
>>
>> I'm using ansible to set up two servers and have run into the problem
>> that on one server 'hostname' returns the just the name of the machine,
>> but on the other I get the FQDN:
>>
>> # hostname -s; hostname -d; hostname -f; hostname
>> tadmin01
>> test.cluster
>> tadmin01.test.cluster
>> tadmin01
>>
>> # hostname -s; hostname -d; hostname -f; hostname
>> tadmin02
>> test.cluster
>> tadmin02.test.cluster
>> tadmin02.test.cluster
>
> Does
>   type hostname
> give the same result on both machines ?

Yes, in both cases I get

# type hostname
hostname is /bin/hostname

>> The following files are identical on both servers
>>
>> /etc/hosts
>> /etc/resolv.conf
>>
>> The files
>>
>> /etc/sysconfig/network
>   ... ...
>> What other files could have an influence on what 'hostname' returns?
>
> "man hostname" suggests a few more files that could be relevant.

OK, I've checked

  /etc/nsswitch.conf
  /etc/hosts
  /etc/host.conf

all those and there are no differences.

  /etc/sysconfig/network

differ only by

  < HOSTNAME=tadmin01
  ---
  > HOSTNAME=tadmin02

So I'm still confused.

Cheers,

Loris

-- 
This signature is currently under construction.


Re: Setting hostname

2016-03-18 Thread Loris Bennett
Tom H  writes:

> On Wed, Mar 16, 2016 at 1:53 PM, Loris Bennett
>  wrote:
>> Tom H  writes:
>>> On Tue, Mar 15, 2016 at 1:42 PM, Nico Kadel-Garcia  wrote:
>>>> On Tue, Mar 15, 2016 at 8:32 AM, Nico Kadel-Garcia  
>>>> wrote:
>>>>
>>>>> The problem is that the $HOSTNAME for the system isn't published in
>>>>> DNS, nor is it the first hostname for a line in /etc/hosts, so the
>>>>> "hostname --fqdn" is not finding it associated with your IP addresses.
>>>>> The usual approach for portable laptops is to put a line like this in
>>>>> /etc/hosts somewhere.
>>>>>
>>>>> 127.0.0.1 mymachine.mydomain
>>>
>>> On SL6, I've adopted the Debian approach:
>>>
>>> # cat /etc/hosts
>>> 127.0.0.1 localhost
>>> 127.0.1.1 tadmin.test.cluster tadmin
>>>
>>> # cat /etc/sysconfig/network
>>> NETWORKING=yes
>>> HOSTNAME=tadmin
>>>
>>> # hostname
>>> tadmin
>>>
>>> # hostname -s
>>> tadmin
>>>
>>> # hostname -f
>>> tadmin.test.cluster
>>>
>>> # hostname -d
>>> test.cluster
>>
>> This is what my set-up looks like, too.
>
> It can't be because then (1) "/etc/hosts" would differ on tadmin01 and
> tadmin02 and (2) "hostname" on tadmin02 would return "tadmin02".

I meant that my set-up is the same in that I have similar data in those
two files.  This is what /etc/hosts looks like:

  [root@tadmin01 etc]# cat /etc/hosts
  127.0.0.1 localhost.localdomain localhost
  ::1   localhost6.localdomain6 localhost6

  xxx.xxx.xxx.xxx tadmin01.zedat.fu-berlin.de
  xxx.xxx.xxx.xxx tadmin02.zedat.fu-berlin.de
  10.141.235.254  tadmin01.test.cluster tadmin01
  10.141.235.253  tadmin02.test.cluster tadmin02

It is the same on tadmin01 and tadmin02.

And for /etc/sysconfig/network on tadmin01 I have

  [root@tadmin01 ~]# cat /etc/sysconfig/network
  # Generated from an ansible template
  NETWORKING=yes
  NETWORKING_IPV6=no
  HOSTNAME=tadmin01
  GATEWAY=xxx.xxx.xxx.xxx

and on tadmin02

  [root@tadmin02 ~]# cat /etc/sysconfig/network
  # Generated from an ansible template
  NETWORKING=yes
  NETWORKING_IPV6=no
  HOSTNAME=tadmin02
  GATEWAY=xxx.xxx.xxx.xxx

[snip (64 lines)]

I still get

  [root@tadmin01 ~]# hostname
  tadmin01

and 

  [root@tadmin02 ~]# hostname
  tadmin02.test.cluster

Cheers,

Loris

-- 
This signature is currently under construction.


Re: Setting hostname

2016-03-18 Thread Loris Bennett
Tom H  writes:

> On Tue, Mar 15, 2016 at 1:42 PM, Nico Kadel-Garcia  wrote:
>> On Tue, Mar 15, 2016 at 8:32 AM, Nico Kadel-Garcia  wrote:
>>
>>> The problem is that the $HOSTNAME for the system isn't published in
>>> DNS, nor is it the first hostname for a line in /etc/hosts, so the
>>> "hostname --fqdn" is not finding it associated with your IP addresses.
>>> The usual approach for portable laptops is to put a line like this in
>>> /etc/hosts somewhere.
>>>
>>> 127.0.0.1 mymachine.mydomain
>
> On SL6, I've adopted the Debian approach:
>
> # cat /etc/hosts
> 127.0.0.1 localhost
> 127.0.1.1 tadmin.test.cluster tadmin
>
> # cat /etc/sysconfig/network
> NETWORKING=yes
> HOSTNAME=tadmin
>
> # hostname
> tadmin
>
> # hostname -s
> tadmin
>
> # hostname -f
> tadmin.test.cluster
>
> # hostname -d
> test.cluster

This is what my set-up looks like, too.

> On SL7, libnss_myhostname does the job of the second "/etc/hosts" line
> (but with 127.0.0.2) automatically.
>
> To the OP:
>
> Where are you setting the domainname?

# cat /etc/sysconfig/network-scripts/ifcfg-eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=none
IPADDR=10.141.235.253
NETMASK=255.255.0.0
DOMAIN=test.cluster
USERCTL=no

Cheers,

Loris

-- 
This signature is currently under construction.


Re: Setting hostname

2016-03-19 Thread Loris Bennett
Brandon Vincent  writes:

> On Mar 16, 2016 7:56 AM, "Loris Bennett"
>  wrote:
>>
>> Brandon Vincent  writes:
>>
>> > On Mar 15, 2016 3:44 AM, "Loris Bennett"
>> >  wrote:
>> >> What other files could have an influence on what 'hostname' returns?
>> >
>> > Could you post the output of
>> >
>> > getent hosts [hostname] and getent hosts [ip] for both systems?
>> >
>> > Also please post the hosts line from nsswitch.conf from both machines.
>> >
>> > Brandon Vincent
>> >
>>
>> [root@tadmin01 ~]# getent hosts tadmin01
>> 10.141.235.254 tadmin01.test.cluster tadmin01
>> [root@tadmin01 ~]# getent hosts 10.141.235.254
>> 10.141.235.254 tadmin01.test.cluster tadmin01
>>
>> [root@tadmin02 ~]# getent hosts tadmin02
>> 10.141.235.253 tadmin02.test.cluster tadmin02
>> [root@tadmin02 ~]# getent hosts 10.141.235.253
>> 10.141.235.253 tadmin02.test.cluster tadmin02
>>
>> [root@tadmin01 ~]# grep hosts /etc/nsswitch.conf
>> #hosts: db files nisplus nis dns
>> hosts: files dns
>>
>> [root@tadmin02 ~]# grep hosts /etc/nsswitch.conf
>> #hosts: db files nisplus nis dns
>> hosts: files dns
>>
>> Cheers,
>>
>> Loris
>>
>> --
>> Dr. Loris Bennett (Mr.)
>> ZEDAT, Freie Universität Berlin Email loris.benn...@fu-berlin.de
>
> Looks good. Verify there is no /etc/hostname on the system (or if there is,
> ensure the contents are correct.
>
> Are you using NetworkManager or the traditional network service?
>
> These IPs are static, right? Not assigned by DHCP but entered manually.
>
> Brandon Vincent

OK, sorry for wasting everyone's time.  I rebooted tadmin02 and now I
get

  [root@tadmin02 ~]# hostname
  tadmin02

as expected.  I assume I must have done

  hostname tadmin.test.cluster

at some point.  Which begs the question:

Is there any way to tell that the hostname has been set via

  hostname some.random.address

rather via some init script reading /etc/sysconfig/network?

Thanks for all the help,

Loris

-- 
This signature is currently under construction.


Re: Setting hostname

2016-03-20 Thread Loris Bennett
Brandon Vincent  writes:

> On Mar 15, 2016 3:44 AM, "Loris Bennett"
>  wrote:
>> What other files could have an influence on what 'hostname' returns?
>
> Could you post the output of
>
> getent hosts [hostname] and getent hosts [ip] for both systems?
>
> Also please post the hosts line from nsswitch.conf from both machines.
>
> Brandon Vincent
>

[root@tadmin01 ~]# getent hosts tadmin01
10.141.235.254  tadmin01.test.cluster tadmin01
[root@tadmin01 ~]# getent hosts 10.141.235.254
10.141.235.254  tadmin01.test.cluster tadmin01

[root@tadmin02 ~]# getent hosts tadmin02
10.141.235.253  tadmin02.test.cluster tadmin02
[root@tadmin02 ~]# getent hosts 10.141.235.253
10.141.235.253  tadmin02.test.cluster tadmin02

[root@tadmin01 ~]# grep hosts /etc/nsswitch.conf
#hosts: db files nisplus nis dns
hosts:  files dns

[root@tadmin02 ~]# grep hosts /etc/nsswitch.conf
#hosts: db files nisplus nis dns
hosts:  files dns

Cheers,

Loris

-- 
Dr. Loris Bennett (Mr.)
ZEDAT, Freie Universität Berlin Email loris.benn...@fu-berlin.de