feat: 账号推送附加参数 (#10080)

* feat: 账号推送附加参数

* perf: 通过节点 资产 过滤平台api

* perf: push automation params

* perf: 修改playbook

* perf: params serializer

* perf: 账号推送playbook 调整

* perf: Automation serializer add params field

* perf: params 非必填

* perf: 添加is_params 给前端判断

* perf: is_params bool

* perf: 修改push account ansible逻辑

* perf: 修改获取push_kwargs方法

* perf: platform migrate

* perf: 修改api

* perf: 单个推送

* perf: push account

* perf: 修改asset auto_config

---------

Co-authored-by: feng <1304903146@qq.com>
Co-authored-by: feng626 <57284900+feng626@users.noreply.github.com>
This commit is contained in:
fit2bot
2023-04-13 19:02:04 +08:00
committed by GitHub
parent 8e81aee1fd
commit 1eb8e40d3e
37 changed files with 799 additions and 70 deletions

View File

@@ -0,0 +1,43 @@
- hosts: mysql
gather_facts: no
vars:
ansible_python_interpreter: /usr/local/bin/python
db_name: "{{ jms_asset.spec_info.db_name }}"
tasks:
- name: Test MySQL connection
community.mysql.mysql_info:
login_user: "{{ jms_account.username }}"
login_password: "{{ jms_account.secret }}"
login_host: "{{ jms_asset.address }}"
login_port: "{{ jms_asset.port }}"
filter: version
register: db_info
- name: MySQL version
debug:
var: db_info.version.full
- name: Change MySQL password
community.mysql.mysql_user:
login_user: "{{ jms_account.username }}"
login_password: "{{ jms_account.secret }}"
login_host: "{{ jms_asset.address }}"
login_port: "{{ jms_asset.port }}"
name: "{{ account.username }}"
password: "{{ account.secret }}"
host: "%"
priv: "{{ account.username + '.*:USAGE' if db_name == '' else db_name + '.*:ALL' }}"
when: db_info is succeeded
register: change_info
- name: Verify password
community.mysql.mysql_info:
login_user: "{{ account.username }}"
login_password: "{{ account.secret }}"
login_host: "{{ jms_asset.address }}"
login_port: "{{ jms_asset.port }}"
filter: version
when:
- db_info is succeeded
- change_info is succeeded

View File

@@ -0,0 +1,7 @@
id: push_account_mysql
name: Push account for MySQL
category: database
type:
- mysql
- mariadb
method: push_account