mirror of
https://github.com/ansible-collections/community.general.git
synced 2024-09-14 20:13:21 +02:00
Merge pull request #5090 from dragon3/hostname_support_amazon_linux
hostname module: add support for Amazon Linux
This commit is contained in:
commit
2670529671
2 changed files with 10 additions and 2 deletions
|
@ -122,8 +122,11 @@ def get_distribution():
|
|||
if platform.system() == 'Linux':
|
||||
try:
|
||||
distribution = platform.linux_distribution()[0].capitalize()
|
||||
if distribution == 'NA':
|
||||
if os.path.is_file('/etc/system-release'):
|
||||
if not distribution and os.path.is_file('/etc/system-release'):
|
||||
distribution = platform.linux_distribution(supported_dists=['system'])[0].capitalize()
|
||||
if 'Amazon' in distribution:
|
||||
distribution = 'Amazon'
|
||||
else:
|
||||
distribution = 'OtherLinux'
|
||||
except:
|
||||
# FIXME: MethodMissing, I assume?
|
||||
|
|
|
@ -241,6 +241,11 @@ class CentOSHostname(Hostname):
|
|||
distribution = 'Centos'
|
||||
strategy_class = RedHatStrategy
|
||||
|
||||
class AmazonLinuxHostname(Hostname):
|
||||
platform = 'Linux'
|
||||
distribution = 'Amazon'
|
||||
strategy_class = RedHatStrategy
|
||||
|
||||
# ===========================================
|
||||
|
||||
class FedoraStrategy(GenericStrategy):
|
||||
|
|
Loading…
Reference in a new issue