# ansible-collection-thinkphp **Repository Path**: thinkphp-tech/ansible-collection-thinkphp ## Basic Information - **Project Name**: ansible-collection-thinkphp - **Description**: No description available - **Primary Language**: Unknown - **License**: Apache-2.0 - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-06-23 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Ansible Collections - thinkphp_tech.thinkphp | [English](README.md) thinkphp (v6.x) 框架相关的 ansible 集合 [](./LICENSE) ## Table of Contents 1. [介绍](#chapter-1) 2. [技术概况](#chapter-2)
2.1. [PHP 扩展和工具](#chapter-2-1)
2.2. [支持的操作系统](#chapter-2-3) 1. [快速开始](#chapter-3) 2. [软件清单](#chapter-4)
4.1. [Web 服务](#chapter-4-1)
4.2. [数据库服务](#chapter-4-2)
4.3. [键值和队列服务](#chapter-4-3)
4.4. [PHP 以及扩展](#chapter-4-4)
4.5. [其他](#chapter-4-5) ## 1. 介绍 thinkphp (v6.x) 框架相关的 ansible 集合,包括安装 swoole、pecl、composer。 ## 2. 技术概况 ### 2.1. PHP 扩展和工具 * swoole - PHP 携程框架 * pecl - PHP 扩展库 * composer - PHP 包管理工具 ### 2.2. 支持的操作系统 * [x] Debian * [x] Ubuntu * [x] Kali * [x] CentOS * [x] Fedora * [ ] Gentoo * [ ] MacOS ## 3. 快速开始 ### 3.1. 安装 ansible 首先,下载安装 ansible 工具 - Linux: ```bash $ apt install ansible ``` - MacOS: ```bash $ brew install ansible ``` - Github 仓库 ```bash $ git clone https://github.com/ansible/ansible ``` ### 3.2. 创建个 ansible 的用户 添加用户: ```bash $ useradd {{ your_ansible_user }}-m -G users,sudo -s /bin/bash $ passwd $ mkdir -p ~/.ssh ``` 生成用户的密钥对: ```bash $ ssh-keygen -t rsa -b 4096 -C "{{ your_ansible_user }}" ``` 分发公钥: ```bash $ scp .ssh/id_rsa.pub {{ your_ansible_user }}@{{ target_host }}:~/.ssh/authorized_keys ``` 测试一下: ```bash $ ssh -T {{ your_ansible_user }}@{{ target_host }} ``` ### 3.3. 安装 thinkphp_tech.thinkphp 集合 安装集合: ```bash $ ansible-galaxy collection install thinkphp_tech.thinkphp ``` 默认情况下,集合会被安装到: ```bash ~/.ansible/collections/ansible_collections/thinkphp_tech/thinkphp/ ``` ### 3.4. 编写执行的剧本 接下来就可以自定一个剧本文件使用集合里面包含的角色,(比如叫 playbook.yml): ```yaml --- - name : configure and deploy the local servers and app codes hosts: {{ your_host_group_in_your_inventory }} remote_user: {{ your_remote_ansible_user }} become: yes become_method: sudo vars: ansible_python_interpreter: /usr/bin/python3 php_install_composer: true php_install_pecl: true php_install_redis: true php_install_swoole: true php_install_xdebug: true php_install_xhprof: true collections: - thinkphp_tech.thinkphp roles: - common - nginx - php - redis - git ``` 也可以参考一下这个仓库的例子: [thinkphp-tech/ansible-examples](https://github.com/thinkphp-tech/ansible-examples) ## 4. 软件清单 ### 4.1. Web 服务 - [x] apache - [x] nginx - [x] varnish ### 4.2. 数据库服务 - [x] mariadb - [x] mysql - [x] postgresql - [x] sqlite3 - [x] tidb ### 4.3. 键值和队列服务 - [x] beanstalkd - [x] memcached - [x] redis - [x] rabbitmq ### 4.4. PHP 及扩展 - [x] php-cli - [x] php-fpm - [x] php-redis - [x] swoole - [x] xdebug - [x] xhprof - [x] composer ### 4.5. 其他 - [x] git - [x] vsftpd - [x] byobu - [x] tmux - [x] htop - [x] iftop - [x] dstat - [x] hdparm - [x] iotop - [x] multitail - [x] net-tools - [x] unzip - [x] pixz - [x] vim - [x] zsh - [x] nodejs (with yarn, n, gulp, grunt, vue-cli)