lxc: Add /etc of lxc containers to git
Some checks failed
continuous-integration/drone/push Build is passing
continuous-integration/drone/pr Build is failing

This commit is contained in:
Mathieu Trossevin 2021-08-05 10:55:41 +02:00
parent a387304483
commit a82ae51008
Signed by: mtrossevin
GPG key ID: D1DBB7EA828374E9
6 changed files with 26 additions and 3 deletions

View file

@ -16,6 +16,7 @@ The **patch** part changes is incremented if multiple releases happen the same m
* haproxy: add haproxy_allow_ip_nonlocal_bind to set sysctl value (optional)
* kvm-host: fix depreciation of "drbd-overview" by "drbdadm status" in add-vm.sh
* openvpn: configure logrotate
* lxc: Add /etc of containers in git
### Changed

View file

@ -45,8 +45,10 @@
- name: "Some entries MUST be in the {{ repository_path }}/.gitignore file"
lineinfile:
dest: "{{ repository_path }}/.gitignore"
line: "{{ item }}"
line: "{{ gitignore_line }}"
loop: "{{ gitignore_items | default([]) }}"
loop_control:
loop_var: gitignore_line
tags:
- etc-git

1
lxc/files/gitignore Symbolic link
View file

@ -0,0 +1 @@
../../etc-git/files/gitignore

View file

@ -52,6 +52,22 @@
insertbefore: "^exit 0$"
when: release == 'jessie'
# For some reason import_role/include_role doesn't work here.
# Apparently ansible see some condition that end up being false.
# So we use import_tasks and a symlink.
- name: "Put /etc of container {{ name }} into git"
import_tasks: repository.yml
vars:
repository_path: "/var/lib/lxc/{{ name }}/rootfs/etc"
gitignore_items:
- "aliases.db"
- "*.swp"
- "postfix/sa-blacklist.access"
- "postfix/*.db"
- "postfix/spamd.cidr"
- "evobackup/.keep-*"
- "letsencrypt/.certbot.lock"
- name: "Ensure that {{ name }} container is running"
lxc_container:
name: "{{ name }}"

View file

@ -52,6 +52,8 @@
- name: Create containers
include: create-container.yml
vars:
name: "{{ item.name }}"
release: "{{ item.release }}"
name: "{{ container.name }}"
release: "{{ container.release }}"
loop: "{{ lxc_containers }}"
loop_control:
loop_var: container

1
lxc/tasks/repository.yml Symbolic link
View file

@ -0,0 +1 @@
../../etc-git/tasks/repository.yml