change git repo check
This commit is contained in:
parent
c4d0a9d83b
commit
3d1193d67e
@ -42,12 +42,9 @@
|
|||||||
# with_items: "{{ hass_user }}"
|
# with_items: "{{ hass_user }}"
|
||||||
|
|
||||||
- name: check repo
|
- name: check repo
|
||||||
|
become: yes
|
||||||
git:
|
stat:
|
||||||
repo: "{{hass_repo}}"
|
path: "{{hass_conf_folder}}/.git" # required. The full path of the file/object to get the facts of.
|
||||||
dest: "{{hass_conf_folder}}"
|
|
||||||
clone: no
|
|
||||||
update: no
|
|
||||||
register: hass_repo_exist
|
register: hass_repo_exist
|
||||||
|
|
||||||
- name: clean conf folder if repo not exist
|
- name: clean conf folder if repo not exist
|
||||||
@ -55,14 +52,15 @@
|
|||||||
file:
|
file:
|
||||||
path: "{{hass_conf_folder}}"
|
path: "{{hass_conf_folder}}"
|
||||||
state: absent
|
state: absent
|
||||||
|
when: hass_repo_exist.stat.exists == false
|
||||||
|
|
||||||
- name: recreate conf folder
|
- name: recreate conf folder
|
||||||
become: yes
|
become: yes
|
||||||
file:
|
file:
|
||||||
path: "{{hass_conf_folder}}"
|
path: "{{hass_conf_folder}}"
|
||||||
state: directory
|
state: directory
|
||||||
owner: "{{user.name}}"
|
owner: "{{user.name}}"
|
||||||
|
when: hass_repo_exist.stat.exists == false
|
||||||
|
|
||||||
- name: install conf file
|
- name: install conf file
|
||||||
git:
|
git:
|
||||||
@ -71,6 +69,7 @@
|
|||||||
clone: yes # not required. If C(no), do not clone the repository if it does not exist locally
|
clone: yes # not required. If C(no), do not clone the repository if it does not exist locally
|
||||||
version: "{{hass_repo_branch}}"
|
version: "{{hass_repo_branch}}"
|
||||||
notify: restart hass
|
notify: restart hass
|
||||||
|
when: hass_repo_exist.stat.exists == false
|
||||||
|
|
||||||
- name: change owner
|
- name: change owner
|
||||||
become: yes
|
become: yes
|
||||||
@ -89,11 +88,12 @@
|
|||||||
notify: restart fail2ban
|
notify: restart fail2ban
|
||||||
become: yes
|
become: yes
|
||||||
|
|
||||||
- name: create cron for dyndns
|
- name: create cron for hass
|
||||||
cron:
|
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.
|
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.
|
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
|
become: yes
|
||||||
|
|
||||||
|
@ -6,4 +6,4 @@ filter = hass
|
|||||||
logpath = {{hass_conf_folder}}/home-assistant.log
|
logpath = {{hass_conf_folder}}/home-assistant.log
|
||||||
findtime = 3600
|
findtime = 3600
|
||||||
# Maximum amount of login attempts before IP is blocked
|
# Maximum amount of login attempts before IP is blocked
|
||||||
maxretry = 3
|
maxretry = 5
|
Loading…
Reference in New Issue
Block a user