change git repo check
This commit is contained in:
parent
c4d0a9d83b
commit
3d1193d67e
@ -42,12 +42,9 @@
|
||||
# with_items: "{{ hass_user }}"
|
||||
|
||||
- name: check repo
|
||||
|
||||
git:
|
||||
repo: "{{hass_repo}}"
|
||||
dest: "{{hass_conf_folder}}"
|
||||
clone: no
|
||||
update: no
|
||||
become: yes
|
||||
stat:
|
||||
path: "{{hass_conf_folder}}/.git" # required. The full path of the file/object to get the facts of.
|
||||
register: hass_repo_exist
|
||||
|
||||
- name: clean conf folder if repo not exist
|
||||
@ -55,6 +52,7 @@
|
||||
file:
|
||||
path: "{{hass_conf_folder}}"
|
||||
state: absent
|
||||
when: hass_repo_exist.stat.exists == false
|
||||
|
||||
- name: recreate conf folder
|
||||
become: yes
|
||||
@ -62,7 +60,7 @@
|
||||
path: "{{hass_conf_folder}}"
|
||||
state: directory
|
||||
owner: "{{user.name}}"
|
||||
|
||||
when: hass_repo_exist.stat.exists == false
|
||||
|
||||
- name: install conf file
|
||||
git:
|
||||
@ -71,6 +69,7 @@
|
||||
clone: yes # not required. If C(no), do not clone the repository if it does not exist locally
|
||||
version: "{{hass_repo_branch}}"
|
||||
notify: restart hass
|
||||
when: hass_repo_exist.stat.exists == false
|
||||
|
||||
- name: change owner
|
||||
become: yes
|
||||
@ -89,11 +88,12 @@
|
||||
notify: restart fail2ban
|
||||
become: yes
|
||||
|
||||
- name: create cron for dyndns
|
||||
- name: create cron for hass
|
||||
cron:
|
||||
job: "sh {{{{hass_conf_folder}}/backup_git.sh"
|
||||
job: "sh {{hass_conf_folder}}/backup_git.sh"
|
||||
user: root # not required. The specific user whose crontab should be modified.
|
||||
minute: 00 03 * * * # not required. Minute when the job should run ( 0-59, *, */2, etc )
|
||||
minute: "0" # not required. Minute when the job should run ( 0-59, *, */2, etc )
|
||||
hour: "3"
|
||||
name: "auto commit HASS config" # not required. Description of a crontab entry or, if env is set, the name of environment variable. Required if state=absent. Note that if name is not set and state=present, then a new crontab entry will always be created, regardless of existing ones.
|
||||
become: yes
|
||||
|
||||
|
@ -6,4 +6,4 @@ filter = hass
|
||||
logpath = {{hass_conf_folder}}/home-assistant.log
|
||||
findtime = 3600
|
||||
# Maximum amount of login attempts before IP is blocked
|
||||
maxretry = 3
|
||||
maxretry = 5
|
Loading…
Reference in New Issue
Block a user