Infra Provision
How to provision infrastructure
选择性执行
您可以通过ansible的标签机制,可以选择执行剧本的一个子集。
例如,如果您只想执行本地源初始化的部分,则可以通过以下命令进行
./infra.yml --tags=repo
默认任务
使用以下命令可以列出所有基础设施初始化会执行的任务,以及可以使用的标签:
./infra.yml --list-tasks
默认任务如下:
playbook: ./infra.yml
play #1 (meta): Init local repo TAGS: [repo]
tasks:
Create local repo directory TAGS: [repo, repo_dir]
Backup & remove existing repos TAGS: [repo, repo_upstream]
Add required upstream repos TAGS: [repo, repo_upstream]
Check repo pkgs cache exists TAGS: [repo, repo_prepare]
Set fact whether repo_exists TAGS: [repo, repo_prepare]
Move upstream repo to backup TAGS: [repo, repo_prepare]
Add local file system repos TAGS: [repo, repo_prepare]
repo : Remake yum cache if not exists TAGS: [repo, repo_prepare]
Install repo bootstrap packages TAGS: [repo, repo_boot]
Render repo nginx server files TAGS: [repo, repo_nginx]
Disable selinux for repo server TAGS: [repo, repo_nginx]
Launch repo nginx server TAGS: [repo, repo_nginx]
Waits repo server online TAGS: [repo, repo_nginx]
repo : Download web url packages TAGS: [repo, repo_download]
Download repo packages TAGS: [repo, repo_download]
Download repo pkg deps TAGS: [repo, repo_download]
Create local repo index TAGS: [repo, repo_download]
repo : Copy bootstrap scripts TAGS: [repo, repo_download, repo_script]
Mark repo cache as valid TAGS: [repo, repo_download]
play #2 (all): Provision Node TAGS: [node]
tasks:
Update node hostname TAGS: [node, node_name]
node : Add new hostname to /etc/hosts TAGS: [node, node_name]
node : Write static dns records TAGS: [node, node_dns]
node : Get old nameservers TAGS: [node, node_resolv]
node : Truncate resolv file TAGS: [node, node_resolv]
node : Write resolv options TAGS: [node, node_resolv]
node : Add new nameservers TAGS: [node, node_resolv]
node : Append old nameservers TAGS: [node, node_resolv]
node : Node configure disable firewall TAGS: [node, node_firewall]
node : Node disable selinux by default TAGS: [node, node_firewall]
node : Backup existing repos TAGS: [node, node_repo]
node : Install upstream repo TAGS: [node, node_repo]
node : Install local repo TAGS: [node, node_repo]
Install node basic packages TAGS: [node, node_pkgs]
Install node extra packages TAGS: [node, node_pkgs]
node : Install meta specific packages TAGS: [node, node_pkgs]
Install node basic packages TAGS: [node, node_pkgs]
Install node extra packages TAGS: [node, node_pkgs]
node : Install meta specific packages TAGS: [node, node_pkgs]
node : Node configure disable numa TAGS: [node, node_feature]
node : Node configure disable swap TAGS: [node, node_feature]
node : Node configure unmount swap TAGS: [node, node_feature]
node : Node setup static network TAGS: [node, node_feature]
node : Node configure disable firewall TAGS: [node, node_feature]
node : Node configure disk prefetch TAGS: [node, node_feature]
node : Enable linux kernel modules TAGS: [node, node_kernel]
node : Enable kernel module on reboot TAGS: [node, node_kernel]
node : Get config parameter page count TAGS: [node, node_tuned]
node : Get config parameter page size TAGS: [node, node_tuned]
node : Tune shmmax and shmall via mem TAGS: [node, node_tuned]
node : Create tuned profiles TAGS: [node, node_tuned]
node : Render tuned profiles TAGS: [node, node_tuned]
node : Active tuned profile TAGS: [node, node_tuned]
node : Change additional sysctl params TAGS: [node, node_tuned]
node : Copy default user bash profile TAGS: [node, node_profile]
Setup node default pam ulimits TAGS: [node, node_ulimit]
node : Create os user group admin TAGS: [node, node_admin]
node : Create os user admin TAGS: [node, node_admin]
node : Grant admin group nopass sudo TAGS: [node, node_admin]
node : Add no host checking to ssh config TAGS: [node, node_admin]
node : Add admin ssh no host checking TAGS: [node, node_admin]
node : Fetch all admin public keys TAGS: [node, node_admin]
node : Exchange all admin ssh keys TAGS: [node, node_admin]
node : Install public keys TAGS: [node, node_admin]
node : Install ntp package TAGS: [node, ntp_install]
node : Install chrony package TAGS: [node, ntp_install]
Setup default node timezone TAGS: [node, ntp_config]
node : Copy the ntp.conf file TAGS: [node, ntp_config]
node : Copy the chrony.conf template TAGS: [node, ntp_config]
node : Launch ntpd service TAGS: [node, ntp_launch]
node : Launch chronyd service TAGS: [node, ntp_launch]
play #3 (meta): Init meta service TAGS: [meta]
tasks:
Create local ca directory TAGS: [ca, ca_dir, meta]
Copy ca cert from local files TAGS: [ca, ca_copy, meta]
Check ca key cert exists TAGS: [ca, ca_create, meta]
ca : Create self-signed CA key-cert TAGS: [ca, ca_create, meta]
Make sure nginx package installed TAGS: [meta, nginx]
Copy nginx default config TAGS: [meta, nginx]
Copy nginx upstream conf TAGS: [meta, nginx]
nginx : Create local html directory TAGS: [meta, nginx]
Update default nginx index page TAGS: [meta, nginx]
Restart meta nginx service TAGS: [meta, nginx]
Wait for nginx service online TAGS: [meta, nginx]
Make sure nginx exporter installed TAGS: [meta, nginx, nginx_exporter]
Config nginx_exporter options TAGS: [meta, nginx, nginx_exporter]
Restart nginx_exporter service TAGS: [meta, nginx, nginx_exporter]
Wait for nginx exporter online TAGS: [meta, nginx, nginx_exporter]
Install prometheus and alertmanager TAGS: [meta, prometheus, prometheus_install]
Wipe out prometheus config dir TAGS: [meta, prometheus, prometheus_clean]
Wipe out existing prometheus data TAGS: [meta, prometheus, prometheus_clean]
Recreate prometheus data dir TAGS: [meta, prometheus, prometheus_config]
Copy /etc/prometheus configs TAGS: [meta, prometheus, prometheus_config]
Copy /etc/prometheus opts TAGS: [meta, prometheus, prometheus_config]
Overwrite prometheus scrape_interval TAGS: [meta, prometheus, prometheus_config]
Overwrite prometheus evaluation_interval TAGS: [meta, prometheus, prometheus_config]
Overwrite prometheus scrape_timeout TAGS: [meta, prometheus, prometheus_config]
Overwrite prometheus pg metrics path TAGS: [meta, prometheus, prometheus_config]
Launch prometheus service TAGS: [meta, prometheus, prometheus_launch]
prometheus : Launch alertmanager service TAGS: [meta, prometheus, prometheus_launch]
Wait for prometheus online TAGS: [meta, prometheus, prometheus_launch]
prometheus : Wait for alertmanager online TAGS: [meta, prometheus, prometheus_launch]
Make sure grafana is installed TAGS: [grafana, grafana_install, meta]
Check grafana plugin cache exists TAGS: [grafana, grafana_plugin, meta]
Provision grafana plugins via cache TAGS: [grafana, grafana_plugin, meta]
Download grafana plugins from web TAGS: [grafana, grafana_plugin, meta]
Download grafana plugins from web TAGS: [grafana, grafana_plugin, meta]
Create grafana plugins cache TAGS: [grafana, grafana_plugin, meta]
Copy /etc/grafana/grafana.ini TAGS: [grafana, grafana_config, meta]
Remove grafana provision dir TAGS: [grafana, grafana_config, meta]
grafana : Copy provisioning content TAGS: [grafana, grafana_config, meta]
grafana : Copy pigsty dashboards TAGS: [grafana, grafana_config, meta]
grafana : Copy pigsty icon image TAGS: [grafana, grafana_config, meta]
Replace grafana icon with pigsty TAGS: [grafana, grafana_config, grafana_customize, meta]
Launch grafana service TAGS: [grafana, grafana_launch, meta]
Wait for grafana online TAGS: [grafana, grafana_launch, meta]
Update grafana default preferences TAGS: [grafana, grafana_provision, meta]
Register consul grafana service TAGS: [grafana, grafana_register, meta]
grafana : Reload consul TAGS: [grafana, grafana_register, meta]
play #4 (all): Init dcs TAGS: []
tasks:
Check for existing consul TAGS: [consul_check, dcs]
consul : Consul exists flag fact set TAGS: [consul_check, dcs]
Abort due to consul exists TAGS: [consul_check, dcs]
Clean existing consul instance TAGS: [consul_check, dcs]
Stop any running consul instance TAGS: [consul_check, dcs]
Remove existing consul dir TAGS: [consul_check, dcs]
Recreate consul dir TAGS: [consul_check, dcs]
Make sure consul is installed TAGS: [consul_install, dcs]
Make sure consul dir exists TAGS: [consul_config, dcs]
consul : Get dcs server node names TAGS: [consul_config, dcs]
consul : Get dcs node name from var TAGS: [consul_config, dcs]
consul : Get dcs node name from var TAGS: [consul_config, dcs]
consul : Fetch hostname as dcs node name TAGS: [consul_config, dcs]
consul : Get dcs name from hostname TAGS: [consul_config, dcs]
Copy /etc/consul.d/consul.json TAGS: [consul_config, dcs]
Copy consul agent service TAGS: [consul_config, dcs]
consul : Get dcs bootstrap expect quroum TAGS: [consul_server, dcs]
Copy consul server service unit TAGS: [consul_server, dcs]
Launch consul server service TAGS: [consul_server, dcs]
Wait for consul server online TAGS: [consul_server, dcs]
Launch consul agent service TAGS: [consul_agent, dcs]
Wait for consul agent online TAGS: [consul_agent, dcs]
play #5 (meta): Copy ansible scripts TAGS: [ansible]
tasks:
Create ansible tarball TAGS: [ansible]
Create ansible directory TAGS: [ansible]
Copy ansible tarball TAGS: [ansible]
Extract tarball TAGS: [ansible]
Last modified 2021-01-10: update en docs (9c05029)