Ensure tasks don't get set to changed uselessly

This commit is contained in:
dogeystamp 2022-03-04 09:02:48 -05:00
parent d7876c6a65
commit 77ef40aae6
Signed by: dogeystamp
GPG Key ID: 7225FE3592EFFA38
2 changed files with 16 additions and 3 deletions

View File

@ -49,6 +49,7 @@
ifname: "{{ interface }}"
type: ethernet
register: nmcli_conf
changed_when: false
poll: 0
async: 1000

View File

@ -9,6 +9,10 @@
dest: /etc/gitea/app.ini
notify: Restart gitea
- name: Set data path
set_fact:
data_path: "{{ dataroot }}/gitea/"
- name: Change systemd unit file to allow access to dataroot
lineinfile:
path: /usr/lib/systemd/system/gitea.service
@ -20,28 +24,36 @@
- name: Find owner of data folder
stat:
path: "{{ dataroot }}/gitea/"
path: "{{ data_path }}"
register: data_folder
- name: Ensure data folder is under correct owner
file:
path: "{{ dataroot }}/gitea/"
path: "{{ data_path }}"
state: directory
recurse: yes
owner: gitea
group: gitea
when: data_folder.stat.pw_name != "gitea"
- name: Get gitea user information
user:
name: gitea
state: present
register: gitea_user
- name: Ensure gitea is stopped
service:
name: gitea
state: stopped
when: gitea_user.home != data_path[:-1]
- name: Change homedir of gitea
user:
name: gitea
home: "{{ dataroot }}/gitea/"
home: "{{ data_path }}"
notify: Restart gitea
when: gitea_user.home != data_path[:-1]
- name: Enable gitea
service: