Table of Contents
workstation
rp_server
vim /etc/hosts
192.168.0.20 rp.example.com rp
-------------------------------
vim inventory
[rp]
rp.example.com
-------------------------------
vim .vimrc
autocmd Filetype html setlocal ai ts=1 sw=2 et nu cursorcolumn cursorline
autocmd Filetype j2 setlocal ai ts=2 sw=2 et nu cursorcolumn cursorline
autocmd Filetype yaml setlocal ai ts=2 sw=2 et nu cursorcolumn cursorline
Workstation ansible.cfg config
-------------------------------
完全註解ansible.cfg
ansible-config init --disabled > ansible.cfg
-------------------------------
vim ansible.cfg
collections_paths=/home/wk/devwp/mycollections
inventory=inventory
remote_user=rp
roles_path=/home/wk/devwp/roles
become=True
become_ask_pass=False
become_method=sudo
become_user=root
-------------------------------
vim inventory
[rp]
rp.example.com
-------------------------------
- 本文使用 Red Hat® Enterprise Linux設置。
- 硬碟大小不再本文討論範圍。
- Workstaation 與RP 交換金鑰。
切換身分免密碼
sudi -i
visdo
複製
# %wheel ALL=(ALL) NOPASSWD: ALL
vim /etc/sudoers.d/rp
rp ALL=(ALL) NOPASSWD: ALL
-------------------------------
劇本rp_include.yml
---
- name: includ rp soft and config all
hosts: rp
vars_files:
- se_forms.yml
- /{{ ansible_facts['hostname'] }}/se_edit.yml
tasks:
- include_tasks: se_sethostname.yml
- include_tasks: se_epel.yml
- include_tasks: se_packages.yml
- include_tasks: se_service.yml
- include_tasks: se_firewalld.yml
- include_tasks: se_nginx_conf.yml
- include_tasks: se_ddclient_conf.yml
- include_tasks: se_webcontent.yml
- include_tasks: se_certbot.yml