Changes between Version 10 and Version 11 of Csle2022/Agenda/Ansible
- Timestamp:
- Nov 11, 2022, 6:27:22 AM (2 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Csle2022/Agenda/Ansible
v10 v11 85 85 '''Create the Playbook - In control node''' 86 86 87 {{{ 88 nano <playbook name>.yml 89 }}} 87 90 91 {{{ 92 - name: setup mysql 93 become: yes 94 hosts: Dbservers 95 vars: 96 - user: test 97 - password: M@#567uers 98 - db: testdb 99 tasks: 100 - name: installing mysql and dependencies 101 package: 102 name: "{{item}}" 103 state: present 104 update_cache: yes 105 loop: 106 - mysql-server 107 - mysql-client 108 - python3-mysqldb 109 - libmysqlclient-dev 110 become: yes 111 - name: start and enable mysql service 112 service: 113 name: mysql 114 state: started 115 enabled: yes 116 - name: creating mysql user 117 mysql_user: 118 name: "{{user}}" 119 password: "{{password}}" 120 priv: '*.*:ALL' 121 host: '%' 122 state: present 123 - name: creating db 124 mysql_db: 125 name: "{{db}}" 126 state: present 127 handlers: 128 - name: restart mysql 129 service: 130 name: mysql 131 state: restarted 132 }}} 88 133 89 134 '''Run the Playbook - In control node'''