diff --git a/playbook/groups_vars/all b/playbook/groups_vars/all index 2e4eac293f1976f7067f19b0a851718d02f461db..1fb59b79bb6b9e35544e3cfefc9d3d4136086764 100644 --- a/playbook/groups_vars/all +++ b/playbook/groups_vars/all @@ -1,2 +1,3 @@ --- -mysql_password: "PilotGo13579!" \ No newline at end of file +mysql_password: "PilotGo13579!" +redis_password: "PilotGo13579!" \ No newline at end of file diff --git a/playbook/multi-machine.yml b/playbook/multi-machine.yml index d9fca0f2b766cf61c4201aa5a3e69e8841ba5b54..e24e2889ef1fa8b4b96803fbee1d6fa8fd552d55 100644 --- a/playbook/multi-machine.yml +++ b/playbook/multi-machine.yml @@ -14,3 +14,21 @@ password: '{{ mysql_password }}' priv: '*.*:ALL,GRANT' state: present +- name: install redis for PilotGo platform + hosts: reids + become: yes + become_user: root + + roles: + - redis + tasks: + - name: change protected mode + lineinfile: + path: /etc/redis/redis.conf + regexp: '^#?protected-mode' + line: 'protected-mode no' + backrefs: yes + - name: restart redis service + service: + name: redis + state: restarted \ No newline at end of file diff --git a/playbook/roles/redis/tasks/main.yml b/playbook/roles/redis/tasks/main.yml index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..05f29f5964f6acc196dfb209d02b96238fd1bc79 100644 --- a/playbook/roles/redis/tasks/main.yml +++ b/playbook/roles/redis/tasks/main.yml @@ -0,0 +1,37 @@ +--- +- name: check redis rpm + shell: rpm -qa | grep -e '^redis*4*' + register: rpm_info + ignore_errors: yes +- name: uninstall redis4 + dnf: + name: redis + state: absent + when: rpm_info.rc == 0 +- name: install redis 6 through euler repo + dnf: + name: redis-6* + state: present + ignore_errors: yes +- name: change bind + lineinfile: + path: /etc/redis/redis.conf + regexp: '^#?bind' + line: 'bind {{ groups["redis"][0] }}' + backrefs: yes +- name: change daemonize + lineinfile: + path: /etc/redis/redis.conf + regexp: '^#?daemonize' + line: 'daemonize yes' + backrefs: yes +- name: change passwd + lineinfile: + path: /etc/redis/redis.conf + regexp: '^#?requirepass' + line: 'requirepass {{ redis_password }}' + backrefs: yes +- name: restart redis service + service: + name: redis + state: restarted \ No newline at end of file