etc-git: add tags for Ansible
This commit is contained in:
parent
b92d697db1
commit
98486fd771
3 changed files with 29 additions and 5 deletions
|
@ -19,7 +19,7 @@ The **patch** part changes incrementally at each release.
|
|||
* packweb-apache: choose mysql variant (default: `debian`)
|
||||
* haproxy: install Munin plugins
|
||||
* proftpd: use proftpd_accounts list for manage ftp accounts
|
||||
|
||||
* etc-git: add tags for Ansible
|
||||
|
||||
### Changed
|
||||
* elasticsearch: use ES_TMPDIR variable for custom tmpdir, (from `/etc/default/elasticsearch` instead of changing `/etc/elesticsearch/jvm.options`).
|
||||
|
|
|
@ -8,13 +8,15 @@
|
|||
when: not ansible_check_mode
|
||||
ignore_errors: yes
|
||||
tags:
|
||||
- commit-etc
|
||||
- etc-git
|
||||
- commit-etc
|
||||
|
||||
- debug:
|
||||
var: git_status
|
||||
verbosity: 3
|
||||
tags:
|
||||
- commit-etc
|
||||
- etc-git
|
||||
- commit-etc
|
||||
|
||||
- name: fetch current Git user.email
|
||||
git_config:
|
||||
|
@ -22,11 +24,17 @@
|
|||
repo: /etc
|
||||
register: git_config_user_email
|
||||
ignore_errors: yes
|
||||
tags:
|
||||
- etc-git
|
||||
- commit-etc
|
||||
|
||||
- name: "set commit author"
|
||||
set_fact:
|
||||
commit_author: '{% if ansible_env.SUDO_USER is not defined %}root{% else %}{{ ansible_env.SUDO_USER }}{% endif %}'
|
||||
commit_email: '{% if git_config_user_email.config_value is not defined or git_config_user_email.config_value == "" %}root@localhost{% else %}{{ git_config_user_email.config_value }}{% endif %}'
|
||||
tags:
|
||||
- etc-git
|
||||
- commit-etc
|
||||
|
||||
- name: "/etc modifications are committed"
|
||||
shell: "git add -A . && git commit -m \"{{ commit_message | mandatory }}\" --author \"{{ commit_author | mandatory }} <{{ commit_email | mandatory }}>\""
|
||||
|
@ -36,10 +44,12 @@
|
|||
when: not ansible_check_mode and git_status.stdout != ""
|
||||
ignore_errors: yes
|
||||
tags:
|
||||
- commit-etc
|
||||
- etc-git
|
||||
- commit-etc
|
||||
|
||||
- debug:
|
||||
var: etc_commit_end_run
|
||||
verbosity: 4
|
||||
tags:
|
||||
- commit-etc
|
||||
- etc-git
|
||||
- commit-etc
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
apt:
|
||||
name: git
|
||||
state: present
|
||||
tags:
|
||||
- etc-git
|
||||
|
||||
- name: /etc is versioned with git
|
||||
command: "git init ."
|
||||
|
@ -12,6 +14,8 @@
|
|||
creates: /etc/.git/
|
||||
warn: no
|
||||
register: git_init
|
||||
tags:
|
||||
- etc-git
|
||||
|
||||
- name: Git user.email is configured
|
||||
git_config:
|
||||
|
@ -19,6 +23,8 @@
|
|||
repo: /etc
|
||||
scope: local
|
||||
value: "root@{{ ansible_fqdn | default('localhost') }}"
|
||||
tags:
|
||||
- etc-git
|
||||
|
||||
- name: /etc/.git is secure
|
||||
file:
|
||||
|
@ -26,6 +32,8 @@
|
|||
owner: root
|
||||
mode: "0700"
|
||||
state: directory
|
||||
tags:
|
||||
- etc-git
|
||||
|
||||
- name: /etc/.gitignore is present
|
||||
copy:
|
||||
|
@ -33,6 +41,8 @@
|
|||
dest: /etc/.gitignore
|
||||
owner: root
|
||||
mode: "0600"
|
||||
tags:
|
||||
- etc-git
|
||||
|
||||
- name: does /etc/ have any commit?
|
||||
command: "git log"
|
||||
|
@ -43,6 +53,8 @@
|
|||
failed_when: False
|
||||
register: git_log
|
||||
check_mode: no
|
||||
tags:
|
||||
- etc-git
|
||||
|
||||
- name: initial commit is present?
|
||||
shell: "git add -A . && git commit -m \"Initial commit via Ansible\""
|
||||
|
@ -51,3 +63,5 @@
|
|||
warn: no
|
||||
register: git_commit
|
||||
when: git_log.rc != 0 or (git_init is defined and git_init.changed)
|
||||
tags:
|
||||
- etc-git
|
||||
|
|
Loading…
Add table
Reference in a new issue