• About Us
  • Contact
  • Trang chủ
  • Code
  • Linux
  • Virtualization
  • Mail
No Result
View All Result
System Zone
No Result
View All Result
Home Lập trình web

[Ansible] Hướng dẫn cài đặt WordPress trên nhiều host

admin by admin
23 Tháng 9, 2025
in Lập trình web, Linux
0
0
SHARES
3
VIEWS
Share on FacebookShare on Twitter

Xem hướng dẫn cài đặt : Hướng dẫn cài đặt ansile Server Client

Related Posts

Hướng dẫn viết script sync dữ liệu giữa 2 VPS linux qua SSH key

Hướng dẫn cài đặt MongoDB 5 trên centos 7

Hướng dẫn resize ổ cứng bằng Gparted trên centos 7

Hướng dẫn fix lỗi không build được php 8.0 trên Directadmin

Link tải: ansile-wordpress.yml

hoặc copy từ nội dung bên dưới:

---
  - name: Setup webserver
    hosts: client
    become: true
    tasks:
    - name: Yum update
      shell: yum update -y
    - name: Install ntpdate
      shell: yum install ntpdate net-tools -y
    - name: Install the latest version of apache
      yum:
        name: httpd
        state: latest
    - name: Disable Selinux
      ansible.posix.selinux:
        state: disabled 
    - name: Open Port http
      ansible.posix.firewalld:
        service: http
        permanent: yes
        state: enabled
    - name: Open port https     
      ansible.posix.firewalld:
        service: https
        permanent: yes
        state: enabled
    - name: Install Epel-release
      package:
        name: epel-release
        state: latest
    - name: Install yum untils
      shell: yum install yum-utils -y
    - name: Download repo PHP
      shell: yum -y install http://rpms.remirepo.net/enterprise/remi-release-7.rpm
    - name: Disable PHP 5.4
      shell: yum-config-manager --disable remi-php54
    - name: Enable PHP 7.3
      shell: yum-config-manager --enable remi-php73
    - name: Install php-gd
      shell: yum -y install php php-mysql php-gd php-ldap php-odbc php-pear php-xml php-xmlrpc php-mbstring php-snmp php-soap curl
    - name: Install phpmyadmin
      shell: yum -y install phpmyadmin
    - name: Yum Wget
      yum:
        name: wget
        state: latest
    - name: Download Repo Mariadb
      get_url:
        url: https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
        dest: /root
        mode: +x
    - name: cd in folder root
      ansible.builtin.command:
        cmd: cd /root
    - name: Install mariadb from repo
      ansible.builtin.command:
        cmd: ./mariadb_repo_setup
    - name: Install mariadb
      ansible.builtin.command:
        cmd: yum install MariaDB-server -y
        warn: false
    - name: Start and enable Mariadb
      service:
        name: mariadb
        enabled: true
        state: started
    - name : Start and  enable httpd
      service:
        name: httpd
        state: started
        enabled: true
    - name: Install MYSQL-Python 2.7
      ansible.builtin.command:
        cmd: yum install MySQL-python -y
    - name: Create wordpress DB
      community.mysql.mysql_db:
        name: wpdb
        state: present
    - name: Remove all anonymous user
      community.mysql.mysql_user:
        name: ''
        host_all: yes
        state: absent
    - name: Create database user with all database privileges
      community.mysql.mysql_user:
        name: wpuser
        password: wp123456
        priv: '*.*:ALL'
        state: present
    - name: Download source WordPress
      get_url: 
        url: https://wordpress.org/wordpress-5.7.2.tar.gz
        dest: /root
    - name: Extract source WP
      unarchive:
        src: /root/wordpress-5.7.2.tar.gz
        dest: /root/
        remote_src: yes
    - name: Move source to /var/www/html
      shell: mv /root/wordpress/* /var/www/html/
    - name: Set user group
      shell: chown -R apache:apache /var/www/html/*
    - name: Backup file config
      shell: cp /var/www/html/wp-config-sample.php /var/www/html/wp-config.php
    - name: Config DB name
      replace:
        path: /var/www/html/wp-config.php
        regexp: 'database_name_here'
        replace: 'wpdb'
    - name: Config user db
      replace:
        path: /var/www/html/wp-config.php
        regexp: 'username_here'
        replace: 'wpuser'
    - name: Connfig Password DB
      replace:
        path: /var/www/html/wp-config.php
        regexp: 'password_here'
        replace: 'wp123456'
    - name: Restart Apache
      service:
        name: httpd
        state: restarted
    - name: Restart firewalld
      shell: systemctl restart firewalld

[quote] [root@gitlab ~]# ansible-playbook -i ansible-wordpress.yml [/quote]

Sau khi lệnh chạy xong thì tiến hành vào IP setup bước còn lại

Tags: ansiblecài đặt wordpress bằng ansilecài đặt Wordpress trên nhiều host bằng AnsibleHướng dẫn cài đặt Wordpress trên nhiều host bằng Ansiblewordpresswordpress ansible
Next Post

[Docker] Bài 1 - Cài đặt docker-compose trên centos 7

0 0 đánh giá
Đánh giá bài viết
Theo dõi
Đăng nhập
Thông báo của
guest
guest
0 Góp ý
Cũ nhất
Mới nhất Được bỏ phiếu nhiều nhất
Phản hồi nội tuyến
Xem tất cả bình luận

Bài viết mới

  • Hướng dẫn viết script sync dữ liệu giữa 2 VPS linux qua SSH key
  • Hướng dẫn cài đặt MongoDB 5 trên centos 7
  • Hướng dẫn resize ổ cứng bằng Gparted trên centos 7
  • Hướng dẫn fix lỗi không build được php 8.0 trên Directadmin
  • Hướng dẫn thêm tên miền phụ trong Gsuite

Danh mục

  • Directadmin (1)
  • Gsuite (1)
  • Kiếm tiền Online (2)
  • Kiss Daily Talk (3)
  • Lập trình web (20)
  • Learning More (2)
  • Linux (19)
  • Mail (4)
  • Mongo DB (1)
  • Window (2)
  • Xâm nhập thế giới hacker (4)

Bài viết mới

  • Hướng dẫn viết script sync dữ liệu giữa 2 VPS linux qua SSH key
  • Hướng dẫn cài đặt MongoDB 5 trên centos 7
  • Hướng dẫn resize ổ cứng bằng Gparted trên centos 7
  • Hướng dẫn fix lỗi không build được php 8.0 trên Directadmin
  • Hướng dẫn thêm tên miền phụ trong Gsuite
  • Mail
  • Virtualization
  • Lập trình web
  • Linux Administrator
  • Learning More

© 2025 SystemZone - Premium WordPress news & magazine theme by Aitemat.

No Result
View All Result
  • About Us
  • About Us
  • blog
  • Campaign
  • Cart
  • Checkout
  • Cửa hàng
  • Giỏ hàng
  • Giới thiệu
  • Home 2
  • IT STORY
  • Lập trình web
  • Learning More
  • Linux Administrator
  • Mail
  • My account
    • Wishlist
  • Privacy Policy
  • Sample Page
  • Thanh toán
  • Track your order
  • Trang chủ
  • Trang Mẫu
  • Virtualization
  • Sections
  • Rows / Columns
  • Sliders
  • Buttons
  • Titles / Dividers
  • Blog Posts
  • Mega Shop
  • Simple Slider
  • Banner Grids
  • Icon Box
  • Lightbox
  • Scroll To
  • Pages
    • About
    • Contact
    • FAQ
    • Portfolio
  • Map
  • Message box
  • Product Categories
  • Products
  • Share / follow icons
  • Tabs
  • Team Member
  • Testimonials

© 2025 SystemZone - Premium WordPress news & magazine theme by Aitemat.

wpDiscuz
0
0
Rất thích suy nghĩ của bạn, hãy bình luận.x
()
x
| Trả lời