mirror of https://github.com/jumpserver/jumpserver
perf: Ansible playbook
parent
daea434ce6
commit
13e5a03312
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mongodb
|
- hosts: mongodb
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test MongoDB connection
|
- name: Test MongoDB connection
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mysql
|
- hosts: mysql
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
db_name: "{{ jms_asset.spec_info.db_name }}"
|
db_name: "{{ jms_asset.spec_info.db_name }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: oracle
|
- hosts: oracle
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test Oracle connection
|
- name: Test Oracle connection
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: postgre
|
- hosts: postgre
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
||||||
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: sqlserver
|
- hosts: sqlserver
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test SQLServer connection
|
- name: Test SQLServer connection
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
database: passwd
|
database: passwd
|
||||||
key: "{{ account.username }}"
|
key: "{{ account.username }}"
|
||||||
register: user_info
|
register: user_info
|
||||||
ignore_errors: yes # 忽略错误,如果用户不存在时不会导致playbook失败
|
failed_when: false
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
- name: "Add {{ account.username }} user"
|
- name: "Add {{ account.username }} user"
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
|
@ -18,10 +19,10 @@
|
||||||
shell: "{{ params.shell if params.shell | length > 0 else omit }}"
|
shell: "{{ params.shell if params.shell | length > 0 else omit }}"
|
||||||
home: "{{ params.home if params.home | length > 0 else '/home/' + account.username }}"
|
home: "{{ params.home if params.home | length > 0 else '/home/' + account.username }}"
|
||||||
groups: "{{ params.groups if params.groups | length > 0 else omit }}"
|
groups: "{{ params.groups if params.groups | length > 0 else omit }}"
|
||||||
append: yes
|
append: "{{ true if params.groups | length > 0 else false }}"
|
||||||
expires: -1
|
expires: -1
|
||||||
state: present
|
state: present
|
||||||
when: user_info.failed
|
when: user_info.msg is defined
|
||||||
|
|
||||||
- name: "Set {{ account.username }} sudo setting"
|
- name: "Set {{ account.username }} sudo setting"
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
line: "{{ account.username + ' ALL=(ALL) NOPASSWD: ' + params.sudo }}"
|
line: "{{ account.username + ' ALL=(ALL) NOPASSWD: ' + params.sudo }}"
|
||||||
validate: visudo -cf %s
|
validate: visudo -cf %s
|
||||||
when:
|
when:
|
||||||
- user_info.failed or params.modify_sudo
|
- user_info.msg is defined or params.modify_sudo
|
||||||
- params.sudo
|
- params.sudo
|
||||||
|
|
||||||
- name: "Change {{ account.username }} password"
|
- name: "Change {{ account.username }} password"
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
database: passwd
|
database: passwd
|
||||||
key: "{{ account.username }}"
|
key: "{{ account.username }}"
|
||||||
register: user_info
|
register: user_info
|
||||||
ignore_errors: yes # 忽略错误,如果用户不存在时不会导致playbook失败
|
failed_when: false
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
- name: "Add {{ account.username }} user"
|
- name: "Add {{ account.username }} user"
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
|
@ -18,10 +19,10 @@
|
||||||
shell: "{{ params.shell if params.shell | length > 0 else omit }}"
|
shell: "{{ params.shell if params.shell | length > 0 else omit }}"
|
||||||
home: "{{ params.home if params.home | length > 0 else '/home/' + account.username }}"
|
home: "{{ params.home if params.home | length > 0 else '/home/' + account.username }}"
|
||||||
groups: "{{ params.groups if params.groups | length > 0 else omit }}"
|
groups: "{{ params.groups if params.groups | length > 0 else omit }}"
|
||||||
append: yes
|
append: "{{ true if params.groups | length > 0 else false }}"
|
||||||
expires: -1
|
expires: -1
|
||||||
state: present
|
state: present
|
||||||
when: user_info.failed
|
when: user_info.msg is defined
|
||||||
|
|
||||||
- name: "Set {{ account.username }} sudo setting"
|
- name: "Set {{ account.username }} sudo setting"
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
line: "{{ account.username + ' ALL=(ALL) NOPASSWD: ' + params.sudo }}"
|
line: "{{ account.username + ' ALL=(ALL) NOPASSWD: ' + params.sudo }}"
|
||||||
validate: visudo -cf %s
|
validate: visudo -cf %s
|
||||||
when:
|
when:
|
||||||
- user_info.failed or params.modify_sudo
|
- user_info.msg is defined or params.modify_sudo
|
||||||
- params.sudo
|
- params.sudo
|
||||||
|
|
||||||
- name: "Change {{ account.username }} password"
|
- name: "Change {{ account.username }} password"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mongodb
|
- hosts: mongodb
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Get info
|
- name: Get info
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mysql
|
- hosts: mysql
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
ssl_cert: "{{ jms_asset.secret_info.client_cert | default('') }}"
|
ssl_cert: "{{ jms_asset.secret_info.client_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: oralce
|
- hosts: oralce
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Get info
|
- name: Get info
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: postgresql
|
- hosts: postgresql
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
||||||
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: sqlserver
|
- hosts: sqlserver
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test SQLServer connection
|
- name: Test SQLServer connection
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mongodb
|
- hosts: mongodb
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test MongoDB connection
|
- name: Test MongoDB connection
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mysql
|
- hosts: mysql
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
db_name: "{{ jms_asset.spec_info.db_name }}"
|
db_name: "{{ jms_asset.spec_info.db_name }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: oracle
|
- hosts: oracle
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test Oracle connection
|
- name: Test Oracle connection
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: postgre
|
- hosts: postgre
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
||||||
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: sqlserver
|
- hosts: sqlserver
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test SQLServer connection
|
- name: Test SQLServer connection
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
database: passwd
|
database: passwd
|
||||||
key: "{{ account.username }}"
|
key: "{{ account.username }}"
|
||||||
register: user_info
|
register: user_info
|
||||||
ignore_errors: yes # 忽略错误,如果用户不存在时不会导致playbook失败
|
failed_when: false
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
- name: "Add {{ account.username }} user"
|
- name: "Add {{ account.username }} user"
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
|
@ -18,10 +19,10 @@
|
||||||
shell: "{{ params.shell if params.shell | length > 0 else omit }}"
|
shell: "{{ params.shell if params.shell | length > 0 else omit }}"
|
||||||
home: "{{ params.home if params.home | length > 0 else '/home/' + account.username }}"
|
home: "{{ params.home if params.home | length > 0 else '/home/' + account.username }}"
|
||||||
groups: "{{ params.groups if params.groups | length > 0 else omit }}"
|
groups: "{{ params.groups if params.groups | length > 0 else omit }}"
|
||||||
append: yes
|
append: "{{ true if params.groups | length > 0 else false }}"
|
||||||
expires: -1
|
expires: -1
|
||||||
state: present
|
state: present
|
||||||
when: user_info.failed
|
when: user_info.msg is defined
|
||||||
|
|
||||||
- name: "Set {{ account.username }} sudo setting"
|
- name: "Set {{ account.username }} sudo setting"
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
line: "{{ account.username + ' ALL=(ALL) NOPASSWD: ' + params.sudo }}"
|
line: "{{ account.username + ' ALL=(ALL) NOPASSWD: ' + params.sudo }}"
|
||||||
validate: visudo -cf %s
|
validate: visudo -cf %s
|
||||||
when:
|
when:
|
||||||
- user_info.failed or params.modify_sudo
|
- user_info.msg is defined or params.modify_sudo
|
||||||
- params.sudo
|
- params.sudo
|
||||||
|
|
||||||
- name: "Change {{ account.username }} password"
|
- name: "Change {{ account.username }} password"
|
||||||
|
|
|
@ -9,7 +9,8 @@
|
||||||
database: passwd
|
database: passwd
|
||||||
key: "{{ account.username }}"
|
key: "{{ account.username }}"
|
||||||
register: user_info
|
register: user_info
|
||||||
ignore_errors: yes # 忽略错误,如果用户不存在时不会导致playbook失败
|
failed_when: false
|
||||||
|
changed_when: false
|
||||||
|
|
||||||
- name: "Add {{ account.username }} user"
|
- name: "Add {{ account.username }} user"
|
||||||
ansible.builtin.user:
|
ansible.builtin.user:
|
||||||
|
@ -18,10 +19,10 @@
|
||||||
shell: "{{ params.shell if params.shell | length > 0 else omit }}"
|
shell: "{{ params.shell if params.shell | length > 0 else omit }}"
|
||||||
home: "{{ params.home if params.home | length > 0 else '/home/' + account.username }}"
|
home: "{{ params.home if params.home | length > 0 else '/home/' + account.username }}"
|
||||||
groups: "{{ params.groups if params.groups | length > 0 else omit }}"
|
groups: "{{ params.groups if params.groups | length > 0 else omit }}"
|
||||||
append: yes
|
append: "{{ true if params.groups | length > 0 else false }}"
|
||||||
expires: -1
|
expires: -1
|
||||||
state: present
|
state: present
|
||||||
when: user_info.failed
|
when: user_info.msg is defined
|
||||||
|
|
||||||
- name: "Set {{ account.username }} sudo setting"
|
- name: "Set {{ account.username }} sudo setting"
|
||||||
ansible.builtin.lineinfile:
|
ansible.builtin.lineinfile:
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
line: "{{ account.username + ' ALL=(ALL) NOPASSWD: ' + params.sudo }}"
|
line: "{{ account.username + ' ALL=(ALL) NOPASSWD: ' + params.sudo }}"
|
||||||
validate: visudo -cf %s
|
validate: visudo -cf %s
|
||||||
when:
|
when:
|
||||||
- user_info.failed or params.modify_sudo
|
- user_info.msg is defined or params.modify_sudo
|
||||||
- params.sudo
|
- params.sudo
|
||||||
|
|
||||||
- name: "Change {{ account.username }} password"
|
- name: "Change {{ account.username }} password"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mongodb
|
- hosts: mongodb
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Remove account"
|
- name: "Remove account"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mysql
|
- hosts: mysql
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
ssl_cert: "{{ jms_asset.secret_info.client_cert | default('') }}"
|
ssl_cert: "{{ jms_asset.secret_info.client_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: oracle
|
- hosts: oracle
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Remove account"
|
- name: "Remove account"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: postgresql
|
- hosts: postgresql
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
||||||
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: sqlserver
|
- hosts: sqlserver
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: "Remove account"
|
- name: "Remove account"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mongodb
|
- hosts: mongodb
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Verify account
|
- name: Verify account
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mysql
|
- hosts: mysql
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
ssl_cert: "{{ jms_asset.secret_info.client_cert | default('') }}"
|
ssl_cert: "{{ jms_asset.secret_info.client_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: oracle
|
- hosts: oracle
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Verify account
|
- name: Verify account
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: postgresql
|
- hosts: postgresql
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
||||||
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: sqlserver
|
- hosts: sqlserver
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Verify account
|
- name: Verify account
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mongodb
|
- hosts: mongodb
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Get info
|
- name: Get info
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mysql
|
- hosts: mysql
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
ssl_cert: "{{ jms_asset.secret_info.client_cert | default('') }}"
|
ssl_cert: "{{ jms_asset.secret_info.client_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: oracle
|
- hosts: oracle
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Get info
|
- name: Get info
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: postgresql
|
- hosts: postgresql
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
||||||
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mongodb
|
- hosts: mongodb
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test MongoDB connection
|
- name: Test MongoDB connection
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: mysql
|
- hosts: mysql
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
ssl_cert: "{{ jms_asset.secret_info.client_cert | default('') }}"
|
ssl_cert: "{{ jms_asset.secret_info.client_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: oracle
|
- hosts: oracle
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test Oracle connection
|
- name: Test Oracle connection
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: postgre
|
- hosts: postgre
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
check_ssl: "{{ jms_asset.spec_info.use_ssl }}"
|
||||||
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
check_ca: "{{ check_ssl and not jms_asset.spec_info.allow_invalid_cert }}"
|
||||||
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
ca_cert: "{{ jms_asset.secret_info.ca_cert | default('') }}"
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
- hosts: sqlserver
|
- hosts: sqlserver
|
||||||
gather_facts: no
|
gather_facts: no
|
||||||
vars:
|
vars:
|
||||||
ansible_python_interpreter: /opt/py3/bin/python
|
ansible_python_interpreter: "{{ local_python_interpreter }}"
|
||||||
|
|
||||||
tasks:
|
tasks:
|
||||||
- name: Test SQLServer connection
|
- name: Test SQLServer connection
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
import json
|
import json
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import sys
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
from django.utils.translation import gettext as _
|
from django.utils.translation import gettext as _
|
||||||
|
@ -191,6 +192,7 @@ class JMSInventory:
|
||||||
secret_info = {k: v for k, v in asset.secret_info.items() if v}
|
secret_info = {k: v for k, v in asset.secret_info.items() if v}
|
||||||
host = {
|
host = {
|
||||||
'name': name,
|
'name': name,
|
||||||
|
'local_python_interpreter': sys.executable,
|
||||||
'jms_asset': {
|
'jms_asset': {
|
||||||
'id': str(asset.id), 'name': asset.name, 'address': asset.address,
|
'id': str(asset.id), 'name': asset.name, 'address': asset.address,
|
||||||
'type': tp, 'category': category,
|
'type': tp, 'category': category,
|
||||||
|
|
Loading…
Reference in New Issue