Disable the management of /etc/hosts by Proxmox
This commit is contained in:
parent
3ff80a95e7
commit
24195da6d7
|
@ -1,6 +1,11 @@
|
||||||
|
## v1.0.2
|
||||||
|
|
||||||
|
### Enhancements
|
||||||
|
* Disable the management of /etc/hosts by Proxmox.
|
||||||
|
|
||||||
## v1.0.1
|
## v1.0.1
|
||||||
|
|
||||||
## Enhancements
|
### Enhancements
|
||||||
* Add example playbook.
|
* Add example playbook.
|
||||||
* localhost line sould not contain hostname information (see https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution).
|
* localhost line sould not contain hostname information (see https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution).
|
||||||
* Purge /etc/hosts of multiple lines that contains $HOSTNAME without the default ipv4 ip address.
|
* Purge /etc/hosts of multiple lines that contains $HOSTNAME without the default ipv4 ip address.
|
||||||
|
|
|
@ -20,6 +20,7 @@ Manage some basics configuration for IPR's servers.
|
||||||
* **basics__hosts_localhost_content** : Content of the localhost (127.0.0.1) line [default : `localhost.localdomain localhost`].
|
* **basics__hosts_localhost_content** : Content of the localhost (127.0.0.1) line [default : `localhost.localdomain localhost`].
|
||||||
* **basics__hosts_ipv4_manage** : If the ipv4 address line should be managed [default : `false`].
|
* **basics__hosts_ipv4_manage** : If the ipv4 address line should be managed [default : `false`].
|
||||||
* **basics__hosts_ipv4_content** : Content of the ipv4 address line [default : `{{ ansible_hostname }}.{{ basics__domain }} {{ ansible_hostname }}`].
|
* **basics__hosts_ipv4_content** : Content of the ipv4 address line [default : `{{ ansible_hostname }}.{{ basics__domain }} {{ ansible_hostname }}`].
|
||||||
|
* **basics__proxmox_disable_hosts** : Disable the management of **/etc/hosts** file by Proxmox for LXC containers [default : `True`].
|
||||||
|
|
||||||
## Example Playbook
|
## Example Playbook
|
||||||
|
|
||||||
|
@ -53,6 +54,9 @@ Ensure to have the correct fqdn and hostname in /etc/hosts :
|
||||||
- You can choose to define the permanent ip (ipv4) line content.
|
- You can choose to define the permanent ip (ipv4) line content.
|
||||||
- All other lines that contains hostname without this permanent ip address will be removed.
|
- All other lines that contains hostname without this permanent ip address will be removed.
|
||||||
|
|
||||||
|
For LXC containers, also ensure to disable the management of /etc/hosts by Proxmox :
|
||||||
|
- Touch a /etc/.pve-ignore.hosts file.
|
||||||
|
|
||||||
## Development
|
## Development
|
||||||
|
|
||||||
This source code comes from our [Gogs instance][basics source] and the [Github repo][basics github] exist just to be able to send the role to Ansible Galaxy…
|
This source code comes from our [Gogs instance][basics source] and the [Github repo][basics github] exist just to be able to send the role to Ansible Galaxy…
|
||||||
|
|
|
@ -10,3 +10,5 @@ basics__hosts_localhost_content: "localhost.localdomain localhost"
|
||||||
basics__hosts_ipv4_manage: false
|
basics__hosts_ipv4_manage: false
|
||||||
basics__hosts_ipv4_content: "{{ ansible_hostname }}.{{ basics__domain }} {{ ansible_hostname }}"
|
basics__hosts_ipv4_content: "{{ ansible_hostname }}.{{ basics__domain }} {{ ansible_hostname }}"
|
||||||
|
|
||||||
|
# Proxmox
|
||||||
|
basics__proxmox_disable_hosts: True
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
# tasks file for basics
|
# tasks file for basics
|
||||||
|
|
||||||
## Modify /etc/hosts
|
## Modify /etc/hosts {{{
|
||||||
|
|
||||||
- name: Config host - Set 127.0.0.1 line in hosts file
|
- name: Config host - Set 127.0.0.1 line in hosts file
|
||||||
lineinfile:
|
lineinfile:
|
||||||
|
@ -33,3 +33,13 @@
|
||||||
ansible_default_ipv4.address is defined)
|
ansible_default_ipv4.address is defined)
|
||||||
|
|
||||||
## }}}
|
## }}}
|
||||||
|
|
||||||
|
## Proxmox {{{
|
||||||
|
|
||||||
|
- name: Disable modification of /etc/hosts by Proxmox
|
||||||
|
file:
|
||||||
|
path: /etc/.pve-ignore.hosts
|
||||||
|
state: '{{ "touch" if basics__proxmox_disable_hosts else "absent" }}'
|
||||||
|
when: ansible_virtualization_type == "lxc"
|
||||||
|
|
||||||
|
## }}}
|
||||||
|
|
Reference in New Issue