1---2- name:1-addgroup mysql3group:4name: mysql5gid:3366system: yes7state: present89- name:2-adduser mysql10user:11name: mysql12uid:33613group: mysql14shell: /sbin/nologin15home: /data/mysql16system: yes1718- name:3-ungiz mariadb to remote19unarchive:20src: mariadb-10.2.23-linux...
TASK [mariadb : install mariadb] *** ok: [192.168.30.25] ok: [192.168.30.26] TASK [mariadb : move config file] *** changed: [192.168.30.25] changed: [192.168.30.26] TASK [mariadb : provide a new config file] ***
[mariadb] name = MariaDB baseurl = http://yum.mariadb.org/10.3/centos7-amd64 gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB gpgcheck=1 1. 2. 3. 4. 5. 把二进制压缩包下载下来,解压放在files文件里 目录结构如下: 创建用户,组,家目录: cat create_group.yml - name: create group ...
when: mysql_role == "salve" - name: start slave shell: mysql -e "start slave " when: mysql_role == "salve" 执行 ansible-playbook -i hosts auto_install_mariadb.yml 参考资料: github.com/ansible/ansi【ansible 安装mongodb示例】 https://docs.ansible.com/ansible/latest/user_guide/playbooks...
Ansible个人学习roles使用实践(mariadb安装) 备注:文章事例部分代码会出现不对齐的情况,使用时,请注意格式对齐!! role用法 角色(roles)是用于层次性,结构化地组织playbook,roles就是通过分别将变量、文件、任务、模块及处理器放置于单独的目录中、并可以便捷地include他们的一种机制。
service:name:mariadb state:restarted 10、在主机列表中创建两个组 [root@localhost~]# cat/etc/ansible/hosts[web]192.168.34.7[mysql]192.168.34.17192.168.34.27 11、使用ansible-playbook调用roles [root@localhost~]# cat app.yml -hosts:webremote_user:rootroles:- app ...
Ansible Tower是使用Ansible playbook来部署的,首先需要配置一下inventory,配置内容如下: [tower] localhost ansible_connection=local [database] [all:vars] admin_password='AdminPassword' pg_host='' pg_port='' pg_database='awx' pg_username='awx' ...
shell: rpm -ev mariadb-libs-5.5.35-3.el7.x86_64 --nodeps || /usr/bin/true ignore_errors: yes - name: yum_install_local shell: cd /tmp/gcc-c++ && yum -y install *.rpm || /usr/bin/true - name: shutdown hugepage shell: echo never > /sys/kernel/mm/transparent_hugepage/enable...
mariadb_users: - name: john password: letmein priv: '*.*:ALL,GRANT' - name: jack password: sekrit priv: 'jacksdb.*:ALL' append_privs: 'yes' host: '192.168.56.%' Dependencies No dependencies. Example Playbook See the test playbook Testing This role can be tested using Ansible Molecule...
This role describes how to setup nodes of a cluster using Galera. "mariadb-replica" for the members of "db-analytics". It describes a running replica, and it includes the tasks that are necessary to provision the node if the data directory is empty when the playbook is applied. The ...