瀏覽代碼

new local fact scheme

master
父節點
當前提交
2b31dddd8d
共有 3 個檔案被更改,包括 8 行新增6 行删除
  1. +1
    -1
      defaults/main.yml
  2. +5
    -3
      tasks/local_facts.yaml
  3. +2
    -2
      vars/main.yml

+ 1
- 1
defaults/main.yml 查看文件

@@ -16,4 +16,4 @@ gitea_admin_email: admin@example.com

gitea_db_name: gitea
gitea_db_user: gitea
gitea_db_pass: "{{ ansible_local.gitea.database_password }}"
gitea_db_pass: "{{ ansible_local[role_name].database_password }}"

+ 5
- 3
tasks/local_facts.yaml 查看文件

@@ -5,10 +5,12 @@
path: /etc/ansible/facts.d
state: directory

- name: set ansible local fact for gitea
- name: set ansible local fact
copy:
content: "{{_gitea_local_facts|to_json}}"
dest: /etc/ansible/facts.d/gitea.fact
content: "{{_local_facts|to_json}}"
dest: /etc/ansible/facts.d/{{role_name}}.fact
register: _local_facts_set

- name: Gathering Facts
setup:
when: _local_facts_set.changed

+ 2
- 2
vars/main.yml 查看文件

@@ -1,5 +1,5 @@
_gitea_local_facts:
database_password: "{% if not ansible_local.gitea.database_password is defined %}{{ lookup('password', '/dev/null length=16 chars=ascii_letters') }}{% else %}{{ ansible_local.gitea.database_password }}{% endif %}"
_local_facts:
database_password: "{% if not ansible_local[role_name].database_password is defined %}{{ lookup('password', '/dev/null length=16 chars=ascii_letters') }}{% else %}{{ ansible_local[role_name].database_password }}{% endif %}"

_gitea_nginx_vhosts:
- name: gitea


Loading…
取消
儲存