Dashboard
PHP:
8.2.30
OS:
Linux
User:
dh_nv8b2m
/
/
usr
/
local
/
lib
/
python3.10
/
dist-packages
/
ansible
/
modules
/
__pycache__
📤 Upload
📝 New File
📁 New Folder
Close
Editing: hostname.cpython-310.pyc
o O�h�p � @ s� d dl mZ dZdZd dlZd dlZd dlZd dlZd dlm m mZ d dl mZmZmZ d dlmZ d dlmZ d dlmZmZ d d lmZmZ d ddd dddddddddd� ZG dd� de�ZG dd� de�ZG dd� de�ZG dd� de�Z G dd� de �Z!G dd � d e�Z"G d!d"� d"e �Z#G d#d$� d$e�Z$G d%d&� d&e�Z%G d'd(� d(e �Z&G d)d*� d*e�Z'G d+d,� d,e�Z(G d-d.� d.e�Z)G d/d0� d0e�Z*G d1d2� d2e*�Z+G d3d4� d4e*�Z,G d5d6� d6e*�Z-G d7d8� d8e*�Z.G d9d:� d:e*�Z/G d;d<� d<e*�Z0G d=d>� d>e*�Z1G d?d@� d@e*�Z2G dAdB� dBe*�Z3G dCdD� dDe*�Z4G dEdF� dFe*�Z5G dGdH� dHe*�Z6G dIdJ� dJe*�Z7G dKdL� dLe*�Z8G dMdN� dNe*�Z9G dOdP� dPe*�Z:G dQdR� dRe*�Z;G dSdT� dTe*�Z<G dUdV� dVe*�Z=G dWdX� dXe*�Z>G dYdZ� dZe*�Z?G d[d\� d\e*�Z@G d]d^� d^e*�ZAG d_d`� d`e*�ZBG dadb� dbe*�ZCG dcdd� dde*�ZDG dedf� dfe*�ZEG dgdh� dhe*�ZFG didj� dje*�ZGG dkdl� dle*�ZHG dmdn� dne*�ZIG dodp� dpe*�ZJG dqdr� dre*�ZKG dsdt� dte*�ZLG dudv� dve*�ZMdwdx� ZNeOdyk�r�eN� dS dS )z� )�annotationsa� --- module: hostname author: - Adrian Likins (@alikins) - Hideki Saito (@saito-hideki) version_added: "1.4" short_description: Manage hostname requirements: [ hostname ] description: - Set system's hostname. Supports most OSs/Distributions including those using C(systemd). - Windows, HP-UX, and AIX are not currently supported. notes: - This module does B(NOT) modify C(/etc/hosts). You need to modify it yourself using other modules such as M(ansible.builtin.template) or M(ansible.builtin.replace). - On macOS, this module uses C(scutil) to set C(HostName), C(ComputerName), and C(LocalHostName). Since C(LocalHostName) cannot contain spaces or most special characters, this module will replace characters when setting C(LocalHostName). options: name: description: - Name of the host. - If the value is a fully qualified domain name that does not resolve from the given host, this will cause the module to hang for a few seconds while waiting for the name resolution attempt to timeout. type: str required: true use: description: - Which strategy to use to update the hostname. - If not set we try to autodetect, but this can be problematic, particularly with containers as they can present misleading information. - Note that 'systemd' should be specified for RHEL/EL/CentOS 7+. Older distributions should use 'redhat'. choices: ['alpine', 'debian', 'freebsd', 'generic', 'macos', 'macosx', 'darwin', 'openbsd', 'openrc', 'redhat', 'sles', 'solaris', 'systemd'] type: str version_added: '2.9' extends_documentation_fragment: - action_common_attributes - action_common_attributes.facts attributes: check_mode: support: full diff_mode: support: full facts: support: full platform: platforms: posix z� - name: Set a hostname ansible.builtin.hostname: name: web01 - name: Set a hostname specifying strategy ansible.builtin.hostname: name: web01 use: systemd N)� AnsibleModule�get_distribution�get_distribution_version)�get_platform_subclass)�ServiceMgrFactCollector)�get_file_lines�get_file_content)� to_native�to_text�Alpine�Systemd�FreeBSD�Base�Darwin�OpenBSD�OpenRC�RedHat�SLES�Solaris) �alpine�debian�freebsd�generic�macos�macosx�darwin�openbsd�openrc�redhat�sles�solaris�systemdc @ �L e Zd Zdd� Zdd� Zdd� Zdd� Zd d � Zdd� Zd d� Z dd� Z dS )�BaseStrategyc C s || _ d| _d S )NF)�module�changed��selfr% � r) �C/usr/local/lib/python3.10/dist-packages/ansible/modules/hostname.py�__init__g s zBaseStrategy.__init__c C � | � � | �� | jS �N)�update_current_hostname�update_permanent_hostnamer&