From 36728decb7788813a23e6a284df9f5497d83db04 Mon Sep 17 00:00:00 2001 From: wangjian Date: Mon, 18 Nov 2024 16:45:12 +0800 Subject: [PATCH] init playbook files and add mysql install --- playbook/groups_vars/all | 2 ++ playbook/host-standalone | 2 ++ playbook/standalone.yml | 31 +++++++++++++++++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 playbook/groups_vars/all create mode 100644 playbook/host-standalone create mode 100644 playbook/standalone.yml diff --git a/playbook/groups_vars/all b/playbook/groups_vars/all new file mode 100644 index 0000000..2e4eac2 --- /dev/null +++ b/playbook/groups_vars/all @@ -0,0 +1,2 @@ +--- +mysql_password: "PilotGo13579!" \ No newline at end of file diff --git a/playbook/host-standalone b/playbook/host-standalone new file mode 100644 index 0000000..9ee0aa6 --- /dev/null +++ b/playbook/host-standalone @@ -0,0 +1,2 @@ +[standalone] +1.1.1.1 \ No newline at end of file diff --git a/playbook/standalone.yml b/playbook/standalone.yml new file mode 100644 index 0000000..37dca1c --- /dev/null +++ b/playbook/standalone.yml @@ -0,0 +1,31 @@ +--- +- name: install pilotgo & topo plugin standlone + hosts: standalone + remote_user: root + + tasks: + - name: install mysql through euler repo + dnf: + name: "{{ item }}" + state: present + with_items: + - mysql-server + - python3-pexpect + ignore_errors: yes + - name: start mysql + service: + name: mysqld + state: restarted + - name: change passwd + expect: + command: mysqladmin -u root -p password '{{ mysql_password }}' + responses: + (?i)password: "\n" + vars: + ansible_python_interpreter: /usr/bin/python3 + register: info + ignore_errors: yes + - name: change passwd + debug: + msg: '{{ info.stdout_lines }} mysql already has password' + when: info.rc != 0 -- Gitee