Disable files management by Proxmox only one time

Also add some lists var to be able to disable the wanted files.
This commit is contained in:
Jeremy Gardais 2018-03-01 11:09:08 +01:00
parent 24195da6d7
commit 9b140a7a1b
4 changed files with 22 additions and 11 deletions

View File

@ -1,3 +1,8 @@
## v1.0.3
### Fixes
* Ensure to disable management of files by Proxmox only one time.
## v1.0.2 ## v1.0.2
### Enhancements ### Enhancements

View File

@ -20,7 +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`]. * **basics__proxmox_*disable**: Allow to disable the management of some files by Proxmox for LXC containers [default: `[]`].
## Example Playbook ## Example Playbook
@ -54,8 +54,7 @@ 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: For LXC containers, you also have the possibility to disable the management of some files (/etc/hosts,…) by Proxmox. See [Proxmox wiki about LXC][wiki proxmox lxc].
- Touch a /etc/.pve-ignore.hosts file.
## Development ## Development
@ -80,3 +79,4 @@ Jérémy Gardais
[basics github]: https://github.com/ipr-cnrs/basics [basics github]: https://github.com/ipr-cnrs/basics
[wtfpl website]: http://www.wtfpl.net/about/ [wtfpl website]: http://www.wtfpl.net/about/
[ipr website]: https://ipr.univ-rennes1.fr/ [ipr website]: https://ipr.univ-rennes1.fr/
[wiki proxmox lxc]: https://pve.proxmox.com/wiki/Linux_Container#_guest_operating_system_configuration

View File

@ -11,4 +11,6 @@ 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 # Proxmox
basics__proxmox_disable_hosts: True basics__proxmox_disable: []
basics__proxmox_group_disable: []
basics__proxmox_host_disable: []

View File

@ -1,4 +1,6 @@
--- ---
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
#
# tasks file for basics # tasks file for basics
## Modify /etc/hosts {{{ ## Modify /etc/hosts {{{
@ -34,12 +36,14 @@
## }}} ## }}}
## Proxmox {{{ # Proxmox [[[1
- name: Disable modification of files by Proxmox
- name: Disable modification of /etc/hosts by Proxmox copy:
file: content: ""
path: /etc/.pve-ignore.hosts dest: '{{ (item.path | dirname) + "/.pve-ignore." + (item.path | basename) }}'
state: '{{ "touch" if basics__proxmox_disable_hosts else "absent" }}' with_flattened:
- '{{ basics__proxmox_disable }}'
- '{{ basics__proxmox_group_disable }}'
- '{{ basics__proxmox_host_disable }}'
when: ansible_virtualization_type == "lxc" when: ansible_virtualization_type == "lxc"
## }}}