80 lines
2.2 KiB
YAML
80 lines
2.2 KiB
YAML
---
|
|
|
|
# /etc
|
|
- name: Is /etc a git repository
|
|
stat:
|
|
path: /etc/.git
|
|
register: _etc_git
|
|
|
|
- name: "evocommit /etc"
|
|
command: "/usr/local/bin/evocommit --ansible --repository /etc --message \"{{ commit_message | mandatory }}\""
|
|
changed_when:
|
|
- _etc_git_commit.stdout
|
|
- "'CHANGED:' in _etc_git_commit.stdout"
|
|
ignore_errors: yes
|
|
register: _etc_git_commit
|
|
when:
|
|
- _etc_git.stat.exists
|
|
- _etc_git.stat.isdir
|
|
|
|
# /etc/bind
|
|
- name: Is /etc/bind a git repository
|
|
stat:
|
|
path: /etc/bind/.git
|
|
register: _etc_bind_git
|
|
|
|
- name: "evocommit /etc/bind"
|
|
command: "/usr/local/bin/evocommit --ansible --repository /etc/bind --message \"{{ commit_message | mandatory }}\""
|
|
changed_when:
|
|
- _etc_bind_git_commit.stdout
|
|
- "'CHANGED:' in _etc_bind_git_commit.stdout"
|
|
ignore_errors: yes
|
|
register: _etc_bind_git_commit
|
|
when:
|
|
- _etc_bind_git.stat.exists
|
|
- _etc_bind_git.stat.isdir
|
|
|
|
# /usr/share/scripts
|
|
- name: Is /usr/share/scripts a git repository
|
|
stat:
|
|
path: /usr/share/scripts/.git
|
|
register: _usr_share_scripts_git
|
|
|
|
- name: "evocommit /usr/share/scripts"
|
|
command: "/usr/local/bin/evocommit --ansible --repository /usr/share/scripts --message \"{{ commit_message | mandatory }}\""
|
|
changed_when:
|
|
- _usr_share_scripts_git_commit.stdout
|
|
- "'CHANGED:' in _usr_share_scripts_git_commit.stdout"
|
|
ignore_errors: yes
|
|
register: _usr_share_scripts_git_commit
|
|
when:
|
|
- _usr_share_scripts_git.stat.exists
|
|
- _usr_share_scripts_git.stat.isdir
|
|
|
|
- name: Check if there are lxc containers
|
|
stat:
|
|
path: /var/lib/lxc
|
|
get_attributes: no
|
|
get_checksum: no
|
|
get_mime: no
|
|
register: _var_lib_lxc
|
|
|
|
- name: Get lxc containers and commit their /etc when needed
|
|
block:
|
|
- name: Get all lxc containers
|
|
find:
|
|
paths: /var/lib/lxc
|
|
recurse: no
|
|
file_type: directory
|
|
register: _lxc_containers
|
|
|
|
- name: "Commit /etc in all containers"
|
|
include_tasks:
|
|
file: lxc_commit.yml
|
|
loop: "{{ _lxc_containers.files | map(attribute='path') | map('basename') }}"
|
|
loop_control:
|
|
loop_var: container
|
|
when:
|
|
- _var_lib_lxc.stat.exists
|
|
- _var_lib_lxc.stat.isdir or _var_lib_lxc.stat.islnk
|