diff --git a/playbook/groups_vars/all b/playbook/groups_vars/all new file mode 100644 index 0000000000000000000000000000000000000000..2e4eac293f1976f7067f19b0a851718d02f461db --- /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 0000000000000000000000000000000000000000..9ee0aa60706de3d471da5c6324b30003bd1567fc --- /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 0000000000000000000000000000000000000000..37dca1ce59c0ec9496f3e336bc3e864eb0f911a7 --- /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